agedu-r9723/0000755000175300017530000000000012163703774012003 5ustar simonsimonagedu-r9723/alloc.h0000644000175300017530000000431712163703774013253 0ustar simonsimon/* * alloc.h: safe wrappers around malloc, realloc, free, strdup */ #ifndef AGEDU_ALLOC_H #define AGEDU_ALLOC_H #include /* * smalloc should guarantee to return a useful pointer. */ void *smalloc(size_t size); /* * srealloc should guaranteeably be able to realloc NULL */ void *srealloc(void *p, size_t size); /* * sfree should guaranteeably deal gracefully with freeing NULL */ void sfree(void *p); /* * dupstr is like strdup, but with the never-return-NULL property * of smalloc (and also reliably defined in all environments :-) */ char *dupstr(const char *s); /* * dupfmt is a bit like printf, but does its own allocation and * returns a dynamic string. It also supports a different (and * much less featureful) set of format directives: * * - %D takes no argument, and gives the current date and time in * a format suitable for an HTTP Date header * - %d takes an int argument and formats it like normal %d (but * doesn't support any of the configurability of standard * printf) * - %s takes a const char * and formats it like normal %s * (again, no fine-tuning available) * - %h takes a const char * but escapes it so that it's safe for * HTML * - %S takes an int followed by a const char *. If the int is * zero, it behaves just like %s. If the int is nonzero, it * transforms the string by stuffing a \r before every \n. */ char *dupfmt(const char *fmt, ...); /* * snew allocates one instance of a given type, and casts the * result so as to type-check that you're assigning it to the * right kind of pointer. Protects against allocation bugs * involving allocating the wrong size of thing. */ #define snew(type) \ ( (type *) smalloc (sizeof (type)) ) /* * snewn allocates n instances of a given type, for arrays. */ #define snewn(number, type) \ ( (type *) smalloc ((number) * sizeof (type)) ) /* * sresize wraps realloc so that you specify the new number of * elements and the type of the element, with the same type- * checking advantages. Also type-checks the input pointer. */ #define sresize(array, number, type) \ ( (void)sizeof((array)-(type *)0), \ (type *) srealloc ((array), (number) * sizeof (type)) ) #endif /* AGEDU_ALLOC_H */ agedu-r9723/winscan.c0000644000175300017530000001325512163703774013617 0ustar simonsimon#include #include #include #define lenof(x) (sizeof((x))/sizeof(*(x))) #define snew(type) \ ( (type *) malloc (sizeof (type)) ) #define snewn(number, type) \ ( (type *) malloc ((number) * sizeof (type)) ) #define sresize(array, number, type) \ ( (void)sizeof((array)-(type *)0), \ (type *) realloc ((array), (number) * sizeof (type)) ) #define sfree free char *dupstr(const char *s) { char *r = malloc(1+strlen(s)); strcpy(r,s); return r; } typedef struct { HANDLE hdl; WIN32_FIND_DATA fdata; int got_one, eod; } dirhandle; int open_dir(char *path, dirhandle *dh) { strcat(path, "\\*"); dh->hdl = FindFirstFile(path, &dh->fdata); if (dh->hdl == INVALID_HANDLE_VALUE) { int err = GetLastError(); if (err == ERROR_FILE_NOT_FOUND) { dh->eod = 1; dh->got_one = 0; return 0; } else { return -err; } } else { dh->eod = 0; dh->got_one = 1; return 0; } } const char *read_dir(dirhandle *dh) { if (!dh->got_one) { if (dh->eod) return NULL; if (FindNextFile(dh->hdl, &dh->fdata)) { dh->got_one = 1; } else { dh->eod = 1; return NULL; } } dh->got_one = 0; return dh->fdata.cFileName; } void close_dir(dirhandle *dh) { CloseHandle(dh->hdl); } static int str_cmp(const void *av, const void *bv) { return strcmp(*(const char **)av, *(const char **)bv); } typedef int (*gotdata_fn_t)(void *ctx, const char *pathname, WIN32_FIND_DATA *dat); static void du_recurse(char **path, size_t pathlen, size_t *pathsize, gotdata_fn_t gotdata, void *gotdata_ctx) { const char *name; dirhandle d; char **names; int error; size_t i, nnames, namesize; WIN32_FIND_DATA dat; HANDLE h; if (*pathsize <= pathlen + 10) { *pathsize = pathlen * 3 / 2 + 256; *path = sresize(*path, *pathsize, char); } h = FindFirstFile(*path, &dat); if (h != INVALID_HANDLE_VALUE) { CloseHandle(h); } else if (pathlen > 0 && (*path)[pathlen-1] == '\\') { dat.nFileSizeHigh = dat.nFileSizeLow = 0; dat.ftLastWriteTime.dwHighDateTime = 0x19DB1DE; dat.ftLastWriteTime.dwLowDateTime = 0xD53E8000; dat.ftLastAccessTime.dwHighDateTime = 0x19DB1DE; dat.ftLastAccessTime.dwLowDateTime = 0xD53E8000; h = CreateFile(*path, GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (h != INVALID_HANDLE_VALUE) { GetFileTime(h, &dat.ftCreationTime, &dat.ftLastAccessTime, &dat.ftLastWriteTime); CloseHandle(h); } } if (!gotdata(gotdata_ctx, *path, &dat)) return; if (!(GetFileAttributes(*path) & FILE_ATTRIBUTE_DIRECTORY)) return; names = NULL; nnames = namesize = 0; if ((error = open_dir(*path, &d)) < 0) { char buf[4096]; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, -error, 0, buf, lenof(buf), NULL); buf[lenof(buf)-1] = '\0'; if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; fprintf(stderr, "Unable to open directory '%s': %s\n", *path, buf); return; } while ((name = read_dir(&d)) != NULL) { if (name[0] == '.' && (!name[1] || (name[1] == '.' && !name[2]))) { /* do nothing - we skip "." and ".." */ } else { if (nnames >= namesize) { namesize = nnames * 3 / 2 + 64; names = sresize(names, namesize, char *); } names[nnames++] = dupstr(name); } } close_dir(&d); if (nnames == 0) return; qsort(names, nnames, sizeof(*names), str_cmp); for (i = 0; i < nnames; i++) { size_t newpathlen = pathlen + 1 + strlen(names[i]); if (*pathsize <= newpathlen) { *pathsize = newpathlen * 3 / 2 + 256; *path = sresize(*path, *pathsize, char); } /* * Avoid duplicating a slash if we got a trailing one to * begin with (i.e. if we're starting the scan in '\\' itself). */ if (pathlen > 0 && (*path)[pathlen-1] == '\\') { strcpy(*path + pathlen, names[i]); newpathlen--; } else { sprintf(*path + pathlen, "\\%s", names[i]); } du_recurse(path, newpathlen, pathsize, gotdata, gotdata_ctx); sfree(names[i]); } sfree(names); } void du(const char *inpath, gotdata_fn_t gotdata, void *gotdata_ctx) { char *path; size_t pathlen, pathsize; pathlen = strlen(inpath); pathsize = pathlen + 256; path = snewn(pathsize, char); strcpy(path, inpath); du_recurse(&path, pathlen, &pathsize, gotdata, gotdata_ctx); } int gd(void *ctx, const char *pathname, WIN32_FIND_DATA *dat) { unsigned long long size, t; FILETIME ft; const char *p; size = dat->nFileSizeHigh; size = (size << 32) | dat->nFileSizeLow; printf("%llu ", size); if (dat->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ft = dat->ftLastWriteTime; else ft = dat->ftLastAccessTime; t = ft.dwHighDateTime; t = (t << 32) | ft.dwLowDateTime; t /= 10000000; /* * Correction factor: number of seconds between Windows's file * time epoch of 1 Jan 1601 and Unix's time_t epoch of 1 Jan 1970. * * That's 369 years, of which 92 were divisible by 4, but * three of those were century points. */ t -= (369 * 365 + 92 - 3) * 86400; printf("%llu ", t); for (p = pathname; *p; p++) { if (*p >= ' ' && *p < 127 && *p != '%') putchar(*p); else printf("%%%02x", (unsigned char)*p); } putchar('\n'); return 1; } int main(int argc, char **argv) { char *dir; int dirlen, dirsize; if (argc > 1) SetCurrentDirectory(argv[1]); dirsize = 512; dir = snewn(dirsize, char); while ((dirlen = GetCurrentDirectory(dirsize, dir)) >= dirsize) { dirsize = dirlen + 256; dir = sresize(dir, dirsize, char); } printf("agedu dump file. pathsep=5c\n"); du(dir, gd, NULL); } agedu-r9723/licence.c0000644000175300017530000000247212163703774013556 0ustar simonsimon#include "agedu.h" const char *const licence[] = { PNAME " is copyright 2008 Simon Tatham. All rights reserved.\n", "\n", "Permission is hereby granted, free of charge, to any person\n", "obtaining a copy of this software and associated documentation files\n", "(the \"Software\"), to deal in the Software without restriction,\n", "including without limitation the rights to use, copy, modify, merge,\n", "publish, distribute, sublicense, and/or sell copies of the Software,\n", "and to permit persons to whom the Software is furnished to do so,\n", "subject to the following conditions:\n", "\n", "The above copyright notice and this permission notice shall be\n", "included in all copies or substantial portions of the Software.\n", "\n", "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n", "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n", "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n", "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n", "BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n", "ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n", "CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n", "SOFTWARE.\n", 0 }; agedu-r9723/fgetline.h0000644000175300017530000000053012163703774013747 0ustar simonsimon/* * fgetline.h: Utility function to read a complete line of text * from a file, allocating memory for it as large as necessary. */ /* * Read an entire line of text from a file. Return a dynamically * allocated buffer containing the complete line including * trailing newline. * * On error, returns NULL. */ char *fgetline(FILE *fp); agedu-r9723/trie.c0000644000175300017530000005342512163703774013123 0ustar simonsimon/* * trie.c: implementation of trie.h. */ #include "agedu.h" #include "alloc.h" #include "trie.h" #define alignof(typ) ( offsetof(struct { char c; typ t; }, t) ) /* * Compare functions for pathnames. Returns the relative order of * the names, like strcmp; also passes back the offset of the * first differing character if desired. */ static int trieccmp(unsigned char a, unsigned char b) { int ia = (a == '\0' ? '\0' : a == pathsep ? '\1' : a+1); int ib = (b == '\0' ? '\0' : b == pathsep ? '\1' : b+1); return ia - ib; } static int triencmp(const char *a, size_t alen, const char *b, size_t blen, int *offset) { int off = 0; while (off < alen && off < blen && a[off] == b[off]) off++; if (offset) *offset = off; if (off == alen || off == blen) return (off == blen) - (off == alen); return trieccmp(a[off], b[off]); } static int triecmp(const char *a, const char *b, int *offset) { return triencmp(a, strlen(a), b, strlen(b), offset); } /* ---------------------------------------------------------------------- * Trie node structures. * * The trie format stored in the file consists of three distinct * node types, each with a distinguishing type field at the start. * * TRIE_LEAF is a leaf node; it contains an actual trie_file * structure, and indicates that when you're searching down the * trie with a string, you should now expect to encounter * end-of-string. * * TRIE_SWITCH indicates that the set of strings in the trie * include strings with more than one distinct character after the * prefix leading up to this point. Hence, it stores multiple * subnode pointers and a different single character for each one. * * TRIE_STRING indicates that at this point everything in the trie * has the same next few characters; it stores a single mandatory * string fragment and exactly one subnode pointer. */ enum { TRIE_LEAF = 0x7fffe000, TRIE_SWITCH, TRIE_STRING }; struct trie_common { int type; }; struct trie_switchentry { off_t subnode; int subcount; }; struct trie_leaf { struct trie_common c; struct trie_file file; }; struct trie_switch { struct trie_common c; /* * sw[0] to sw[len-1] give the subnode pointers and element * counts. At &sw[len] is stored len single bytes which are * the characters corresponding to each subnode. */ int len; struct trie_switchentry sw[]; }; struct trie_string { struct trie_common c; int stringlen; off_t subnode; char string[]; }; static const char magic_ident_string[16] = "agedu index file"; struct trie_magic { /* * 'Magic numbers' to go at the start of an agedu index file. * These are checked (using trie_check_magic) by every agedu mode * which reads a pre-existing index. * * As well as identifying an agedu file from any other kind of * file, this magic-number structure is also intended to detect * agedu files which were written on the wrong platform and hence * whose structure layouts are incompatible. To make that as * reliable as possible, I design the structure of magic numbers * as follows: it contains one of each integer type I might use, * each containing a different magic number, and each followed by * a char to indicate where it ends in the file. One byte is set * to the length of the magic-number structure itself, which means * that no two structures of different lengths can possibly * compare equal even if by some chance they match up to the * length of the shorter one. Finally, the whole magic number * structure is memset to another random byte value before * initialising any of these fields, so that padding in between * can be readily identified. */ char ident[16]; /* human-readable string */ unsigned char magic_len; unsigned long long longlong_magic; unsigned char postlonglong_char_magic; off_t offset_magic; unsigned char postoffset_char_magic; size_t size_magic; unsigned char postsize_char_magic; void *null_pointer; unsigned char postptr_char_magic; unsigned long long_magic; unsigned char postlong_char_magic; unsigned short short_magic; unsigned char postshort_char_magic; }; struct trie_header { struct trie_magic magic; off_t root, indexroot; int count; size_t maxpathlen; int pathsep; }; /* Union only used for computing alignment */ union trie_node { struct trie_leaf leaf; struct { /* fake trie_switch with indeterminate array length filled in */ struct trie_common c; int len; struct trie_switchentry sw[1]; } sw; struct { /* fake trie_string with indeterminate array length filled in */ struct trie_common c; int stringlen; off_t subnode; char string[1]; } str; }; #define TRIE_ALIGN alignof(union trie_node) static void setup_magic(struct trie_magic *th) { /* * Magic values are chosen so that every byte value used is * distinct (so that we can't fail to spot endianness issues), and * we cast 64 bits of data into each integer type just in case * the platform makes it longer than we expect it to be. */ memset(th, 0xCDU, sizeof(*th)); th->magic_len = sizeof(*th); memcpy(th->ident, magic_ident_string, 16); th->longlong_magic = 0x5583F34D5D84F73CULL; th->postlonglong_char_magic = 0xDDU; th->offset_magic = (off_t)0xB39BF9AD56D48E0BULL; th->postoffset_char_magic = 0x95U; th->size_magic = (size_t)0x6EC752B0EEAEBAC1ULL; th->postsize_char_magic = 0x77U; th->null_pointer = NULL; th->postptr_char_magic = 0x71U; th->long_magic = (unsigned long)0xA81A5E1F44334716ULL; th->postlong_char_magic = 0x99U; th->short_magic = (unsigned short)0x0C8BD7984B68D9FCULL; th->postshort_char_magic = 0x35U; } /* ---------------------------------------------------------------------- * Trie-building functions. */ struct tbswitch { int len; char c[256]; off_t off[256]; int count[256]; }; struct triebuild { int fd; off_t offset; char *lastpath; int lastlen, lastsize; off_t lastoff; struct tbswitch *switches; int switchsize; size_t maxpathlen; }; static void tb_seek(triebuild *tb, off_t off) { tb->offset = off; if (lseek(tb->fd, off, SEEK_SET) < 0) { fprintf(stderr, PNAME ": lseek: %s\n", strerror(errno)); exit(1); } } static void tb_write(triebuild *tb, const void *buf, size_t len) { tb->offset += len; while (len > 0) { int ret = write(tb->fd, buf, len); if (ret < 0) { fprintf(stderr, PNAME ": write: %s\n", strerror(errno)); exit(1); } len -= ret; buf = (const void *)((const char *)buf + ret); } } static char trie_align_zeroes[TRIE_ALIGN]; static void tb_align(triebuild *tb) { int off = (TRIE_ALIGN - ((tb)->offset % TRIE_ALIGN)) % TRIE_ALIGN; tb_write(tb, trie_align_zeroes, off); } triebuild *triebuild_new(int fd) { triebuild *tb = snew(triebuild); struct trie_header th; tb->fd = fd; tb->lastpath = NULL; tb->lastlen = tb->lastsize = 0; tb->lastoff = 0; tb->switches = NULL; tb->switchsize = 0; tb->maxpathlen = 0; setup_magic(&th.magic); th.root = th.count = 0; th.indexroot = 0; th.maxpathlen = 0; th.pathsep = (unsigned char)pathsep; tb_seek(tb, 0); tb_write(tb, &th, sizeof(th)); return tb; } static off_t triebuild_unwind(triebuild *tb, int targetdepth, int *outcount) { off_t offset; int count, depth; if (tb->lastoff == 0) { *outcount = 0; return 0; } offset = tb->lastoff; count = 1; depth = tb->lastlen + 1; assert(depth >= targetdepth); while (depth > targetdepth) { int odepth = depth; while (depth > targetdepth && (depth-1 >= tb->switchsize || !tb->switches || tb->switches[depth-1].len == 0)) depth--; if (odepth > depth) { /* * Write out a string node. */ size_t nodesize = sizeof(struct trie_string) + odepth - depth; struct trie_string *st = (struct trie_string *)smalloc(nodesize); st->c.type = TRIE_STRING; st->stringlen = odepth - depth; st->subnode = offset; memcpy(st->string, tb->lastpath + depth, odepth - depth); tb_align(tb); offset = tb->offset; tb_write(tb, st, nodesize); sfree(st); } assert(depth >= targetdepth); if (depth <= targetdepth) break; /* * Now we expect to be sitting just below a switch node. * Add our final entry to it and write it out. */ depth--; { struct trie_switch *sw; char *chars; size_t nodesize; int swlen = tb->switches[depth].len; int i; assert(swlen > 0); tb->switches[depth].c[swlen] = tb->lastpath[depth]; tb->switches[depth].off[swlen] = offset; tb->switches[depth].count[swlen] = count; swlen++; nodesize = sizeof(struct trie_switch) + swlen * sizeof(struct trie_switchentry) + swlen; sw = (struct trie_switch *)smalloc(nodesize); chars = (char *)&sw->sw[swlen]; sw->c.type = TRIE_SWITCH; sw->len = swlen; count = 0; for (i = 0; i < swlen; i++) { sw->sw[i].subnode = tb->switches[depth].off[i]; sw->sw[i].subcount = tb->switches[depth].count[i]; chars[i] = tb->switches[depth].c[i]; count += tb->switches[depth].count[i]; } tb_align(tb); offset = tb->offset; tb_write(tb, sw, nodesize); sfree(sw); tb->switches[depth].len = 0; /* clear this node */ } } *outcount = count; return offset; } void triebuild_add(triebuild *tb, const char *pathname, const struct trie_file *file) { int pathlen = strlen(pathname); int depth; if (tb->maxpathlen < pathlen+1) tb->maxpathlen = pathlen+1; if (tb->lastpath) { off_t offset; int count; /* * Find the first differing character between this pathname * and the previous one. */ int ret = triecmp(tb->lastpath, pathname, &depth); assert(ret < 0); /* * Finalise all nodes above this depth. */ offset = triebuild_unwind(tb, depth+1, &count); /* * Add the final node we just acquired to the switch node * at our chosen depth, creating it if it isn't already * there. */ if (tb->switchsize <= depth) { int oldsize = tb->switchsize; tb->switchsize = depth * 3 / 2 + 64; tb->switches = sresize(tb->switches, tb->switchsize, struct tbswitch); while (oldsize < tb->switchsize) tb->switches[oldsize++].len = 0; } tb->switches[depth].c[tb->switches[depth].len] = tb->lastpath[depth]; tb->switches[depth].off[tb->switches[depth].len] = offset; tb->switches[depth].count[tb->switches[depth].len] = count; tb->switches[depth].len++; } /* * Write out a leaf node for the new file, and remember its * file offset. */ { struct trie_leaf leaf; leaf.c.type = TRIE_LEAF; leaf.file = *file; /* structure copy */ tb_align(tb); tb->lastoff = tb->offset; tb_write(tb, &leaf, sizeof(leaf)); } /* * Store this pathname for comparison with the next one. */ if (tb->lastsize < pathlen+1) { tb->lastsize = pathlen * 3 / 2 + 64; tb->lastpath = sresize(tb->lastpath, tb->lastsize, char); } strcpy(tb->lastpath, pathname); tb->lastlen = pathlen; } int triebuild_finish(triebuild *tb) { struct trie_header th; setup_magic(&th.magic); th.root = triebuild_unwind(tb, 0, &th.count); th.indexroot = 0; th.maxpathlen = tb->maxpathlen; th.pathsep = (unsigned char)pathsep; tb_seek(tb, 0); tb_write(tb, &th, sizeof(th)); return th.count; } void triebuild_free(triebuild *tb) { sfree(tb->switches); sfree(tb->lastpath); sfree(tb); } /* ---------------------------------------------------------------------- * Memory-mapped trie modification. */ #define MNODE(t, off, type) \ ((struct type *)((char *)(t) + (off))) static unsigned long long fake_atime_recurse(void *t, struct trie_common *node, int last_seen_pathsep) { while (node->type == TRIE_STRING) { struct trie_string *st = (struct trie_string *)node; last_seen_pathsep = (st->string[st->stringlen-1] == pathsep); node = MNODE(t, st->subnode, trie_common); } if (node->type == TRIE_LEAF) { struct trie_leaf *leaf = (struct trie_leaf *)node; return leaf->file.atime; } else if (assert(node->type == TRIE_SWITCH), 1) { struct trie_switch *sw = (struct trie_switch *)node; const char *chars = (const char *)&sw->sw[sw->len]; unsigned long long max = 0, subdir, ret; int i; int slashindex = -1, bareindex = -1; /* * First, process all the children of this node whose * switch characters are not \0 or pathsep. We do this in * reverse order so as to maintain best cache locality * (tracking generally backwards through the file), though * it doesn't matter semantically. * * For each of these children, we're just recursing into * it to do any fixups required below it, and amalgamating * the max atimes we get back. */ for (i = sw->len; i-- > 0 ;) { if (chars[i] == '\0') { bareindex = i; } else if (chars[i] == pathsep) { slashindex = i; } else { ret = fake_atime_recurse(t, MNODE(t, sw->sw[i].subnode, trie_common), 0); if (max < ret) max = ret; } } /* * Now we have at most two child nodes left to deal with: * one with a slash (or general pathsep) and one with \0. * * If there's a slash node and a bare node, then the slash * node contains precisely everything inside the directory * described by the bare node; so we must retrieve the max * atime for the slash node and use it to fix up the bare * node. * * If there's only a bare node but the pathname leading up * to this point ends in a slash, then _all_ of the child * nodes of this node contain stuff inside the directory * described by the bare node; so we use the whole of the * maximum value we've computed so far to update the bare * node. */ if (slashindex >= 0) { ret = fake_atime_recurse(t, MNODE(t, sw->sw[slashindex].subnode, trie_common), 1); if (max < ret) max = ret; subdir = ret; } else if (last_seen_pathsep) { subdir = max; } else { /* Don't update the bare subnode at all. */ subdir = 0; } if (bareindex >= 0) { struct trie_leaf *leaf; leaf = MNODE(t, sw->sw[bareindex].subnode, trie_leaf); if (leaf && leaf->c.type == TRIE_LEAF) { if (leaf->file.atime < subdir) leaf->file.atime = subdir; ret = leaf->file.atime; } else { /* Shouldn't really happen, but be cautious anyway */ ret = fake_atime_recurse(t, &leaf->c, 0); } if (max < ret) max = ret; } return max; } return 0; /* placate lint */ } void trie_fake_dir_atimes(void *t) { struct trie_header *hdr = MNODE(t, 0, trie_header); struct trie_common *node = MNODE(t, hdr->root, trie_common); fake_atime_recurse(t, node, 1); } /* ---------------------------------------------------------------------- * Querying functions. */ #define NODE(t, off, type) \ ((const struct type *)((const char *)(t) + (off))) int trie_check_magic(const void *t) { const struct trie_header *hdr = NODE(t, 0, trie_header); struct trie_magic magic; setup_magic(&magic); return !memcmp(&magic, &hdr->magic, sizeof(magic)); } size_t trie_maxpathlen(const void *t) { const struct trie_header *hdr = NODE(t, 0, trie_header); return hdr->maxpathlen; } unsigned long trie_before(const void *t, const char *pathname) { const struct trie_header *hdr = NODE(t, 0, trie_header); int ret = 0, lastcount = hdr->count; int len = 1 + strlen(pathname), depth = 0; off_t off = hdr->root; while (1) { const struct trie_common *node = NODE(t, off, trie_common); if (node->type == TRIE_LEAF) { if (depth < len) ret += lastcount; /* _shouldn't_ happen, but in principle */ return ret; } else if (node->type == TRIE_STRING) { const struct trie_string *st = NODE(t, off, trie_string); int offset; int cmp = triencmp(st->string, st->stringlen, pathname + depth, len-depth, &offset); if (offset < st->stringlen) { if (cmp < 0) ret += lastcount; return ret; } depth += st->stringlen; off = st->subnode; } else if (node->type == TRIE_SWITCH) { const struct trie_switch *sw = NODE(t, off, trie_switch); const char *chars = (const char *)&sw->sw[sw->len]; int i; for (i = 0; i < sw->len; i++) { int c = chars[i]; int cmp = trieccmp(pathname[depth], c); if (cmp > 0) ret += sw->sw[i].subcount; else if (cmp < 0) return ret; else { off = sw->sw[i].subnode; lastcount = sw->sw[i].subcount; depth++; break; } } if (i == sw->len) return ret; } } } void trie_getpath(const void *t, unsigned long n, char *buf) { const struct trie_header *hdr = NODE(t, 0, trie_header); int depth = 0; off_t off = hdr->root; while (1) { const struct trie_common *node = NODE(t, off, trie_common); if (node->type == TRIE_LEAF) { assert(depth > 0 && buf[depth-1] == '\0'); return; } else if (node->type == TRIE_STRING) { const struct trie_string *st = NODE(t, off, trie_string); memcpy(buf + depth, st->string, st->stringlen); depth += st->stringlen; off = st->subnode; } else if (node->type == TRIE_SWITCH) { const struct trie_switch *sw = NODE(t, off, trie_switch); const char *chars = (const char *)&sw->sw[sw->len]; int i; for (i = 0; i < sw->len; i++) { if (n < sw->sw[i].subcount) { buf[depth++] = chars[i]; off = sw->sw[i].subnode; break; } else n -= sw->sw[i].subcount; } assert(i < sw->len); } } } const struct trie_file *trie_getfile(const void *t, unsigned long n) { const struct trie_header *hdr = NODE(t, 0, trie_header); off_t off = hdr->root; while (1) { const struct trie_common *node = NODE(t, off, trie_common); if (node->type == TRIE_LEAF) { const struct trie_leaf *leaf = NODE(t, off, trie_leaf); return &leaf->file; } else if (node->type == TRIE_STRING) { const struct trie_string *st = NODE(t, off, trie_string); off = st->subnode; } else if (node->type == TRIE_SWITCH) { const struct trie_switch *sw = NODE(t, off, trie_switch); int i; for (i = 0; i < sw->len; i++) { if (n < sw->sw[i].subcount) { off = sw->sw[i].subnode; break; } else n -= sw->sw[i].subcount; } assert(i < sw->len); } } } unsigned long trie_count(const void *t) { const struct trie_header *hdr = NODE(t, 0, trie_header); return hdr->count; } char trie_pathsep(const void *t) { const struct trie_header *hdr = NODE(t, 0, trie_header); return (char)hdr->pathsep; } struct triewalk_switch { const struct trie_switch *sw; int pos, depth, count; }; struct triewalk { const void *t; struct triewalk_switch *switches; int nswitches, switchsize; int count; }; triewalk *triewalk_new(const void *vt) { triewalk *tw = snew(triewalk); tw->t = (const char *)vt; tw->switches = NULL; tw->switchsize = 0; tw->nswitches = -1; tw->count = 0; return tw; } void triewalk_rebase(triewalk *tw, const void *t) { ptrdiff_t diff = ((const unsigned char *)t - (const unsigned char *)(tw->t)); int i; tw->t = t; for (i = 0; i < tw->nswitches; i++) tw->switches[i].sw = (const struct trie_switch *) ((const unsigned char *)(tw->switches[i].sw) + diff); } const struct trie_file *triewalk_next(triewalk *tw, char *buf) { off_t off; int depth; if (tw->nswitches < 0) { const struct trie_header *hdr = NODE(tw->t, 0, trie_header); off = hdr->root; depth = 0; tw->nswitches = 0; } else { while (1) { int swpos; const struct trie_switch *sw; const char *chars; if (tw->nswitches == 0) { assert(tw->count == NODE(tw->t, 0, trie_header)->count); return NULL; /* run out of trie */ } swpos = tw->switches[tw->nswitches-1].pos; sw = tw->switches[tw->nswitches-1].sw; chars = (const char *)&sw->sw[sw->len]; if (swpos < sw->len) { depth = tw->switches[tw->nswitches-1].depth; off = sw->sw[swpos].subnode; if (buf) buf[depth++] = chars[swpos]; assert(tw->count == tw->switches[tw->nswitches-1].count); tw->switches[tw->nswitches-1].count += sw->sw[swpos].subcount; tw->switches[tw->nswitches-1].pos++; break; } tw->nswitches--; } } while (1) { const struct trie_common *node = NODE(tw->t, off, trie_common); if (node->type == TRIE_LEAF) { const struct trie_leaf *lf = NODE(tw->t, off, trie_leaf); if (buf) assert(depth > 0 && buf[depth-1] == '\0'); tw->count++; return &lf->file; } else if (node->type == TRIE_STRING) { const struct trie_string *st = NODE(tw->t, off, trie_string); if (buf) memcpy(buf + depth, st->string, st->stringlen); depth += st->stringlen; off = st->subnode; } else if (node->type == TRIE_SWITCH) { const struct trie_switch *sw = NODE(tw->t, off, trie_switch); const char *chars = (const char *)&sw->sw[sw->len]; if (tw->nswitches >= tw->switchsize) { tw->switchsize = tw->nswitches * 3 / 2 + 32; tw->switches = sresize(tw->switches, tw->switchsize, struct triewalk_switch); } tw->switches[tw->nswitches].sw = sw; tw->switches[tw->nswitches].pos = 1; tw->switches[tw->nswitches].depth = depth; tw->switches[tw->nswitches].count = tw->count + sw->sw[0].subcount; off = sw->sw[0].subnode; if (buf) buf[depth++] = chars[0]; tw->nswitches++; } } } void triewalk_free(triewalk *tw) { sfree(tw->switches); sfree(tw); } void trie_set_index_offset(void *t, off_t ptr) { ((struct trie_header *)t)->indexroot = ptr; } off_t trie_get_index_offset(const void *t) { return ((const struct trie_header *)t)->indexroot; } void make_successor(char *pathbuf) { int len = strlen(pathbuf); if (len > 0 && pathbuf[len-1] == pathsep) len--; pathbuf[len] = '\001'; pathbuf[len+1] = '\0'; } agedu-r9723/html.c0000644000175300017530000010117012163703774013113 0ustar simonsimon/* * html.c: implementation of html.h. */ #include "agedu.h" #include "html.h" #include "alloc.h" #include "trie.h" #include "index.h" #define MAXCOLOUR 511 struct html { char *buf; size_t buflen, bufsize; const void *t; unsigned long long totalsize, oldest, newest; char *path2; char *oururi; size_t hreflen; const char *uriformat; unsigned long long thresholds[MAXCOLOUR]; char *titletexts[MAXCOLOUR+1]; time_t now; }; static void vhtprintf(struct html *ctx, const char *fmt, va_list ap) { va_list ap2; int size, size2; char testbuf[2]; va_copy(ap2, ap); /* * Some C libraries (Solaris, I'm looking at you) don't like * an output buffer size of zero in vsnprintf, but will return * sensible values given any non-zero buffer size. Hence, we * use testbuf to gauge the length of the string. */ size = vsnprintf(testbuf, 1, fmt, ap2); va_end(ap2); if (ctx->buflen + size >= ctx->bufsize) { ctx->bufsize = (ctx->buflen + size) * 3 / 2 + 1024; ctx->buf = sresize(ctx->buf, ctx->bufsize, char); } size2 = vsnprintf(ctx->buf + ctx->buflen, ctx->bufsize - ctx->buflen, fmt, ap); assert(size == size2); ctx->buflen += size; } static void htprintf(struct html *ctx, const char *fmt, ...) { va_list ap; va_start(ap, fmt); vhtprintf(ctx, fmt, ap); va_end(ap); } static unsigned long long round_and_format_age(struct html *ctx, unsigned long long age, char *buf, int direction) { struct tm tm, tm2; char newbuf[80]; unsigned long long ret, newret; int i; int ym; static const int minutes[] = { 5, 10, 15, 30, 45 }; tm = *localtime(&ctx->now); ym = tm.tm_year * 12 + tm.tm_mon; ret = ctx->now; strcpy(buf, "Now"); for (i = 0; i < lenof(minutes); i++) { newret = ctx->now - minutes[i] * 60; sprintf(newbuf, "%d minutes", minutes[i]); if (newret < age) goto finish; strcpy(buf, newbuf); ret = newret; } for (i = 1; i < 24; i++) { newret = ctx->now - i * (60*60); sprintf(newbuf, "%d hour%s", i, i==1 ? "" : "s"); if (newret < age) goto finish; strcpy(buf, newbuf); ret = newret; } for (i = 1; i < 7; i++) { newret = ctx->now - i * (24*60*60); sprintf(newbuf, "%d day%s", i, i==1 ? "" : "s"); if (newret < age) goto finish; strcpy(buf, newbuf); ret = newret; } for (i = 1; i < 4; i++) { newret = ctx->now - i * (7*24*60*60); sprintf(newbuf, "%d week%s", i, i==1 ? "" : "s"); if (newret < age) goto finish; strcpy(buf, newbuf); ret = newret; } for (i = 1; i < 11; i++) { tm2 = tm; /* structure copy */ tm2.tm_year = (ym - i) / 12; tm2.tm_mon = (ym - i) % 12; newret = mktime(&tm2); sprintf(newbuf, "%d month%s", i, i==1 ? "" : "s"); if (newret < age) goto finish; strcpy(buf, newbuf); ret = newret; } for (i = 1;; i++) { tm2 = tm; /* structure copy */ tm2.tm_year = (ym - i*12) / 12; tm2.tm_mon = (ym - i*12) % 12; newret = mktime(&tm2); sprintf(newbuf, "%d year%s", i, i==1 ? "" : "s"); if (newret < age) goto finish; strcpy(buf, newbuf); ret = newret; } finish: if (direction > 0) { /* * Round toward newest, i.e. use the existing (buf,ret). */ } else if (direction < 0) { /* * Round toward oldest, i.e. use (newbuf,newret); */ strcpy(buf, newbuf); ret = newret; } else { /* * Round to nearest. */ if (ret - age > age - newret) { strcpy(buf, newbuf); ret = newret; } } return ret; } static void get_indices(const void *t, char *path, unsigned long *xi1, unsigned long *xi2) { size_t pathlen = strlen(path); int c1 = path[pathlen], c2 = (pathlen > 0 ? path[pathlen-1] : 0); *xi1 = trie_before(t, path); make_successor(path); *xi2 = trie_before(t, path); path[pathlen] = c1; if (pathlen > 0) path[pathlen-1] = c2; } static unsigned long long fetch_size(const void *t, unsigned long xi1, unsigned long xi2, unsigned long long atime) { if (xi2 - xi1 == 1) { /* * We are querying an individual file, so we should not * depend on the index entries either side of the node, * since they almost certainly don't both exist. Instead, * just look up the file's size and atime in the main trie. */ const struct trie_file *f = trie_getfile(t, xi1); if (f->atime < atime) return f->size; else return 0; } else { return index_query(t, xi2, atime) - index_query(t, xi1, atime); } } static void htescape(struct html *ctx, const char *s, int n, int italics) { while (n > 0 && *s) { unsigned char c = (unsigned char)*s++; if (c == '&') htprintf(ctx, "&"); else if (c == '<') htprintf(ctx, "<"); else if (c == '>') htprintf(ctx, ">"); else if (c >= ' ' && c < '\177') htprintf(ctx, "%c", c); else { if (italics) htprintf(ctx, ""); htprintf(ctx, "[%02x]", c); if (italics) htprintf(ctx, ""); } n--; } } static void begin_colour_bar(struct html *ctx) { htprintf(ctx, "\n\n"); } static void add_to_colour_bar(struct html *ctx, int colour, int pixels) { int r, g, b; if (colour >= 0 && colour < 256) /* red -> yellow fade */ r = 255, g = colour, b = 0; else if (colour >= 256 && colour <= 511) /* yellow -> green fade */ r = 511 - colour, g = 255, b = 0; else /* background grey */ r = g = b = 240; if (pixels > 0) { htprintf(ctx, "\n"); } } static void end_colour_bar(struct html *ctx) { htprintf(ctx, "\n
= 0) htprintf(ctx, " title=\"%s\"", ctx->titletexts[colour]); htprintf(ctx, ">
\n"); } struct vector { int want_href, essential; char *name; int literal; /* should the name be formatted in fixed-pitch? */ unsigned long index; unsigned long long sizes[MAXCOLOUR+1]; }; int vec_compare(const void *av, const void *bv) { const struct vector *a = *(const struct vector **)av; const struct vector *b = *(const struct vector **)bv; if (a->sizes[MAXCOLOUR] > b->sizes[MAXCOLOUR]) return -1; else if (a->sizes[MAXCOLOUR] < b->sizes[MAXCOLOUR]) return +1; else if (a->want_href < b->want_href) return +1; else if (a->want_href > b->want_href) return -1; else if (a->want_href) return strcmp(a->name, b->name); else if (a->index < b->index) return -1; else if (a->index > b->index) return +1; else if (a->essential < b->essential) return +1; else if (a->essential > b->essential) return -1; return 0; } static struct vector *make_vector(struct html *ctx, char *path, int want_href, int essential, char *name, int literal) { unsigned long xi1, xi2; struct vector *vec = snew(struct vector); int i; vec->want_href = want_href; vec->essential = essential; vec->name = name ? dupstr(name) : NULL; vec->literal = literal; get_indices(ctx->t, path, &xi1, &xi2); vec->index = xi1; for (i = 0; i <= MAXCOLOUR; i++) { unsigned long long atime; if (i == MAXCOLOUR) atime = ULLONG_MAX; else atime = ctx->thresholds[i]; vec->sizes[i] = fetch_size(ctx->t, xi1, xi2, atime); } return vec; } static void print_heading(struct html *ctx, const char *title) { htprintf(ctx, "\n" "%s\n\n", title); } static void compute_display_size(unsigned long long size, const char **fmt, double *display_size) { static const char *const fmts[] = { "%g b", "%g Kb", "%#.1f Mb", "%#.1f Gb", "%#.1f Tb", "%#.1f Pb", "%#.1f Eb", "%#.1f Zb", "%#.1f Yb" }; int shift = 0; unsigned long long tmpsize; double denominator; tmpsize = size; denominator = 1.0; while (tmpsize >= 1024 && shift < lenof(fmts)-1) { tmpsize >>= 10; denominator *= 1024.0; shift++; } *display_size = size / denominator; *fmt = fmts[shift]; } struct format_option { const char *prefix, *suffix; /* may include '%%' */ int prefixlen, suffixlen; /* does not count '%%' */ char fmttype; /* 0 for none, or 'n' or 'p' */ int translate_pathsep; /* pathsep rendered as '/'? */ int shorten_path; /* omit common prefix? */ }; /* * Gets the next format option from a format string. Advances '*fmt' * past it, or sets it to NULL if nothing is left. */ struct format_option get_format_option(const char **fmt) { struct format_option ret; /* * Scan for prefix of format. */ ret.prefix = *fmt; ret.prefixlen = 0; while (1) { if (**fmt == '\0') { /* * No formatting directive, and this is the last option. */ ret.suffix = *fmt; ret.suffixlen = 0; ret.fmttype = '\0'; *fmt = NULL; return ret; } else if (**fmt == '%') { if ((*fmt)[1] == '%') { (*fmt) += 2; /* just advance one extra */ ret.prefixlen++; } else if ((*fmt)[1] == '|') { /* * No formatting directive. */ ret.suffix = *fmt; ret.suffixlen = 0; ret.fmttype = '\0'; (*fmt) += 2; /* advance to start of next option */ return ret; } else { break; } } else { (*fmt)++; /* normal character */ ret.prefixlen++; } } /* * Interpret formatting directive with flags. */ (*fmt)++; ret.translate_pathsep = ret.shorten_path = 1; while (1) { char c = *(*fmt)++; assert(c); if (c == '/') { ret.translate_pathsep = 0; } else if (c == '-') { ret.shorten_path = 0; } else { assert(c == 'n' || c == 'p'); ret.fmttype = c; break; } } /* * Scan for suffix. */ ret.suffix = *fmt; ret.suffixlen = 0; while (1) { if (**fmt == '\0') { /* * This is the last option. */ *fmt = NULL; return ret; } else if (**fmt != '%') { (*fmt)++; /* normal character */ ret.suffixlen++; } else { if ((*fmt)[1] == '%') { (*fmt) += 2; /* just advance one extra */ ret.suffixlen++; } else { assert((*fmt)[1] == '|'); (*fmt) += 2; /* advance to start of next option */ return ret; } } } } char *format_string_inner(const char *fmt, int nescape, unsigned long index, const void *t) { int maxlen; char *ret = NULL, *p = NULL; char *path = NULL, *q = NULL; char pathsep = trie_pathsep(t); int maxpathlen = trie_maxpathlen(t); int charindex; while (fmt) { struct format_option opt = get_format_option(&fmt); if (index && !opt.fmttype) continue; /* option is only good for the root, which this isn't */ maxlen = opt.prefixlen + opt.suffixlen + 1; switch (opt.fmttype) { case 'n': maxlen += 40; /* generous length for an integer */ break; case 'p': maxlen += 3*maxpathlen; /* might have to escape everything */ break; } ret = snewn(maxlen, char); p = ret; while (opt.prefixlen-- > 0) { if ((*p++ = *opt.prefix++) == '%') opt.prefix++; } switch (opt.fmttype) { case 'n': p += sprintf(p, "%lu", index); break; case 'p': path = snewn(1+trie_maxpathlen(t), char); if (opt.shorten_path) { trie_getpath(t, 0, path); q = path + strlen(path); trie_getpath(t, index, path); if (*q == pathsep) q++; } else { trie_getpath(t, index, path); q = path; } charindex = 0; while (*q) { char c = *q++; if (c == pathsep && opt.translate_pathsep) { *p++ = '/'; charindex = 0; } else if (charindex < nescape || (!isalnum((unsigned char)c) && ((charindex == 0 && c=='.') || !strchr("-.@_", c)))) { p += sprintf(p, "=%02X", (unsigned char)c); charindex++; } else { *p++ = c; charindex++; } } sfree(path); break; } while (opt.suffixlen-- > 0) { if ((*p++ = *opt.suffix++) == '%') opt.suffix++; } *p = '\0'; assert(p - ret < maxlen); return ret; } assert(!"Getting here implies an incomplete set of formats"); } int parse_path(const void *t, const char *path, const char *fmt, unsigned long *index) { int len = strlen(path); int midlen; const char *p, *q; char *r; char pathsep = trie_pathsep(t); while (fmt) { struct format_option opt = get_format_option(&fmt); /* * Check prefix and suffix. */ midlen = len - opt.prefixlen - opt.suffixlen; if (midlen < 0) continue; /* prefix and suffix don't even fit */ p = path; while (opt.prefixlen > 0) { char c = *opt.prefix++; if (c == '%') opt.prefix++; if (*p != c) break; p++; opt.prefixlen--; } if (opt.prefixlen > 0) continue; /* prefix didn't match */ q = path + len - opt.suffixlen; while (opt.suffixlen > 0) { char c = *opt.suffix++; if (c == '%') opt.suffix++; if (*q != c) break; q++; opt.suffixlen--; } if (opt.suffixlen > 0) continue; /* suffix didn't match */ /* * Check the data in between. p points at it, and it's midlen * characters long. */ if (opt.fmttype == '\0') { if (midlen == 0) { /* * Successful match against a root format. */ *index = 0; return 1; } } else if (opt.fmttype == 'n') { *index = 0; while (midlen > 0) { if (*p >= '0' && *p <= '9') *index = *index * 10 + (*p - '0'); else break; midlen--; p++; } if (midlen == 0) { /* * Successful match against a numeric format. */ return 1; } } else { assert(opt.fmttype == 'p'); int maxoutlen = trie_maxpathlen(t) + 1; int maxinlen = midlen + 1; char triepath[maxinlen+maxoutlen]; if (opt.shorten_path) { trie_getpath(t, 0, triepath); r = triepath + strlen(triepath); if (r > triepath && r[-1] != pathsep) *r++ = pathsep; } else { r = triepath; } while (midlen > 0) { if (*p == '/' && opt.translate_pathsep) { *r++ = pathsep; p++; midlen--; } else if (*p == '=') { /* * We intentionally do not check whether the * escaped character _should_ have been escaped * according to the rules in html_format_path. * * All clients of this parsing function, after a * successful parse, call html_format_path to find * the canonical URI for the same index and return * an HTTP redirect if the provided URI was not * exactly equal to that canonical form. This is * critical when the correction involves adding or * removing a trailing slash (because then * relative hrefs on the generated page can be * computed with respect to the canonical URI * instead of having to remember what the actual * URI was), but also has the useful effect that * if a user attempts to type in (guess) a URI by * hand they don't have to remember the escaping * rules - as long as they type _something_ that * this code can parse into a recognisable * pathname, it will be automatically 301ed into * the canonical form. */ if (midlen < 3 || !isxdigit((unsigned char)p[1]) || !isxdigit((unsigned char)p[2])) break; /* faulty escape encoding */ char x[3]; unsigned cval; x[0] = p[1]; x[1] = p[2]; x[2] = '\0'; sscanf(x, "%x", &cval); *r++ = cval; p += 3; midlen -= 3; } else { *r++ = *p; p++; midlen--; } } if (midlen > 0) continue; /* something went wrong in that loop */ assert(r - triepath < maxinlen+maxoutlen); *r = '\0'; unsigned long gotidx = trie_before(t, triepath); if (gotidx >= trie_count(t)) continue; /* index out of range */ char retpath[1+maxoutlen]; trie_getpath(t, gotidx, retpath); if (strcmp(triepath, retpath)) continue; /* exact path not found in trie */ if (!index_has_root(t, gotidx)) continue; /* path is not a directory */ /* * Successful path-based match. */ *index = gotidx; return 1; } } return 0; /* no match from any format option */ } char *format_string(const char *fmt, unsigned long index, const void *t) { unsigned long indexout, parseret; char *ret; const char *stepfmt = fmt; int nescape = 0; /* * Format the string using whichever format option first works. */ ret = format_string_inner(fmt, 0, index, t); /* * Now re-_parse_ the string, to see if it gives the same index * back. It might not, if a pathname is valid in two formats: for * instance, if you use '-H -d max' to generate a static HTML dump * from scanning a directory which has a subdir called 'index', * you might well find that the top-level file wants to be called * index.html and so does the one for that subdir. * * We fix this by formatting the string again with more and more * characters escaped, so that the non-root 'index.html' becomes * (e.g.) '=69ndex.html', or '=69=6edex.html' if that doesn't * work, etc. */ while (1) { struct format_option opt = get_format_option(&stepfmt); /* * Parse the pathname and see if it gives the right index. */ int parseret = parse_path(t, ret, fmt, &indexout); assert(parseret != 0); if (indexout == index) break; /* path now parses successfully */ /* * If not, try formatting it again. */ char *new = format_string_inner(fmt, ++nescape, index, t); assert(strcmp(new, ret)); /* if nescape gets too big, give up */ sfree(ret); ret = new; } return ret; } char *html_format_path(const void *t, const struct html_config *cfg, unsigned long index) { return format_string(cfg->uriformat, index, t); } int html_parse_path(const void *t, const char *path, const struct html_config *cfg, unsigned long *index) { return parse_path(t, path, cfg->uriformat, index); } char *make_href(const char *source, const char *target) { /* * We insist that both source and target URIs start with a /, or * else we won't be reliably able to construct relative hrefs * between them (e.g. because we've got a suffix on the end of * some CGI pathname that this function doesn't know the final * component of). */ assert(*source == '/'); assert(*target == '/'); /* * Find the last / in source. Everything up to but not including * that is the directory to which the output href will be * relative. We enforce by assertion that there must be a / * somewhere in source, or else we can't construct a relative href * at all */ const char *sourceend = strrchr(source, '/'); assert(sourceend != NULL); /* * See how far the target URI agrees with the source one, up to * and including that /. */ const char *s = source, *t = target; while (s <= sourceend && *s == *t) s++, t++; /* * We're only interested in agreement of complete path components, * so back off until we're sitting just after a shared /. */ while (s > source && s[-1] != '/') s--, t--; assert(s > source); /* * Now we need some number of levels of "../" to get from source * to here, and then we just replicate the rest of 'target'. */ int levels = 0; while (s <= sourceend) { if (*s == '/') levels++; s++; } int len = 3*levels + strlen(t); if (len == 0) { /* One last special case: if target has no tail _and_ we * haven't written out any "../". */ return dupstr("./"); } else { char *ret = snewn(len+1, char); char *p = ret; while (levels-- > 0) { *p++ = '.'; *p++ = '.'; *p++ = '/'; } strcpy(p, t); return ret; } } #define PIXEL_SIZE 600 /* FIXME: configurability? */ static void write_report_line(struct html *ctx, struct vector *vec) { unsigned long long size, asize, divisor; double display_size; int pix, newpix; int i; const char *unitsfmt; /* * A line with literally zero space usage should not be * printed at all if it's a link to a subdirectory (since it * probably means the whole thing was excluded by some * --exclude-path wildcard). If it's [files] or the top-level * line, though, we must always print _something_, and in that * case we must fiddle about to prevent divisions by zero in * the code below. */ if (!vec->sizes[MAXCOLOUR] && !vec->essential) return; divisor = ctx->totalsize; if (!divisor) { divisor = 1; } /* * Find the total size of this subdirectory. */ size = vec->sizes[MAXCOLOUR]; compute_display_size(size, &unitsfmt, &display_size); htprintf(ctx, "\n" ""); htprintf(ctx, unitsfmt, display_size); htprintf(ctx, "\n"); /* * Generate a colour bar. */ htprintf(ctx, "\n"); begin_colour_bar(ctx); pix = 0; for (i = 0; i <= MAXCOLOUR; i++) { asize = vec->sizes[i]; newpix = asize * PIXEL_SIZE / divisor; add_to_colour_bar(ctx, i, newpix - pix); pix = newpix; } add_to_colour_bar(ctx, -1, PIXEL_SIZE - pix); end_colour_bar(ctx); htprintf(ctx, "\n"); /* * Output size as a percentage of totalsize. */ htprintf(ctx, "" "%.2f%%\n", (double)size / divisor * 100.0); /* * Output a subdirectory marker. */ htprintf(ctx, ""); if (vec->name) { int doing_href = 0; if (ctx->uriformat && vec->want_href) { char *targeturi = format_string(ctx->uriformat, vec->index, ctx->t); char *link = make_href(ctx->oururi, targeturi); htprintf(ctx, "", link); sfree(link); sfree(targeturi); doing_href = 1; } if (vec->literal) htprintf(ctx, ""); htescape(ctx, vec->name, strlen(vec->name), 1); if (vec->literal) htprintf(ctx, ""); if (doing_href) htprintf(ctx, ""); } htprintf(ctx, "\n\n"); } int strcmptrailingpathsep(const char *a, const char *b) { while (*a == *b && *a) a++, b++; if ((*a == pathsep && !a[1] && !*b) || (*b == pathsep && !b[1] && !*a)) return 0; return (int)(unsigned char)*a - (int)(unsigned char)*b; } char *html_query(const void *t, unsigned long index, const struct html_config *cfg, int downlink) { struct html actx, *ctx = &actx; char *path, *path2, *p, *q; char agebuf1[80], agebuf2[80]; size_t pathlen, subdirpos; unsigned long index2; int i; struct vector **vecs; int nvecs, vecsize; unsigned long xi1, xi2, xj1, xj2; if (index >= trie_count(t)) return NULL; ctx->buf = NULL; ctx->buflen = ctx->bufsize = 0; ctx->t = t; ctx->uriformat = cfg->uriformat; htprintf(ctx, "\n"); path = snewn(1+trie_maxpathlen(t), char); ctx->path2 = path2 = snewn(1+trie_maxpathlen(t), char); if (cfg->uriformat) ctx->oururi = format_string(cfg->uriformat, index, t); else ctx->oururi = NULL; /* * HEAD section. */ htprintf(ctx, "\n"); trie_getpath(t, index, path); htprintf(ctx, ""); htescape(ctx, cfg->html_title, strlen(cfg->html_title), 0); htprintf(ctx, ": "); htescape(ctx, path, strlen(path), 0); htprintf(ctx, "\n"); htprintf(ctx, "\n"); /* * Begin BODY section. */ htprintf(ctx, "\n"); htprintf(ctx, "

Disk space breakdown by" " last-access time

\n"); /* * Show the pathname we're centred on, with hyperlinks to * parent directories where available. */ htprintf(ctx, "

\n"); q = path; for (p = strchr(path, pathsep); p && p[1]; p = strchr(p, pathsep)) { int doing_href = 0; char c, *zp; /* * See if this path prefix exists in the trie. If so, * generate a hyperlink. */ zp = p; if (p == path) /* special case for "/" at start */ zp++; p++; c = *zp; *zp = '\0'; index2 = trie_before(t, path); trie_getpath(t, index2, path2); if (!strcmptrailingpathsep(path, path2) && cfg->uriformat) { char *targeturi = format_string(cfg->uriformat, index2, t); char *link = make_href(ctx->oururi, targeturi); htprintf(ctx, "", link); sfree(link); sfree(targeturi); doing_href = 1; } *zp = c; htescape(ctx, q, zp - q, 1); if (doing_href) htprintf(ctx, ""); htescape(ctx, zp, p - zp, 1); q = p; } htescape(ctx, q, strlen(q), 1); htprintf(ctx, "\n"); /* * Decide on the age limit of our colour coding, establish the * colour thresholds, and write out a key. */ ctx->now = time(NULL); if (cfg->autoage) { ctx->oldest = index_order_stat(t, 0.05); ctx->newest = index_order_stat(t, 1.0); ctx->oldest = round_and_format_age(ctx, ctx->oldest, agebuf1, -1); ctx->newest = round_and_format_age(ctx, ctx->newest, agebuf2, +1); } else { ctx->oldest = cfg->oldest; ctx->newest = cfg->newest; ctx->oldest = round_and_format_age(ctx, ctx->oldest, agebuf1, 0); ctx->newest = round_and_format_age(ctx, ctx->newest, agebuf2, 0); } for (i = 0; i < MAXCOLOUR; i++) { ctx->thresholds[i] = ctx->oldest + (ctx->newest - ctx->oldest) * i / (MAXCOLOUR-1); } for (i = 0; i <= MAXCOLOUR; i++) { char buf[80]; if (i == 0) { strcpy(buf, "> "); round_and_format_age(ctx, ctx->thresholds[0], buf+5, 0); } else if (i == MAXCOLOUR) { strcpy(buf, "< "); round_and_format_age(ctx, ctx->thresholds[MAXCOLOUR-1], buf+5, 0); } else { unsigned long long midrange = (ctx->thresholds[i-1] + ctx->thresholds[i]) / 2; round_and_format_age(ctx, midrange, buf, 0); } ctx->titletexts[i] = dupstr(buf); } htprintf(ctx, "

Key to colour coding (mouse over for more detail):\n"); htprintf(ctx, "

"); begin_colour_bar(ctx); htprintf(ctx, "%s\n", agebuf1); for (i = 0; i < MAXCOLOUR; i++) add_to_colour_bar(ctx, i, 1); htprintf(ctx, "%s\n", agebuf2); end_colour_bar(ctx); /* * Begin the main table. */ htprintf(ctx, "

\n\n"); /* * Find the total size of our entire subdirectory. We'll use * that as the scale for all the colour bars in this report. */ get_indices(t, path, &xi1, &xi2); ctx->totalsize = fetch_size(t, xi1, xi2, ULLONG_MAX); /* * Generate a report line for the whole subdirectory. */ vecsize = 64; vecs = snewn(vecsize, struct vector *); nvecs = 1; vecs[0] = make_vector(ctx, path, 0, 1, NULL, 0); print_heading(ctx, "Overall"); write_report_line(ctx, vecs[0]); /* * Now generate report lines for all its children, and the * files contained in it. */ print_heading(ctx, "Subdirectories"); vecs[0]->name = dupstr("[files]"); get_indices(t, path, &xi1, &xi2); xi1++; pathlen = strlen(path); subdirpos = pathlen + 1; if (pathlen > 0 && path[pathlen-1] == pathsep) subdirpos--; while (xi1 < xi2) { trie_getpath(t, xi1, path2); get_indices(t, ctx->path2, &xj1, &xj2); xi1 = xj2; if (!cfg->showfiles && xj2 - xj1 <= 1) continue; /* skip individual files */ if (nvecs >= vecsize) { vecsize = nvecs * 3 / 2 + 64; vecs = sresize(vecs, vecsize, struct vector *); } assert(strlen(path2) > pathlen); vecs[nvecs] = make_vector(ctx, path2, downlink && (xj2 - xj1 > 1), 0, path2 + subdirpos, 1); for (i = 0; i <= MAXCOLOUR; i++) vecs[0]->sizes[i] -= vecs[nvecs]->sizes[i]; nvecs++; } qsort(vecs, nvecs, sizeof(vecs[0]), vec_compare); for (i = 0; i < nvecs; i++) write_report_line(ctx, vecs[i]); /* * Close the main table. */ htprintf(ctx, "
\n"); /* * Finish up and tidy up. */ htprintf(ctx, "\n"); htprintf(ctx, "\n"); sfree(ctx->oururi); sfree(path2); sfree(path); for (i = 0; i < nvecs; i++) { sfree(vecs[i]->name); sfree(vecs[i]); } sfree(vecs); return ctx->buf; } int html_dump(const void *t, unsigned long index, unsigned long endindex, int maxdepth, const struct html_config *cfg, const char *pathprefix) { /* * Determine the filename for this file. */ assert(cfg->fileformat != NULL); char *filename = format_string(cfg->fileformat, index, t); char *path = dupfmt("%s%s", pathprefix, filename); sfree(filename); /* * Create the HTML itself. Don't write out downlinks from our * deepest level. */ char *html = html_query(t, index, cfg, maxdepth != 0); /* * Write it out. */ FILE *fp = fopen(path, "w"); if (!fp) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, path, strerror(errno)); return 1; } if (fputs(html, fp) < 0) { fprintf(stderr, "%s: %s: write: %s\n", PNAME, path, strerror(errno)); fclose(fp); return 1; } if (fclose(fp) < 0) { fprintf(stderr, "%s: %s: fclose: %s\n", PNAME, path, strerror(errno)); return 1; } sfree(path); /* * Recurse. */ if (maxdepth != 0) { unsigned long subindex, subendindex; int newdepth = (maxdepth > 0 ? maxdepth - 1 : maxdepth); char rpath[1+trie_maxpathlen(t)]; index++; while (index < endindex) { trie_getpath(t, index, rpath); get_indices(t, rpath, &subindex, &subendindex); index = subendindex; if (subendindex - subindex > 1) { if (html_dump(t, subindex, subendindex, newdepth, cfg, pathprefix)) return 1; } } } return 0; } agedu-r9723/tree.but0000644000175300017530000003127712163703774013470 0ustar simonsimon\cfg{html-chapter-numeric}{true} \cfg{html-chapter-suffix}{. } \cfg{chapter}{Section} \define{dash} \u2013{-} \title A tree structure for log-time quadrant counting This article describes a general form of data structure which permits the storing of two-dimensional data in such a way that a log-time lookup can reliably return the total \e{amount} of data in an arbitrary quadrant (i.e. a region both upward and leftward of a user-specified point). The program \W{http://www.chiark.greenend.org.uk/~sgtatham/agedu/}\cw{agedu}, which uses a data structure of this type for its on-disk index files, is used as a case study. \C{problem} The problem The basic problem can be stated as follows: you have a collection of \cw{N} points, each specified as an \cw{(x,y)} coordinate pair, and you want to be able to efficiently answer questions of the general form \q{How many points have both \cw{x\_<\_x0} and \cw{y\_<\_y0}?}, for arbitrary \cw{(x0,y0)}. A slightly enhanced form of the problem, which is no more difficult to solve, allows each point to have a \e{weight} as well as coordinates; now the question to be answered is \q{What is the \e{total weight} of the points with both \cw{x\_<\_x0} and \cw{y\_<\_y0}?}. The previous version of the question, of course, is a special case of this in which all weights are set to 1. The data structure presented in this article answers any question of this type in time \cw{O(log N)}. \C{onedim} The one-dimensional case To begin with, we address the one-dimensional analogue of the problem. If we have a set of points which each have an \cw{x}-coordinate and a weight, how do we represent them so as to be able to find the total weight of all points with \cw{x\_<\_x0}? An obvious solution is to sort the points into order of their \cw{x}-coordinate, and alongside each point to list the total weight of everything up to and including that point. Then, given any \cw{x0}, a log-time binary search will find the last point in the list with \cw{x\_<\_x0}, and we can immediately read off the cumulative weight figure. Now let's be more ambitious. What if the set of points were constantly changing \dash new points arriving, old points going away \dash and we wanted a data structure which would cope efficiently with dynamic updates while maintaining the ability to answer these count queries? An efficient solution begins by storing the points in a balanced tree, sorted by their \cw{x}-coordinates. Any of the usual types \dash AVL tree, red-black tree, the various forms of B-tree \dash will suffice. We then annotate every node of the tree with an extra field giving the total weight of the points in and below that node. These annotations can be maintained through updates to the tree, without sacrificing the \cw{O(log N)} time bound on insertions or deletions. So we can start with an empty tree and insert a complete set of points, or we can insert and delete points in arbitrary order, and the tree annotations will remain valid at all times. A balanced tree sorted by \cw{x} can easily be searched to find the last point with \cw{x\_<\_x0}, for any \cw{x0}. If the tree has total-weight annotations as described above, we can arrange that this search calculates the total weight of all points with \cw{x\_<\_x0}: every time we examine a tree node and decide which subtree of it to descend to, we look at the top node of each subtree to the left of that one, and add their weight annotations to a running total. When we reach a leaf node and find our chosen subtree is \cw{NULL}, the running total is the required answer. So this data structure allows us to maintain a changing set of points in such a way that we can do an efficient one-dimensional count query at any time. \C{incremental} An incremental approach Now we'll use the above one-dimensional structure to answer a restricted form of the original 2-D problem. Suppose we have some large set of \cw{(x0,y0)} pairs for which we want to answer counted-quadrant queries, and suppose (for the moment) that we have \e{all of the queries presented in advance}. Is there any way we can do that efficiently? There is. We sort our points by their \cw{y}-coordinate, and then go through them in that order adding them one by one to a balanced tree sorted by \cw{x} as described above. So for any query coordinates \cw{(x0,y0)}, there must be some moment during that process at which we have added to our tree precisely those points with \cw{y\_<\_y0}. At that moment, we could search the tree to find the total weight of everything it contained with \cw{x\_<\_x0}, and that would be the answer to our two-dimensional query. Hence, if we also sorted our queries into order by \cw{y0}, we could progress through the list of queries in parallel with the list of points (much like merging two sorted lists), answering each query at the moment when the tree contained just the right set of points to make it easy. \C{cow} Copy-on-write In real life, of course, we typically don't receive all our queries in a big batch up front. We want to construct a data structure capable of answering \e{any} query efficiently, and then be able to deal with queries as they arise. A data structure capable of this, it turns out, is only a small step away from the one described in the previous section. The small step is \e{copy-on-write}. As described in the previous section, we go through our list of points in order of their \cw{y}-coordinate, and we add each one in turn to a balanced tree sorted by \cw{x} with total-weight annotations. The catch is that, this time, we never \e{modify} any node in the tree: whenever the process of inserting an element into a tree wants to modify a node, we instead make a \e{copy} of that node containing the modified data. The parent of that node must now be modified (even if it would previously not have needed modification) so that it points at the copied node instead of the original \dash so we do the same thing there, and copy that one too, and so on up to the root. So after we have done a single insertion by this method, we end up with a new tree root which describes the new tree \dash but the old tree root, describing the tree before the insertion, is still valid, because every node reachable from the old root is unchanged. Therefore, if we start with an empty tree and repeatedly do this, we will end up with a distinct tree root for each point in the process, and \e{all of them will be valid at once}. It's as if we had done the incremental tree construction in the previous section, but could rewind time to any point in the process. So now all we have to do is make a list of those tree roots, with their associated \cw{y}-coordinates. Any way of doing this will do \dash another balanced tree, or a simple sorted list to be binary-searched, or something more exotic, whatever is convenient. Then we can answer an arbitrary quadrant query using only a pair of log-time searches: given a query coordinate pair \cw{(x0,y0)}, we look through our list of tree roots to find the one describing precisely the set of points with \cw{y\_<\_y0}, and then do a one-dimensional count query into that tree for the total weight of points with \cw{x\_<\_x0}. Done! The nice thing about all of this is that \e{nearly all} the nodes in each tree are shared with the next one. Consider: since the operation of adding an element to a balanced tree takes \cw{O(log N)} time, it must modify at most \cw{O(log N)} nodes. Each of these node-copying insertion processes must copy all of those nodes, but need not copy any others \dash so it creates at most \cw{O(log N)} new nodes. Hence, the total storage used by the combined set of trees is \cw{O(N log N)}, much smaller than the \cw{O(N^2 log N)} you'd expect if the trees were all separate or even mostly separate. \C{limitations} Limitations The one-dimensional data structure described at the start of this article is dynamically updatable: if the set of points to be searched changes, the structure can be modified efficiently without losing its searching properties. The two-dimensional structure we ended up with is not: if a single point changes its coordinates or weight, or appears, or disappears, then the whole structure must be rebuilt. Since the technique I used to add an extra dimension is critically dependent on the dynamic updatability of the one-dimensional base structure, but the resulting structure is not dynamically updatable in turn, it follows that this technique cannot be applied twice: no analogous transformation will construct a \e{three}-dimensional structure capable of counting the total weight of an octant \cw{\{x\_<\_x0, y\_<\_y0, z\_<\_z0\}}. I know of no efficient way to do that. The structure as described above uses \cw{O(N log N)} storage. Many algorithms using \cw{O(N log N)} time are considered efficient (e.g. sorting), but space is generally more expensive than time, and \cw{O(N log N)} space is larger than you think! \C{application} An application: \cw{agedu} The application for which I developed this data structure is \W{http://www.chiark.greenend.org.uk/~sgtatham/agedu/}\cw{agedu}, a program which scans a file system and indexes pathnames against last-access times (\q{atimes}, in Unix terminology) so as to be able to point out directories which take up a lot of disk space but whose contents have not been accessed in years (making them strong candidates for tidying up or archiving to save space). So the fundamental searching primitive we want for \cw{agedu} is \q{What is the total size of the files contained within some directory path \cw{Ptop} which have atime at most \cw{T0}?} We begin by sorting the files into order by their full pathname. This brings every subdirectory, at every level, together into a contiguous sequence of files. So now our query primitive becomes \q{What is the total size of files whose pathname falls between \cw{P0} and \cw{P1}, and whose atime is at most \cw{T0}?} Clearly, we can simplify this to the same type of quadrant query as discussed above, by splitting this into two subqueries: the total size of files with \cw{P0\_<=\_P\_<\_P1} and \cw{T\_<\_T0} is clearly the total size of files with \cw{P\_<\_P1, T\_<\_T0} minus the total size of files with \cw{P\_<\_P0, T\_<\_T0}. Each of those subqueries is of precisely the type we have just derived a data structure to answer. So we want to sort our files by two \q{coordinates}: one is atime, and the other is pathname (sorted in ASCII collation order). So which should be \cw{x} and which \cw{y}, in the above notation? Well, either way round would work in principle, but two criteria inform the decision. Firstly, \cw{agedu} typically wants to do many queries on the same pathname for different atimes, so as to build up a detailed profile of size against atime for a given subdirectory. So it makes sense to have the first-level lookup (on \cw{y}, to find a tree root) be done on pathname, and the secondary lookup (on \cw{x}, within that tree) be done on atime; then we can cache the tree root found in the first lookup, and use it many times without wasting time repeating the pathname search. Another important point for \cw{agedu} is that not all tree roots are actually used: the only pathnames ever submitted to a quadrant search are those at the start or the end of a particular subdirectory. This allows us to save a lot of disk space by limiting the copy-on-write behaviour: instead of \e{never} modifying an existing tree node, we now rule that we may modify a tree node \e{if it has already been modified once since the last tree root we saved}. In real-world cases, this cuts down the total space usage by about a factor of five, so it's well worthwhile \dash and we wouldn't be able to do it if we'd used atime as the \cw{y}-coordinate instead of pathname. Since the \q{\cw{y}-coordinates} in \cw{agedu} are strings, the top-level lookup to find a tree root is most efficiently done using neither a balanced tree nor a sorted list, but a trie: tries allow lookup of a string in time proportional to the length of the string, whereas either of the other approaches would require \cw{O(log N)} compare operations \e{each} of which could take time proportional to the length of the string. Finally, the two-dimensions limitation on the above data structure unfortunately imposes limitations on what \cw{agedu} can do. One would like to run a single \cw{agedu} as a system-wide job on a file server (perhaps nightly or weekly), and present the results to all users in such a way that each user's view of the data was filtered to only what their access permissions permitted them to see. Sadly, to do this would require a third dimension in the data structure (representing ownership or access control, in some fashion), and hence cannot be done efficiently. \cw{agedu} is therefore instead most sensibly used on demand by an individual user, so that it generates a custom data set for that user every time. agedu-r9723/index.c0000644000175300017530000002250412163703774013261 0ustar simonsimon/* * index.c: Implementation of index.h. */ #include "agedu.h" #include "trie.h" #include "index.h" #include "alloc.h" #define alignof(typ) ( offsetof(struct { char c; typ t; }, t) ) #define PADDING(x, mod) ( ((mod) - ((x) % (mod))) % (mod) ) struct avlnode { off_t children[2], element; int maxdepth; /* maximum depth of this subtree */ unsigned long long totalsize; }; /* * Determine the maximum depth of an AVL tree containing a certain * number of nodes. */ static int index_maxdepth(int nodecount) { int b, c, maxdepth; /* * Model the tree growing at maximum imbalance. We do this by * determining the number of nodes in the most unbalanced * (i.e. smallest) tree of any given depth, and stopping when * that's larger than nodecount. */ maxdepth = 1; b = 0; c = 1; while (b <= nodecount) { int tmp; tmp = 1 + b + c; b = c; c = tmp; maxdepth++; } return maxdepth; } off_t index_initial_size(off_t currentsize, int nodecount) { currentsize += PADDING(currentsize, alignof(off_t)); currentsize += nodecount * sizeof(off_t); currentsize += PADDING(currentsize, alignof(struct avlnode)); return currentsize; } /* ---------------------------------------------------------------------- * Functions to build the index. */ struct indexbuild { void *t; int n, nnodes; struct avlnode *nodes; off_t *roots; struct avlnode *currroot; struct avlnode *firstmutable; }; #define ELEMENT(t,offset) \ ((struct trie_file *) ((offset) ? ((char *)(t) + (offset)) : NULL)) #define NODE(t,offset) \ ((struct avlnode *) ((offset) ? ((char *)(t) + (offset)) : NULL)) #define OFFSET(t,node) \ ((node) ? (off_t)((const char *)node - (const char *)t) : (off_t)0) #define MAXDEPTH(node) ((node) ? (node)->maxdepth : 0) indexbuild *indexbuild_new(void *t, off_t startoff, int nodecount, size_t *delta) { indexbuild *ib = snew(indexbuild); ib->t = t; startoff += PADDING(startoff, alignof(off_t)); ib->roots = (off_t *)((char *)t + startoff); trie_set_index_offset(t, startoff); startoff += nodecount * sizeof(off_t); startoff += PADDING(startoff, alignof(struct avlnode)); ib->nodes = (struct avlnode *)((char *)t + startoff); ib->nnodes = ib->n = 0; ib->currroot = NULL; ib->firstmutable = ib->nodes + ib->nnodes; if (delta) *delta = sizeof(struct avlnode) * (1 + index_maxdepth(nodecount)); return ib; } /* * Return a mutable node, which is n or a copy of n if n is * non-NULL. */ static struct avlnode *avl_makemutable(indexbuild *ib, struct avlnode *n) { struct avlnode *newnode; if (n && n >= ib->firstmutable) return n; /* already mutable */ newnode = ib->nodes + ib->nnodes++; if (n) *newnode = *n; /* structure copy */ return newnode; } /* * Fix the annotations in a tree node. */ static void avl_fix(indexbuild *ib, struct avlnode *n) { /* * Make sure the max depth field is right. */ n->maxdepth = 1 + max(MAXDEPTH(NODE(ib->t, n->children[0])), MAXDEPTH(NODE(ib->t, n->children[1]))); n->totalsize = (ELEMENT(ib->t, n->element)->size + (n->children[0] ? NODE(ib->t, n->children[0])->totalsize : 0) + (n->children[1] ? NODE(ib->t, n->children[1])->totalsize : 0)); } static struct avlnode *avl_insert(indexbuild *ib, struct avlnode *n, off_t node) { struct trie_file *newfile; struct trie_file *oldfile; int subtree; struct avlnode *nn; /* * Recursion bottoming out: if the subtree we're inserting * into is null, just construct and return a fresh node. */ if (!n) { n = avl_makemutable(ib, NULL); n->children[0] = n->children[1] = 0; n->element = node; avl_fix(ib, n); return n; } /* * Otherwise, we have to insert into an existing tree. */ /* * Determine which subtree to insert this node into. Ties * aren't important, so we just break them any old way. */ newfile = (struct trie_file *)((char *)ib->t + node); oldfile = (struct trie_file *)((char *)ib->t + n->element); if (newfile->atime > oldfile->atime) subtree = 1; else subtree = 0; /* * Construct a copy of the node we're looking at. */ n = avl_makemutable(ib, n); /* * Recursively insert into the next subtree down. */ nn = avl_insert(ib, NODE(ib->t, n->children[subtree]), node); n->children[subtree] = OFFSET(ib->t, nn); /* * Rebalance if necessary, to ensure that our node's children * differ in maximum depth by at most one. Of course, the * subtree we've just modified will be the deeper one if so. */ if (MAXDEPTH(NODE(ib->t, n->children[subtree])) > MAXDEPTH(NODE(ib->t, n->children[1-subtree])) + 1) { struct avlnode *p, *q; /* * There are two possible cases, one of which requires a * single tree rotation and the other requires two. It all * depends on which subtree of the next node down (here p) * is the taller. (It turns out that they can't both be * the same height: any tree which has just increased in * depth must have one subtree strictly taller than the * other.) */ p = NODE(ib->t, n->children[subtree]); assert(p >= ib->firstmutable); if (MAXDEPTH(NODE(ib->t, p->children[subtree])) >= MAXDEPTH(NODE(ib->t, p->children[1-subtree]))) { /* * n p * / \ / \ * [k] p -> n [k+1] * / \ / \ * [k] [k+1] [k] [k] */ n->children[subtree] = p->children[1-subtree]; p->children[1-subtree] = OFFSET(ib->t, n); avl_fix(ib, n); n = p; } else { q = NODE(ib->t, p->children[1-subtree]); assert(q >= ib->firstmutable); p->children[1-subtree] = OFFSET(ib->t, q); /* * n n q * / \ / \ / \ * [k] p == [k] p -> n p * / \ / \ / \ / \ * [k+1] [k] q [k] [k] \ / [k] * / \ [k-1,k] [k-1,k] * [k-1,k] [k-1,k] */ n->children[subtree] = q->children[1-subtree]; p->children[1-subtree] = q->children[subtree]; q->children[1-subtree] = OFFSET(ib->t, n); q->children[subtree] = OFFSET(ib->t, p); avl_fix(ib, n); avl_fix(ib, p); n = q; } } /* * Fix up our maximum depth field. */ avl_fix(ib, n); /* * Done. */ return n; } void indexbuild_add(indexbuild *ib, const struct trie_file *tf) { off_t node = OFFSET(ib->t, tf); ib->currroot = avl_insert(ib, ib->currroot, node); ib->roots[ib->n++] = 0; } void indexbuild_tag(indexbuild *ib) { if (ib->n > 0) ib->roots[ib->n - 1] = OFFSET(ib->t, ib->currroot); ib->firstmutable = ib->nodes + ib->nnodes; } void indexbuild_rebase(indexbuild *ib, void *t) { ptrdiff_t diff = (unsigned char *)t - (unsigned char *)(ib->t); ib->t = t; ib->nodes = (struct avlnode *)((unsigned char *)ib->nodes + diff); ib->roots = (off_t *)((unsigned char *)ib->roots + diff); if (ib->currroot) ib->currroot = (struct avlnode *) ((unsigned char *)ib->currroot + diff); ib->firstmutable = (struct avlnode *)((unsigned char *)ib->firstmutable + diff); } off_t indexbuild_realsize(indexbuild *ib) { return OFFSET(ib->t, (ib->nodes + ib->nnodes)); } void indexbuild_free(indexbuild *ib) { assert(ib->n == trie_count(ib->t)); sfree(ib); } int index_has_root(const void *t, int n) { const off_t *roots; roots = (const off_t *)((const char *)t + trie_get_index_offset(t)); if (n == 0) return 1; if (n < 0 || n >= trie_count(t) || !roots[n-1]) return 0; return 1; } unsigned long long index_query(const void *t, int n, unsigned long long at) { const off_t *roots; const struct avlnode *node; unsigned long count; unsigned long long ret; roots = (const off_t *)((const char *)t + trie_get_index_offset(t)); if (n < 1) return 0; count = trie_count(t); if (n > count) n = count; assert(roots[n-1]); node = NODE(t, roots[n-1]); ret = 0; while (node) { const struct trie_file *tf = ELEMENT(t, node->element); const struct avlnode *left = NODE(t, node->children[0]); const struct avlnode *right = NODE(t, node->children[1]); if (at <= tf->atime) { node = left; } else { if (left) ret += left->totalsize; ret += tf->size; node = right; } } return ret; } unsigned long long index_order_stat(const void *t, double f) { const off_t *roots; const struct avlnode *node; unsigned long count; unsigned long long size; roots = (const off_t *)((const char *)t + trie_get_index_offset(t)); count = trie_count(t); assert(roots[count-1]); node = NODE(t, roots[count-1]); size = node->totalsize * f; assert(size <= node->totalsize); while (1) { const struct trie_file *tf = ELEMENT(t, node->element); const struct avlnode *left = NODE(t, node->children[0]); const struct avlnode *right = NODE(t, node->children[1]); if (left && size < left->totalsize) { node = left; } else if (!right || size < (left ? left->totalsize : 0) + tf->size) { return tf->atime; } else { if (left) size -= left->totalsize; size -= tf->size; node = right; } } } agedu-r9723/trie.h0000644000175300017530000001141312163703774013117 0ustar simonsimon/* * trie.h: functions to build and search a trie-like structure * mapping pathnames to file records. */ #include /* * An entry in the trie file describing an actual file. */ struct trie_file { unsigned long long size; unsigned long long atime; }; /* ---------------------------------------------------------------------- * Functions which can be passed a list of pathnames and file data * in strict order, and will build up a trie and write it out to a * file. */ typedef struct triebuild triebuild; /* * Create a new trie-building context given a writable file * descriptor, which should point to the start of an empty file. */ triebuild *triebuild_new(int fd); /* * Add a trie_file record to the trie. The pathnames should appear * in trie collation order (i.e. strict ASCII sorting order except * that / is moved so that it sorts before any other non-NUL * character), on penalty of assertion failure. */ void triebuild_add(triebuild *tb, const char *pathname, const struct trie_file *file); /* * Put the finishing touches to the contents of the output file * once all the trie_file records are present. Returns the total * number of elements in the trie. */ int triebuild_finish(triebuild *tb); /* * Free the context. (Does not close the file, but may leave the * file pointer in an arbitrary place.) */ void triebuild_free(triebuild *tb); /* ---------------------------------------------------------------------- * Anomalous function which modifies a trie after it's memory-mapped. */ /* * Invent new fake atimes for each directory in the trie, by * taking the maximum (latest) of the directory's previously * stored atime and the atimes of everything below it. */ void trie_fake_dir_atimes(void *t); /* ---------------------------------------------------------------------- * Functions to query a trie given a pointer to the start of the * memory-mapped file. */ /* * Check the magic numbers at the start of the file. This should also * verify that the file was built on a platform whose structure layout * matches that of the agedu reading it. Returns nonzero on successful * match, zero on mismatch. */ int trie_check_magic(const void *t); /* * Return the path separator character in use in the trie. */ char trie_pathsep(const void *t); /* * Return the length of the longest pathname stored in the trie, * including its trailing NUL. */ size_t trie_maxpathlen(const void *t); /* * Determine the total number of entries in the trie which sort * strictly before the given pathname (irrespective of whether the * pathname actually exists in the trie). */ unsigned long trie_before(const void *t, const char *pathname); /* * Return the pathname for the nth entry in the trie, written into * the supplied buffer (which must be large enough, i.e. at least * trie_maxpathlen(t) bytes). */ void trie_getpath(const void *t, unsigned long n, char *buf); /* * Return the trie_file * for the nth entry in the trie. */ const struct trie_file *trie_getfile(const void *t, unsigned long n); /* * Return the total number of entries in the whole trie. */ unsigned long trie_count(const void *t); /* * Enumerate all the trie_file records in the trie, in sequence, * and return pointers to their trie_file structures. Returns NULL * at end of list, naturally. * * Optionally returns the pathnames as well: if "buf" is non-NULL * then it is expected to point to a buffer large enough to store * all the pathnames in the trie (i.e. at least trie_maxpathlen(t) * bytes). This buffer is also expected to remain unchanged * between calls to triewalk_next(), or else the returned * pathnames will be corrupted. */ typedef struct triewalk triewalk; triewalk *triewalk_new(const void *t); const struct trie_file *triewalk_next(triewalk *tw, char *buf); void triewalk_rebase(triewalk *tw, const void *t); void triewalk_free(triewalk *tw); /* ---------------------------------------------------------------------- * The trie file also contains an index managed by index.h, so we * must be able to ask about that too. */ void trie_set_index_offset(void *t, off_t ptr); off_t trie_get_index_offset(const void *t); /* ---------------------------------------------------------------------- * Utility functions not directly involved with the trie. */ /* * Given a pathname in a buffer, adjust the pathname in place so * that it points at a string which, when passed to trie_before, * will reliably return the index of the thing that comes after * that pathname and all its descendants. Usually this is done by * suffixing ^A (since foo^A is guaranteeably the first thing that * sorts after foo and foo/stuff); however, if the pathname * actually ends in a path separator (e.g. if it's just "/"), that * must be stripped off first. */ void make_successor(char *pathbuf); agedu-r9723/du.c0000644000175300017530000001465212163703774012567 0ustar simonsimon/* * du.c: implementation of du.h. */ #include "agedu.h" #include "du.h" #include "alloc.h" #if !defined __linux__ || !defined O_NOATIME || defined HAVE_FDOPENDIR #ifdef HAVE_DIRENT_H # include #endif #ifdef HAVE_NDIR_H # include #endif #ifdef HAVE_SYS_DIR_H # include #endif #ifdef HAVE_SYS_NDIR_H # include #endif /* * Wrappers around POSIX opendir, readdir and closedir, which * permit me to replace them with different wrappers in special * circumstances. */ typedef DIR *dirhandle; int open_dir(const char *path, dirhandle *dh) { #if defined O_NOATIME && defined HAVE_FDOPENDIR /* * On Linux, we have the O_NOATIME flag. This means we can * read the contents of directories without affecting their * atimes, which enables us to at least try to include them in * the age display rather than exempting them. * * Unfortunately, opendir() doesn't let us open a directory * with O_NOATIME. So instead, we have to open the directory * with vanilla open(), and then use fdopendir() to translate * the fd into a POSIX dir handle. */ int fd; fd = open(path, O_RDONLY | O_NONBLOCK | O_NOCTTY | O_LARGEFILE | O_NOATIME | O_DIRECTORY); if (fd < 0) { /* * Opening a file with O_NOATIME is not unconditionally * permitted by the Linux kernel. As far as I can tell, * it's permitted only for files on which the user would * have been able to call utime(2): in other words, files * for which the user could have deliberately set the * atime back to its original value after finishing with * it. Hence, O_NOATIME has no security implications; it's * simply a cleaner, faster and more race-condition-free * alternative to stat(), a normal open(), and a utimes() * when finished. * * The upshot of all of which, for these purposes, is that * we must be prepared to try again without O_NOATIME if * we receive EPERM. */ if (errno == EPERM) fd = open(path, O_RDONLY | O_NONBLOCK | O_NOCTTY | O_LARGEFILE | O_DIRECTORY); if (fd < 0) return -1; } *dh = fdopendir(fd); #else *dh = opendir(path); #endif if (!*dh) return -1; return 0; } const char *read_dir(dirhandle *dh) { struct dirent *de = readdir(*dh); return de ? de->d_name : NULL; } void close_dir(dirhandle *dh) { closedir(*dh); } #else /* defined __linux__ && !defined HAVE_FDOPENDIR */ /* * Earlier versions of glibc do not have fdopendir(). Therefore, * if we are on Linux and still wish to make use of O_NOATIME, we * have no option but to talk directly to the kernel system call * interface which underlies the POSIX opendir/readdir machinery. */ #define __KERNEL__ #include #include #include _syscall3(int, getdents, uint, fd, struct dirent *, dirp, uint, count) typedef struct { int fd; struct dirent data[32]; struct dirent *curr; int pos, endpos; } dirhandle; int open_dir(const char *path, dirhandle *dh) { /* * As above, we try with O_NOATIME and then fall back to * trying without it. */ dh->fd = open(path, O_RDONLY | O_NONBLOCK | O_NOCTTY | O_LARGEFILE | O_NOATIME | O_DIRECTORY); if (dh->fd < 0) { if (errno == EPERM) dh->fd = open(path, O_RDONLY | O_NONBLOCK | O_NOCTTY | O_LARGEFILE | O_DIRECTORY); if (dh->fd < 0) return -1; } dh->pos = dh->endpos = 0; return 0; } const char *read_dir(dirhandle *dh) { const char *ret; if (dh->pos >= dh->endpos) { dh->curr = dh->data; dh->pos = 0; dh->endpos = getdents(dh->fd, dh->data, sizeof(dh->data)); if (dh->endpos <= 0) return NULL; } ret = dh->curr->d_name; dh->pos += dh->curr->d_reclen; dh->curr = (struct dirent *)((char *)dh->data + dh->pos); return ret; } void close_dir(dirhandle *dh) { close(dh->fd); } #endif /* !defined __linux__ || defined HAVE_FDOPENDIR */ static int str_cmp(const void *av, const void *bv) { return strcmp(*(const char **)av, *(const char **)bv); } static void du_recurse(char **path, size_t pathlen, size_t *pathsize, gotdata_fn_t gotdata, err_fn_t err, void *gotdata_ctx, int toplevel) { const char *name; dirhandle d; STRUCT_STAT st; char **names; size_t i, nnames, namesize; int statret; /* * Special case: at the very top of the scan, we follow a * symlink. */ if (toplevel) statret = STAT_FUNC(*path, &st); else statret = LSTAT_FUNC(*path, &st); if (statret < 0) { err(gotdata_ctx, "%s: lstat: %s\n", *path, strerror(errno)); return; } if (!gotdata(gotdata_ctx, *path, &st)) return; if (!S_ISDIR(st.st_mode)) return; names = NULL; nnames = namesize = 0; if (open_dir(*path, &d) < 0) { err(gotdata_ctx, "%s: opendir: %s\n", *path, strerror(errno)); return; } while ((name = read_dir(&d)) != NULL) { if (name[0] == '.' && (!name[1] || (name[1] == '.' && !name[2]))) { /* do nothing - we skip "." and ".." */ } else { if (nnames >= namesize) { namesize = nnames * 3 / 2 + 64; names = sresize(names, namesize, char *); } names[nnames++] = dupstr(name); } } close_dir(&d); if (nnames == 0) return; qsort(names, nnames, sizeof(*names), str_cmp); for (i = 0; i < nnames; i++) { size_t newpathlen = pathlen + 1 + strlen(names[i]); if (*pathsize <= newpathlen) { *pathsize = newpathlen * 3 / 2 + 256; *path = sresize(*path, *pathsize, char); } /* * Avoid duplicating a slash if we got a trailing one to * begin with (i.e. if we're starting the scan in '/' itself). */ if (pathlen > 0 && (*path)[pathlen-1] == '/') { strcpy(*path + pathlen, names[i]); newpathlen--; } else { sprintf(*path + pathlen, "/%s", names[i]); } du_recurse(path, newpathlen, pathsize, gotdata, err, gotdata_ctx, 0); sfree(names[i]); } sfree(names); } void du(const char *inpath, gotdata_fn_t gotdata, err_fn_t err, void *gotdata_ctx) { char *path; size_t pathlen, pathsize; pathlen = strlen(inpath); /* * Trim any trailing slashes from the input path, otherwise we'll * store them in the index with confusing effects. */ while (pathlen > 1 && inpath[pathlen-1] == '/') pathlen--; pathsize = pathlen + 256; path = snewn(pathsize, char); memcpy(path, inpath, pathlen); path[pathlen] = '\0'; du_recurse(&path, pathlen, &pathsize, gotdata, err, gotdata_ctx, 1); } agedu-r9723/html.h0000644000175300017530000001403312163703774013121 0ustar simonsimon/* * html.h: HTML output format for agedu. */ struct html_config { /* * Configure the format of the URI pathname fragment corresponding * to a given tree entry. * * 'uriformat' is expected to have the following format: * - it consists of one or more _options_, each indicating a * particular way to format a URI, separated by '%|' * - each option contains _at most one_ formatting directive; * without any, it is assumed to only be able to encode the * root tree entry * - the formatting directive may be followed before and/or * afterwards with literal text; percent signs in that literal * text are specified as %% (which doesn't count as a * formatting directive for the 'at most one' rule) * - formatting directives are as follows: * + '%n' outputs the numeric index (in decimal) of the tree * entry * + '%p' outputs the pathname of the tree entry, not counting * any common prefix of the whole tree or a subdirectory * separator following that (so that the root directory of * the tree will always be rendered as the empty string). * The subdirectory separator is translated into '/'; any * remotely worrying character is escaped as = followed by * two hex digits (including, in particular, = itself). The * only characters not escaped are the ASCII alphabets and * numbers, the subdirectory separator as mentioned above, * and the four punctuation characters -.@_ (with the * exception that at the very start of a pathname, even '.' * is escaped). * - '%/p' outputs the pathname of the tree entry, but this time * the subdirectory separator is also considered to be a * worrying character and is escaped. * - '%-p' and '%-/p' are like '%p' and '%/p' respectively, * except that they use the full pathname stored in the tree * without stripping a common prefix. * * These formats are used both for generating and parsing URI * fragments. When generating, the first valid option is used * (which is always the very first one if we're generating the * root URI, or else it's the first option with any formatting * directive); when parsing, the first option that matches will be * accepted. (Thus, you can have '.../subdir' and '.../subdir/' * both accepted, but make the latter canonical; clients of this * mechanism will typically regenerate a URI string after parsing * an index out of it, and return an HTTP redirect if it isn't in * canonical form.) * * All hyperlinks should be correctly generated as relative (i.e. * with the right number of ../ and ./ considering both the * pathname for the page currently being generated, and the one * for the link target). * * If 'uriformat' is NULL, the HTML is generated without hyperlinks. */ const char *uriformat; /* * Configure the filenames output by html_dump(). These can be * configured separately from the URI formats, so that the root * file can be called index.html on disk but have a notional URI * of just / or similar. * * Formatting directives are the same as the uriformat above. */ const char *fileformat; /* * Time stamps to assign to the extreme ends of the colour * scale. If "autoage" is true, they are ignored and the time * stamps are derived from the limits of the age data stored * in the index. */ int autoage; time_t oldest, newest; /* * Specify whether to show individual files as well as * directories in the report. */ int showfiles; /* * The string appearing in the part of HTML pages, before * a colon followed by the path being served. Default is "agedu". */ const char *html_title; }; /* * Parse a URI pathname segment against the URI formats specified in * 'cfg', and return a numeric index in '*index'. Return value is true * on success, or false if the pathname makes no sense, or the index * is out of range, or the index does not correspond to a directory in * the trie. */ int html_parse_path(const void *t, const char *path, const struct html_config *cfg, unsigned long *index); /* * Generate a URI pathname segment from an index. */ char *html_format_path(const void *t, const struct html_config *cfg, unsigned long index); /* * Generate an HTML document containing the results of a query * against the pathname at a given index. Returns a dynamically * allocated piece of memory containing the entire HTML document, * as an ordinary C zero-terminated string. * * 'downlink' is TRUE if hyperlinks should be generated for * subdirectories. (This can also be disabled by setting cfg->format * to NULL, but that also disables the upward hyperlinks to parent * directories. Setting cfg->format to non-NULL but downlink to NULL * will generate uplinks but no downlinks.) */ char *html_query(const void *t, unsigned long index, const struct html_config *cfg, int downlink); /* * Recursively output a dump of lots of HTML files which crosslink * to each other. cfg->format and cfg->rootpath will be used to * generate the filenames for both the hyperlinks and the output * file names; the file names will have "pathprefix" prepended to * them before being opened. * * "index" and "endindex" point to the region of index file that * should be generated by the dump, which must be a subdirectory. * * "maxdepth" limits the depth of recursion. Setting it to zero * outputs only one page, 1 outputs the current directory and its * immediate children but no further, and so on. Making it negative * gives unlimited depth. * * Return value is 0 on success, or 1 if an error occurs during * output. */ int html_dump(const void *t, unsigned long index, unsigned long endindex, int maxdepth, const struct html_config *cfg, const char *pathprefix); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/index.h���������������������������������������������������������������������������������0000644�0001753�0001753�00000004737�12163703774�013276� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * index.h: Manage indexes for agedu. */ #include <sys/types.h> /* * Given the size of an existing data file and the number of * entries required in the index, return the file size required to * store the fixed initial fragment of the index before the * indexbuild functions are invoked. */ off_t index_initial_size(off_t currentsize, int nodecount); /* * Build an index, given the address of a memory-mapped data file * and the starting offset within it. * * trie_file structures passed to tf must of course be within the * bounds of the memory-mapped file. * * The "delta" parameter to indexbuild_new is filled in with the * maximum size by which the index can ever grow in a single * indexbuild_add call. This can be used, together with * indexbuild_realsize, to detect when the index is about to get * too big for its file and the file needs resizing. * * indexbuild_add adds a trie_file structure to the index. * indexbuild_tag, called after that, causes the current state of * the index to be preserved so that it can be queried later. It's * idempotent, and will safely do nothing if called before * indexbuild_add. * * indexbuild_realsize returns the total amount of data _actually_ * written into the file, to allow it to be truncated afterwards, * and to allow the caller of the indexbuild functions to know * when the file is about to need to grow bigger during index * building. * * indexbuild_rebase is used when the file has been * re-memory-mapped at a different address (because it needs to * grow). */ typedef struct indexbuild indexbuild; indexbuild *indexbuild_new(void *t, off_t startoff, int nodecount, size_t *delta); void indexbuild_add(indexbuild *ib, const struct trie_file *tf); void indexbuild_tag(indexbuild *ib); void indexbuild_rebase(indexbuild *ib, void *t); off_t indexbuild_realsize(indexbuild *ib); void indexbuild_free(indexbuild *ib); /* * Check to see if a name index has an index tree root available * (i.e. represents a directory rather than a file). */ int index_has_root(const void *t, int n); /* * Query an index to find the total size of records with name * index strictly less than n, with atime less than at. */ unsigned long long index_query(const void *t, int n, unsigned long long at); /* * Retrieve an order statistic from the index: given a fraction f, * return an atime such that (at most) the requested fraction of * the total data is older than it. */ unsigned long long index_order_stat(const void *t, double f); ���������������������������������agedu-r9723/du.h������������������������������������������������������������������������������������0000644�0001753�0001753�00000001535�12163703774�012570� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * du.h: the function which actually performs the disk scan. */ #include <sys/types.h> #include <sys/stat.h> /* * Function called to report a file or directory, its size and its * last-access time. * * Returns non-zero if recursion should proceed into this file's * contents (if it's a directory); zero if it should not. If the * file isn't a directory, the return value is ignored. */ typedef int (*gotdata_fn_t)(void *ctx, const char *pathname, const STRUCT_STAT *st); /* * Function called to report an error during scanning. The ctx is * the same one passed to gotdata_fn_t. */ typedef void (*err_fn_t)(void *vctx, const char *fmt, ...); /* * Recursively scan a directory tree and report every * space-consuming item in it to gotdata(). */ void du(const char *path, gotdata_fn_t gotdata, err_fn_t err, void *gotdata_ctx); �������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/LICENCE���������������������������������������������������������������������������������0000644�0001753�0001753�00000002073�12163703774�012772� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu is copyright 2008 Simon Tatham. All rights reserved. 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. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/configure.ac����������������������������������������������������������������������������0000644�0001753�0001753�00000003730�12163703774�014274� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# autoconf input for agedu. AC_INIT([agedu], [r9723], [anakin@pobox.com]) AC_CONFIG_SRCDIR([agedu.c]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE(foreign) # Checks for programs. AC_PROG_CC AC_PROG_CC_C99 AC_PROG_INSTALL AC_CHECK_PROG([HALIBUT],[halibut],[yes],[no]) AM_CONDITIONAL([HAVE_HALIBUT],[test "x$HALIBUT" = "xyes"]) # Checks for libraries. # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([assert.h arpa/inet.h ctype.h errno.h fcntl.h features.h fnmatch.h limits.h netdb.h netinet/in.h pwd.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h sys/ioctl.h sys/mman.h sys/socket.h syslog.h termios.h time.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_STRUCT_TM # Checks for library functions. AC_FUNC_CLOSEDIR_VOID AC_PROG_GCC_TRADITIONAL AC_FUNC_MMAP AC_FUNC_SELECT_ARGTYPES AC_FUNC_STRFTIME AC_FUNC_VPRINTF AC_SEARCH_LIBS(connect, socket nsl) AC_SEARCH_LIBS(inet_ntoa, socket nsl) AC_SEARCH_LIBS(inet_addr, socket nsl) AC_SEARCH_LIBS(gethostbyname, socket nsl resolv) AC_SEARCH_LIBS(getaddrinfo, socket nsl resolv) AC_CHECK_FUNCS([ftruncate fdopendir lstat64 stat64 memchr munmap select socket strcasecmp strchr strcspn strerror strrchr strspn strtoul strtoull connect inet_ntoa inet_addr gethostbyname getaddrinfo]) AC_ARG_ENABLE([ipv6], AS_HELP_STRING([--disable-ipv6], [disable IPv6 in the built-in web server]), [ipv6=$enableval],[ipv6=$ac_cv_func_getaddrinfo]) AC_ARG_ENABLE([ipv4], AS_HELP_STRING([--disable-ipv4], [disable IPv4 in the built-in web server]), [ipv4=$enableval],[ipv4=yes]) if test "$ipv6" = "no"; then AC_DEFINE([NO_IPV6], [1], [define if IPv6 is disabled at configure time]) fi if test "$ipv4" = "no"; then AC_DEFINE([NO_IPV4], [1], [define if IPv4 is disabled at configure time]) fi AC_CONFIG_FILES([Makefile]) AC_OUTPUT ����������������������������������������agedu-r9723/httpd.c���������������������������������������������������������������������������������0000644�0001753�0001753�00000067307�12163703774�013307� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * httpd.c: implementation of httpd.h. */ #include "agedu.h" #include "alloc.h" #include "html.h" #include "httpd.h" /* --- Logic driving what the web server's responses are. --- */ enum { /* connctx states */ READING_REQ_LINE, READING_HEADERS, DONE }; struct connctx { const void *t; char *data; int datalen, datasize; char *method, *url, *headers, *auth; int state; }; /* * Called when a new connection arrives on a listening socket. * Returns a connctx for the new connection. */ struct connctx *new_connection(const void *t) { struct connctx *cctx = snew(struct connctx); cctx->t = t; cctx->data = NULL; cctx->datalen = cctx->datasize = 0; cctx->state = READING_REQ_LINE; cctx->method = cctx->url = cctx->headers = cctx->auth = NULL; return cctx; } void free_connection(struct connctx *cctx) { sfree(cctx->data); sfree(cctx); } static char *http_error(char *code, char *errmsg, char *extraheader, char *errtext, ...) { return dupfmt("HTTP/1.1 %s %s\r\n" "Date: %D\r\n" "Server: " PNAME "\r\n" "Connection: close\r\n" "%s" "Content-Type: text/html; charset=US-ASCII\r\n" "\r\n" "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n" "<HTML><HEAD>\r\n" "<TITLE>%s %s\r\n" "\r\n" "

%s %s

\r\n" "

%s

\r\n" "\r\n", code, errmsg, extraheader ? extraheader : "", code, errmsg, code, errmsg, errtext); } static char *http_success(char *mimetype, int stuff_cr, char *document) { return dupfmt("HTTP/1.1 200 OK\r\n" "Date: %D\r\n" "Expires: %D\r\n" "Server: " PNAME "\r\n" "Connection: close\r\n" "Content-Type: %s\r\n" "\r\n" "%S", mimetype, stuff_cr, document); } /* * Called when data comes in on a connection. * * If this function returns NULL, the platform code continues * reading from the socket. Otherwise, it returns some dynamically * allocated data which the platform code will then write to the * socket before closing it. */ char *got_data(struct connctx *ctx, char *data, int length, int magic_access, const char *auth_string, const struct html_config *cfg) { char *line, *p, *q, *r, *z1, *z2, c1, c2; int auth_correct = 0; unsigned long index; char *document, *ret; /* * Add the data we've just received to our buffer. */ if (ctx->datasize < ctx->datalen + length) { ctx->datasize = (ctx->datalen + length) * 3 / 2 + 4096; ctx->data = sresize(ctx->data, ctx->datasize, char); } memcpy(ctx->data + ctx->datalen, data, length); ctx->datalen += length; /* * Gradually process the HTTP request as we receive it. */ if (ctx->state == READING_REQ_LINE) { /* * We're waiting for the first line of the input, which * contains the main HTTP request. See if we've got it * yet. */ line = ctx->data; /* * RFC 2616 section 4.1: `In the interest of robustness, * [...] if the server is reading the protocol stream at * the beginning of a message and receives a CRLF first, * it should ignore the CRLF.' */ while (line - ctx->data < ctx->datalen && (*line == '\r' || *line == '\n')) line++; q = line; while (q - ctx->data < ctx->datalen && *q != '\n') q++; if (q - ctx->data >= ctx->datalen) return NULL; /* not got request line yet */ /* * We've got the first line of the request. Zero-terminate * and parse it into method, URL and optional HTTP * version. */ *q = '\0'; ctx->headers = q+1; if (q > line && q[-1] == '\r') *--q = '\0'; z1 = z2 = q; c1 = c2 = *q; p = line; while (*p && !isspace((unsigned char)*p)) p++; if (*p) { z1 = p++; c1 = *z1; *z1 = '\0'; } while (*p && isspace((unsigned char)*p)) p++; q = p; while (*q && !isspace((unsigned char)*q)) q++; z2 = q++; c2 = *z2; *z2 = '\0'; while (*q && isspace((unsigned char)*q)) q++; /* * Now `line' points at the method name; p points at the * URL, if any; q points at the HTTP version, if any. */ /* * There should _be_ a URL, on any request type at all. */ if (!*p) { char *ret, *text; /* Restore the request to the way we received it. */ *z2 = c2; *z1 = c1; text = dupfmt("" PNAME " received the HTTP request" " \"%h\", which contains no URL.", line); ret = http_error("400", "Bad request", NULL, text); sfree(text); return ret; } ctx->method = line; ctx->url = p; /* * If there was an HTTP version, we might need to see * headers. Otherwise, the request is done. */ if (*q) { ctx->state = READING_HEADERS; } else { ctx->state = DONE; } } if (ctx->state == READING_HEADERS) { /* * While we're receiving the HTTP request headers, all we * do is to keep scanning to see if we find two newlines * next to each other. */ q = ctx->data + ctx->datalen; for (p = ctx->headers; p < q; p++) { if (*p == '\n' && ((p+1 < q && p[1] == '\n') || (p+2 < q && p[1] == '\r' && p[2] == '\n'))) { p[1] = '\0'; ctx->state = DONE; break; } } } if (ctx->state == DONE) { /* * Now we have the entire HTTP request. Decide what to do * with it. */ if (auth_string) { /* * Search the request headers for Authorization. */ q = ctx->data + ctx->datalen; for (p = ctx->headers; p < q; p++) { const char *hdr = "Authorization:"; int i; for (i = 0; hdr[i]; i++) { if (p >= q || tolower((unsigned char)*p) != tolower((unsigned char)hdr[i])) break; p++; } if (!hdr[i]) break; /* found our header */ p = memchr(p, '\n', q - p); if (!p) p = q; } if (p < q) { while (p < q && isspace((unsigned char)*p)) p++; r = p; while (p < q && !isspace((unsigned char)*p)) p++; if (p < q) { *p++ = '\0'; if (!strcasecmp(r, "Basic")) { while (p < q && isspace((unsigned char)*p)) p++; r = p; while (p < q && !isspace((unsigned char)*p)) p++; if (p < q) { *p++ = '\0'; if (!strcmp(r, auth_string)) auth_correct = 1; } } } } } if (!magic_access && !auth_correct) { if (auth_string) { ret = http_error("401", "Unauthorized", "WWW-Authenticate: Basic realm=\""PNAME"\"\r\n", "\nYou must authenticate to view these pages."); } else { ret = http_error("403", "Forbidden", NULL, "This is a restricted-access set of pages."); } } else { p = ctx->url; if (!html_parse_path(ctx->t, p, cfg, &index)) { ret = http_error("404", "Not Found", NULL, "This is not a valid pathname."); } else { char *canonpath = html_format_path(ctx->t, cfg, index); if (!strcmp(canonpath, p)) { /* * This is a canonical path. Return the document. */ document = html_query(ctx->t, index, cfg, 1); if (document) { ret = http_success("text/html", 1, document); sfree(document); } else { ret = http_error("404", "Not Found", NULL, "This is not a valid pathname."); } } else { /* * This is a non-canonical path. Return a redirect * to the right one. * * To do this, we must search the request headers * for Host:, to see what the client thought it * was calling our server. */ char *host = NULL; q = ctx->data + ctx->datalen; for (p = ctx->headers; p < q; p++) { const char *hdr = "Host:"; int i; for (i = 0; hdr[i]; i++) { if (p >= q || tolower((unsigned char)*p) != tolower((unsigned char)hdr[i])) break; p++; } if (!hdr[i]) break; /* found our header */ p = memchr(p, '\n', q - p); if (!p) p = q; } if (p < q) { while (p < q && isspace((unsigned char)*p)) p++; r = p; while (p < q) { if (*p == '\r' && (p+1 >= q || p[1] == '\n')) break; p++; } host = snewn(p-r+1, char); memcpy(host, r, p-r); host[p-r] = '\0'; } if (host) { char *header = dupfmt("Location: http://%s%s\r\n", host, canonpath); ret = http_error("301", "Moved", header, "This is not the canonical form of" " this pathname."); sfree(header); } else { ret = http_error("400", "Bad Request", NULL, "Needed a Host: header to return" " the intended redirection."); } } sfree(canonpath); } } return ret; } else return NULL; } /* --- Platform support for running a web server. --- */ enum { FD_CLIENT, FD_LISTENER, FD_CONNECTION }; struct fd { int fd; int type; int deleted; char *wdata; int wdatalen, wdatapos; int magic_access; struct connctx *cctx; }; struct fd *fds = NULL; int nfds = 0, fdsize = 0; struct fd *new_fdstruct(int fd, int type) { struct fd *ret; if (nfds >= fdsize) { fdsize = nfds * 3 / 2 + 32; fds = sresize(fds, fdsize, struct fd); } ret = &fds[nfds++]; ret->fd = fd; ret->type = type; ret->wdata = NULL; ret->wdatalen = ret->wdatapos = 0; ret->cctx = NULL; ret->deleted = 0; ret->magic_access = 0; return ret; } int check_owning_uid(int fd, int flip) { struct sockaddr_storage sock, peer; int connected; socklen_t addrlen; char linebuf[4096], matchbuf[128]; char *filename; int matchcol, uidcol; FILE *fp; addrlen = sizeof(sock); if (getsockname(fd, (struct sockaddr *)&sock, &addrlen)) { fprintf(stderr, "getsockname: %s\n", strerror(errno)); exit(1); } addrlen = sizeof(peer); connected = 1; if (getpeername(fd, (struct sockaddr *)&peer, &addrlen)) { if (errno == ENOTCONN) { connected = 0; memset(&peer, 0, sizeof(peer)); peer.ss_family = sock.ss_family; } else { fprintf(stderr, "getpeername: %s\n", strerror(errno)); exit(1); } } if (flip) { struct sockaddr_storage tmp = sock; sock = peer; peer = tmp; } #ifndef NO_IPV4 if (peer.ss_family == AF_INET) { struct sockaddr_in *sock4 = (struct sockaddr_in *)&sock; struct sockaddr_in *peer4 = (struct sockaddr_in *)&peer; assert(peer4->sin_family == AF_INET); sprintf(matchbuf, "%08X:%04X %08X:%04X", peer4->sin_addr.s_addr, ntohs(peer4->sin_port), sock4->sin_addr.s_addr, ntohs(sock4->sin_port)); filename = "/proc/net/tcp"; matchcol = 6; uidcol = 75; } else #endif #ifndef NO_IPV6 if (peer.ss_family == AF_INET6) { struct sockaddr_in6 *sock6 = (struct sockaddr_in6 *)&sock; struct sockaddr_in6 *peer6 = (struct sockaddr_in6 *)&peer; char *p; assert(peer6->sin6_family == AF_INET6); p = matchbuf; for (int i = 0; i < 4; i++) p += sprintf(p, "%08X", ((uint32_t *)peer6->sin6_addr.s6_addr)[i]); p += sprintf(p, ":%04X ", ntohs(peer6->sin6_port)); for (int i = 0; i < 4; i++) p += sprintf(p, "%08X", ((uint32_t *)sock6->sin6_addr.s6_addr)[i]); p += sprintf(p, ":%04X", ntohs(sock6->sin6_port)); filename = "/proc/net/tcp6"; matchcol = 6; uidcol = 123; } else #endif { return -1; /* unidentified family */ } fp = fopen(filename, "r"); if (fp) { while (fgets(linebuf, sizeof(linebuf), fp)) { if (strlen(linebuf) >= uidcol && !strncmp(linebuf+matchcol, matchbuf, strlen(matchbuf))) { fclose(fp); return atoi(linebuf + uidcol); } } fclose(fp); } return -1; } void check_magic_access(struct fd *fd) { if (check_owning_uid(fd->fd, 0) == getuid()) fd->magic_access = 1; } static void base64_encode_atom(unsigned char *data, int n, char *out) { static const char base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; unsigned word; word = data[0] << 16; if (n > 1) word |= data[1] << 8; if (n > 2) word |= data[2]; out[0] = base64_chars[(word >> 18) & 0x3F]; out[1] = base64_chars[(word >> 12) & 0x3F]; if (n > 1) out[2] = base64_chars[(word >> 6) & 0x3F]; else out[2] = '='; if (n > 2) out[3] = base64_chars[word & 0x3F]; else out[3] = '='; } struct listenfds { int v4, v6; }; static int make_listening_sockets(struct listenfds *fds, const char *address, const char *portstr, char **outhostname) { /* * Establish up to 2 listening sockets, for IPv4 and IPv6, on the * same arbitrarily selected port. Return them in fds.v4 and * fds.v6, with each entry being -1 if that socket was not * established at all. Main return value is the port chosen, or <0 * if the whole process failed. */ struct sockaddr_in6 addr6; struct sockaddr_in addr4; int got_v6, got_v4; socklen_t addrlen; int ret, port = 0; /* * Special case of the address parameter: if it's "0.0.0.0", treat * it like NULL, because that was how you specified listen-on-any- * address in versions before the IPv6 revamp. */ { int u,v,w,x; if (address && 4 == sscanf(address, "%d.%d.%d.%d", &u, &v, &w, &x) && u==0 && v==0 && w==0 && x==0) address = NULL; } if (portstr && !*portstr) portstr = NULL; /* normalise NULL and empty string */ if (!address) { char hostname[HOST_NAME_MAX]; if (gethostname(hostname, sizeof(hostname)) < 0) { perror("hostname"); return -1; } *outhostname = dupstr(hostname); } else { *outhostname = dupstr(address); } fds->v6 = fds->v4 = -1; got_v6 = got_v4 = 0; #if defined HAVE_GETADDRINFO /* * Resolve the given address using getaddrinfo, yielding an IPv6 * address or an IPv4 one or both. */ struct addrinfo hints; struct addrinfo *addrs, *ai; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = AI_PASSIVE; ret = getaddrinfo(address, portstr, &hints, &addrs); if (ret) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret)); return -1; } for (ai = addrs; ai; ai = ai->ai_next) { #ifndef NO_IPV6 if (!got_v6 && ai->ai_family == AF_INET6) { memcpy(&addr6, ai->ai_addr, ai->ai_addrlen); if (portstr && !port) port = ntohs(addr6.sin6_port); got_v6 = 1; } #endif #ifndef NO_IPV4 if (!got_v4 && ai->ai_family == AF_INET) { memcpy(&addr4, ai->ai_addr, ai->ai_addrlen); if (portstr && !port) port = ntohs(addr4.sin_port); got_v4 = 1; } #endif } #elif defined HAVE_GETHOSTBYNAME /* * IPv4-only setup using inet_addr and gethostbyname. */ struct hostent *h; memset(&addr4, 0, sizeof(addr4)); addr4.sin_family = AF_INET; if (!address) { addr4.sin_addr.s_addr = htons(INADDR_ANY); got_v4 = 1; } else if (inet_aton(address, &addr4.sin_addr)) { got_v4 = 1; /* numeric address */ } else if ((h = gethostbyname(address)) != NULL) { memcpy(&addr4.sin_addr, h->h_addr, sizeof(addr4.sin_addr)); got_v4 = 1; } else { fprintf(stderr, "gethostbyname: %s\n", hstrerror(h_errno)); return -1; } if (portstr) { struct servent *s; if (!portstr[strspn(portstr, "0123456789")]) { port = atoi(portstr); } else if ((s = getservbyname(portstr, NULL)) != NULL) { port = ntohs(s->s_port); } else { fprintf(stderr, "getservbyname: port '%s' not understood\n", portstr); return -1; } } #endif #ifndef NO_IPV6 #ifndef NO_IPV4 retry: #endif if (got_v6) { fds->v6 = socket(PF_INET6, SOCK_STREAM, 0); if (fds->v6 < 0) { fprintf(stderr, "socket(PF_INET6): %s\n", strerror(errno)); goto done_v6; } #ifdef IPV6_V6ONLY { int i = 1; if (setsockopt(fds->v6, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&i, sizeof(i)) < 0) { fprintf(stderr, "setsockopt(IPV6_V6ONLY): %s\n", strerror(errno)); close(fds->v6); fds->v6 = -1; goto done_v6; } } #endif /* IPV6_V6ONLY */ addr6.sin6_port = htons(port); addrlen = sizeof(addr6); if (bind(fds->v6, (const struct sockaddr *)&addr6, addrlen) < 0) { fprintf(stderr, "bind: %s\n", strerror(errno)); close(fds->v6); fds->v6 = -1; goto done_v6; } if (listen(fds->v6, 5) < 0) { fprintf(stderr, "listen: %s\n", strerror(errno)); close(fds->v6); fds->v6 = -1; goto done_v6; } if (port == 0) { addrlen = sizeof(addr6); if (getsockname(fds->v6, (struct sockaddr *)&addr6, &addrlen) < 0) { fprintf(stderr, "getsockname: %s\n", strerror(errno)); close(fds->v6); fds->v6 = -1; goto done_v6; } port = ntohs(addr6.sin6_port); } } done_v6: #endif #ifndef NO_IPV4 if (got_v4) { fds->v4 = socket(PF_INET, SOCK_STREAM, 0); if (fds->v4 < 0) { fprintf(stderr, "socket(PF_INET): %s\n", strerror(errno)); goto done_v4; } addr4.sin_port = htons(port); addrlen = sizeof(addr4); if (bind(fds->v4, (const struct sockaddr *)&addr4, addrlen) < 0) { #ifndef NO_IPV6 if (fds->v6 >= 0) { /* * If we support both v6 and v4, it's a failure * condition if we didn't manage to bind to both. If * the port number was arbitrary, we go round and try * again. Otherwise, give up. */ close(fds->v6); close(fds->v4); fds->v6 = fds->v4 = -1; port = 0; if (!portstr) goto retry; } #endif fprintf(stderr, "bind: %s\n", strerror(errno)); close(fds->v4); fds->v4 = -1; goto done_v4; } if (listen(fds->v4, 5) < 0) { fprintf(stderr, "listen: %s\n", strerror(errno)); close(fds->v4); fds->v4 = -1; goto done_v4; } if (port == 0) { addrlen = sizeof(addr4); if (getsockname(fds->v4, (struct sockaddr *)&addr4, &addrlen) < 0) { fprintf(stderr, "getsockname: %s\n", strerror(errno)); close(fds->v4); fds->v4 = -1; goto done_v4; } port = ntohs(addr4.sin_port); } } done_v4: #endif if (fds->v6 >= 0 || fds->v4 >= 0) return port; else return -1; } void run_httpd(const void *t, int authmask, const struct httpd_config *dcfg, const struct html_config *incfg) { struct listenfds lfds; int ret, port; int authtype; char *authstring = NULL; char *hostname; struct sockaddr_in addr; socklen_t addrlen; struct html_config cfg = *incfg; /* * Establish the listening socket(s) and retrieve its port * number. */ port = make_listening_sockets(&lfds, dcfg->address, dcfg->port, &hostname); if (port < 0) exit(1); /* already reported an error */ if ((authmask & HTTPD_AUTH_MAGIC) && (lfds.v4 < 0 || check_owning_uid(lfds.v4, 1) == getuid()) && (lfds.v6 < 0 || check_owning_uid(lfds.v6, 1) == getuid())) { authtype = HTTPD_AUTH_MAGIC; if (authmask != HTTPD_AUTH_MAGIC) printf("Using Linux /proc/net magic authentication\n"); } else if ((authmask & HTTPD_AUTH_BASIC)) { char username[128], password[128], userpassbuf[259]; const char *userpass; const char *rname; unsigned char passbuf[10]; int i, j, k, fd; authtype = HTTPD_AUTH_BASIC; if (authmask != HTTPD_AUTH_BASIC) printf("Using HTTP Basic authentication\n"); if (dcfg->basicauthdata) { userpass = dcfg->basicauthdata; } else { strcpy(username, PNAME); rname = "/dev/urandom"; fd = open(rname, O_RDONLY); if (fd < 0) { int err = errno; rname = "/dev/random"; fd = open(rname, O_RDONLY); if (fd < 0) { int err2 = errno; fprintf(stderr, "/dev/urandom: open: %s\n", strerror(err)); fprintf(stderr, "/dev/random: open: %s\n", strerror(err2)); exit(1); } } for (i = 0; i < 10 ;) { j = read(fd, passbuf + i, 10 - i); if (j <= 0) { fprintf(stderr, "%s: read: %s\n", rname, j < 0 ? strerror(errno) : "unexpected EOF"); exit(1); } i += j; } close(fd); for (i = 0; i < 16; i++) { /* * 32 characters out of the 36 alphanumerics gives * me the latitude to discard i,l,o for being too * numeric-looking, and w because it has two too * many syllables and one too many presidential * associations. */ static const char chars[32] = "0123456789abcdefghjkmnpqrstuvxyz"; int v = 0; k = i / 8 * 5; for (j = 0; j < 5; j++) v |= ((passbuf[k+j] >> (i%8)) & 1) << j; password[i] = chars[v]; } password[i] = '\0'; sprintf(userpassbuf, "%s:%s", username, password); userpass = userpassbuf; printf("Username: %s\nPassword: %s\n", username, password); } k = strlen(userpass); authstring = snewn(k * 4 / 3 + 16, char); for (i = j = 0; i < k ;) { int s = k-i < 3 ? k-i : 3; base64_encode_atom((unsigned char *)(userpass+i), s, authstring+j); i += s; j += 4; } authstring[j] = '\0'; } else if ((authmask & HTTPD_AUTH_NONE)) { authtype = HTTPD_AUTH_NONE; if (authmask != HTTPD_AUTH_NONE) printf("Web server is unauthenticated\n"); } else { fprintf(stderr, PNAME ": authentication method not supported\n"); exit(1); } if (port == 80) { printf("URL: http://%s/\n", hostname); } else { printf("URL: http://%s:%d/\n", hostname, port); } fflush(stdout); /* * Now construct fd structure(s) to hold the listening sockets. */ if (lfds.v4 >= 0) new_fdstruct(lfds.v4, FD_LISTENER); if (lfds.v6 >= 0) new_fdstruct(lfds.v6, FD_LISTENER); if (dcfg->closeoneof) { /* * Read from standard input, and treat EOF as a notification * to exit. */ new_fdstruct(0, FD_CLIENT); } /* * Now we're ready to run our main loop. Keep looping round on * select. */ while (1) { fd_set rfds, wfds; int i, j; SELECT_TYPE_ARG1 maxfd; int ret; #define FD_SET_MAX(fd, set, max) \ do { FD_SET((fd),(set)); (max) = ((max)<=(fd)?(fd)+1:(max)); } while(0) /* * Loop round the fd list putting fds into our select * sets. Also in this loop we remove any that were marked * as deleted in the previous loop. */ FD_ZERO(&rfds); FD_ZERO(&wfds); maxfd = 0; for (i = j = 0; j < nfds; j++) { if (fds[j].deleted) { sfree(fds[j].wdata); free_connection(fds[j].cctx); continue; } fds[i] = fds[j]; switch (fds[i].type) { case FD_CLIENT: FD_SET_MAX(fds[i].fd, &rfds, maxfd); break; case FD_LISTENER: FD_SET_MAX(fds[i].fd, &rfds, maxfd); break; case FD_CONNECTION: /* * Always read from a connection socket. Even * after we've started writing, the peer might * still be sending (e.g. because we shamefully * jumped the gun before waiting for the end of * the HTTP request) and so we should be prepared * to read data and throw it away. */ FD_SET_MAX(fds[i].fd, &rfds, maxfd); /* * Also attempt to write, if we have data to write. */ if (fds[i].wdatapos < fds[i].wdatalen) FD_SET_MAX(fds[i].fd, &wfds, maxfd); break; } i++; } nfds = i; ret = select(maxfd, SELECT_TYPE_ARG234 &rfds, SELECT_TYPE_ARG234 &wfds, SELECT_TYPE_ARG234 NULL, SELECT_TYPE_ARG5 NULL); if (ret <= 0) { if (ret < 0 && (errno != EINTR)) { fprintf(stderr, "select: %s", strerror(errno)); exit(1); } continue; } for (i = 0; i < nfds; i++) { switch (fds[i].type) { case FD_CLIENT: if (FD_ISSET(fds[i].fd, &rfds)) { char buf[4096]; int ret = read(fds[i].fd, buf, sizeof(buf)); if (ret <= 0) { if (ret < 0) { fprintf(stderr, "standard input: read: %s\n", strerror(errno)); exit(1); } return; } } break; case FD_LISTENER: if (FD_ISSET(fds[i].fd, &rfds)) { /* * New connection has come in. Accept it. */ struct fd *f; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); int newfd = accept(fds[i].fd, (struct sockaddr *)&addr, &addrlen); if (newfd < 0) break; /* not sure what happened there */ f = new_fdstruct(newfd, FD_CONNECTION); f->cctx = new_connection(t); if (authtype == HTTPD_AUTH_MAGIC) check_magic_access(f); } break; case FD_CONNECTION: if (FD_ISSET(fds[i].fd, &rfds)) { /* * There's data to be read. */ char readbuf[4096]; int ret; ret = read(fds[i].fd, readbuf, sizeof(readbuf)); if (ret <= 0) { /* * This shouldn't happen in a sensible * HTTP connection, so we abandon the * connection if it does. */ close(fds[i].fd); fds[i].deleted = 1; break; } else { if (!fds[i].wdata) { /* * If we haven't got an HTTP response * yet, keep processing data in the * hope of acquiring one. */ fds[i].wdata = got_data (fds[i].cctx, readbuf, ret, (authtype == HTTPD_AUTH_NONE || fds[i].magic_access), authstring, &cfg); if (fds[i].wdata) { fds[i].wdatalen = strlen(fds[i].wdata); fds[i].wdatapos = 0; } } else { /* * Otherwise, just drop our read data * on the floor. */ } } } if (FD_ISSET(fds[i].fd, &wfds) && fds[i].wdatapos < fds[i].wdatalen) { /* * The socket is writable, and we have data to * write. Write it. */ int ret = write(fds[i].fd, fds[i].wdata + fds[i].wdatapos, fds[i].wdatalen - fds[i].wdatapos); if (ret <= 0) { /* * Shouldn't happen; abandon the connection. */ close(fds[i].fd); fds[i].deleted = 1; break; } else { fds[i].wdatapos += ret; if (fds[i].wdatapos == fds[i].wdatalen) { shutdown(fds[i].fd, SHUT_WR); } } } break; } } } } agedu-r9723/TODO0000644000175300017530000001532412163703774012500 0ustar simonsimonTODO list for agedu =================== - flexibility in the HTML report output mode: expose the internal mechanism for configuring the output filenames, and allow the user to request individual files with hyperlinks as if the other files existed. (In particular, functionality of this kind would enable other modes of use like the built-in --cgi mode, without me having to anticipate them in detail.) - non-ASCII character set support + could usefully apply to --title and also to file names + how do we determine the input charset? Via locale, presumably. + how do we do translation? Importing my charset library is one heavyweight option; alternatively, does the native C locale mechanism provide enough functionality to do the job by itself? + in HTML, we would need to decide on an _output_ character set, specify it in a tag, and translate to it from the input locale - one option is to make the output charset the same as the input one, in which case all we need is to identify its name for the tag - the other option is to make the output charset UTF-8 always and translate to that from everything else - in the web server and CGI modes, it would probably be nicer to move that tag into a proper HTTP header + even in text mode we would want to parse the filenames in some fashion, due to the unhelpful corner case of Shift-JIS Windows (in which backslashes in the input string must be classified as path separators or the second byte of a two-byte character) - that's really painful, since it will impact string processing of filenames throughout the code - so perhaps a better approach would be to do locale processing of filenames at _scan_ time, and normalise to UTF-8 in both the index and dump files? + involves incrementing the version of the dump-file format + then paths given on the command line are translated quickly to UTF-8 before comparing them against index paths + and now the HTML output side becomes easy, though the text output involves translating back again + but what if the filenames aren't intended to be interpreted in any particular character set (old-style Unix semantics) or in a consistent one? - we could still be using more of the information coming from autoconf. Our config.h is defining a whole bunch of HAVE_FOOs for particular functions (e.g. HAVE_INET_NTOA, HAVE_MEMCHR, HAVE_FNMATCH). We could usefully supply alternatives for some of these functions (e.g. cannibalise the PuTTY wildcard matcher for use in the absence of fnmatch, switch to vanilla truncate() in the absence of ftruncate); where we don't have alternative code, it would perhaps be polite to throw an error at configure time rather than allowing the subsequent build to fail. + however, I don't see anything here that looks very controversial; IIRC it's all in POSIX, for one thing. So more likely this should simply wait until somebody complains. - run-time configuration in the HTTP server * I think this probably works by having a configuration form, or a link pointing to one, somewhere on the report page. If you want to reconfigure anything, you fill in and submit the form; the web server receives HTTP GET with parameters and a referer, adjusts its internal configuration, and returns an HTTP redirect back to the referring page - which it then re-renders in accordance with the change. * All the same options should have their starting states configurable on the command line too. - curses-ish equivalent of the web output + try using xterm 256-colour mode. Can (n)curses handle that? If not, try doing it manually. + I think my current best idea is to bypass ncurses and go straight to terminfo: generate lines of attribute-interleaved text and display them, so we only really need the sequences "go here and display stuff", "scroll up", "scroll down". + Infrastructure work before doing any of this would be to split html.c into two: one part to prepare an abstract data structure describing an HTML-like report (in particular, all the index lookups, percentage calculation, vector arithmetic and line sorting), and another part to generate the literal HTML. Then the former can be reused to produce very similar reports in coloured plain text. - abstracting away all the Unix calls so as to enable a full Windows port. We can already do the difficult bit on Windows (scanning the filesystem and retrieving atime-analogues). Everything else is just coding - albeit quite a _lot_ of coding, since the Unix assumptions are woven quite tightly into the current code. + If nothing else, it's unclear what the user interface properly ought to be in a Windows port of agedu. A command-line job exactly like the Unix version might be useful to some people, but would certainly be strange and confusing to others. - it might conceivably be useful to support a choice of indexing strategies. The current "continuous index" mechanism's tradeoff of taking O(N log N) space in order to be able to support any age cutoff you like is not going to be ideal for everybody. A second more conventional "discrete index" mechanism which allows the user to specify a number of fixed cutoffs and just indexes each directory on those alone would undoubtedly be a useful thing for large-scale users. This will require considerable thought about how to make the indexers pluggable at both index-generation time and query time. * however, now we have the cut-down version of the continuous index, the space saving is less compelling. - A user requested what's essentially a VFS layer: given multiple index files and a map of how they fit into an overall namespace, we should be able to construct the right answers for any query about the resulting aggregated hierarchy by doing at most O(number of indexes * normal number of queries) work. - Support for filtering the scan by ownership and permissions. The index data structure can't handle this, so we can't build a single index file admitting multiple subset views; but a user suggested that the scan phase could record information about ownership and permissions in the dump file, and then the indexing phase could filter down to a particular sub-view - which would at least allow the construction of various subset indices from one dump file, without having to redo the full disk scan which is the most time-consuming part of all. agedu-r9723/agedu.c0000644000175300017530000013461012163703774013241 0ustar simonsimon/* * Main program for agedu. */ #include "agedu.h" #include "du.h" #include "trie.h" #include "index.h" #include "alloc.h" #include "html.h" #include "httpd.h" #include "fgetline.h" /* * Path separator. This global variable affects the behaviour of * various parts of the code when they need to deal with path * separators. The path separator appropriate to a particular data * set is encoded in the index file storing that data set; data * sets generated on Unix will of course have the default '/', but * foreign data sets are conceivable and must be handled correctly. */ char pathsep = '/'; void fatal(const char *fmt, ...) { va_list ap; fprintf(stderr, "%s: ", PNAME); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); exit(1); } struct inclusion_exclusion { int type; const char *wildcard; int path; }; struct ctx { triebuild *tb; dev_t datafile_dev, filesystem_dev; ino_t datafile_ino; time_t last_output_update; int progress, progwidth; int straight_to_dump; struct inclusion_exclusion *inex; int ninex; int crossfs; int usemtime; int fakeatimes; }; static void dump_line(const char *pathname, const struct trie_file *tf) { const char *p; if (printf("%llu %llu ", tf->size, tf->atime) < 0) goto error; for (p = pathname; *p; p++) { if (*p >= ' ' && *p < 127 && *p != '%') { if (putchar(*p) == EOF) goto error; } else { if (printf("%%%02x", (unsigned char)*p) < 0) goto error; } } if (putchar('\n') == EOF) goto error; return; error: fatal("standard output: %s", strerror(errno)); } static int gotdata(void *vctx, const char *pathname, const STRUCT_STAT *st) { struct ctx *ctx = (struct ctx *)vctx; struct trie_file file; time_t t; int i, include; const char *filename; /* * Filter out our own data file. */ if (st->st_dev == ctx->datafile_dev && st->st_ino == ctx->datafile_ino) return 0; /* * Don't cross the streams^W^Wany file system boundary. */ if (!ctx->crossfs && st->st_dev != ctx->filesystem_dev) return 0; file.size = (unsigned long long)512 * st->st_blocks; if (ctx->usemtime || (ctx->fakeatimes && S_ISDIR(st->st_mode))) file.atime = st->st_mtime; else file.atime = max(st->st_mtime, st->st_atime); /* * Filter based on wildcards. */ include = 1; filename = strrchr(pathname, pathsep); if (!filename) filename = pathname; else filename++; for (i = 0; i < ctx->ninex; i++) { if (fnmatch(ctx->inex[i].wildcard, ctx->inex[i].path ? pathname : filename, 0) == 0) include = ctx->inex[i].type; } if (include == -1) return 0; /* ignore this entry and any subdirs */ if (include == 0) { /* * Here we are supposed to be filtering an entry out, but * still recursing into it if it's a directory. However, * we can't actually leave out any directory whose * subdirectories we then look at. So we cheat, in that * case, by setting the size to zero. */ if (!S_ISDIR(st->st_mode)) return 0; /* just ignore */ else file.size = 0; } if (ctx->straight_to_dump) dump_line(pathname, &file); else triebuild_add(ctx->tb, pathname, &file); if (ctx->progress) { t = time(NULL); if (t != ctx->last_output_update) { fprintf(stderr, "%-*.*s\r", ctx->progwidth, ctx->progwidth, pathname); fflush(stderr); ctx->last_output_update = t; } } return 1; } static void scan_error(void *vctx, const char *fmt, ...) { struct ctx *ctx = (struct ctx *)vctx; va_list ap; if (ctx->progress) { fprintf(stderr, "%-*s\r", ctx->progwidth, ""); fflush(stderr); } fprintf(stderr, "%s: ", PNAME); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); ctx->last_output_update--; /* force a progress report next time */ } static void text_query(const void *mappedfile, const char *querydir, time_t t, int showfiles, int depth, FILE *fp) { size_t maxpathlen; char *pathbuf; unsigned long xi1, xi2; unsigned long long size; maxpathlen = trie_maxpathlen(mappedfile); pathbuf = snewn(maxpathlen + 1, char); /* * We want to query everything between the supplied filename * (inclusive) and that filename with a ^A on the end * (exclusive). So find the x indices for each. */ strcpy(pathbuf, querydir); make_successor(pathbuf); xi1 = trie_before(mappedfile, querydir); xi2 = trie_before(mappedfile, pathbuf); if (!showfiles && xi2 - xi1 == 1) return; /* file, or empty dir => no display */ /* * Now do the lookups in the age index. */ if (xi2 - xi1 == 1) { /* * We are querying an individual file, so we should not * depend on the index entries either side of the node, * since they almost certainly don't both exist. Instead, * just look up the file's size and atime in the main trie. */ const struct trie_file *f = trie_getfile(mappedfile, xi1); if (f->atime < t) size = f->size; else size = 0; } else { unsigned long long s1, s2; s1 = index_query(mappedfile, xi1, t); s2 = index_query(mappedfile, xi2, t); size = s2 - s1; } if (size == 0) return; /* no space taken up => no display */ if (depth != 0) { /* * Now scan for first-level subdirectories and report * those too. */ int newdepth = (depth > 0 ? depth - 1 : depth); xi1++; while (xi1 < xi2) { trie_getpath(mappedfile, xi1, pathbuf); text_query(mappedfile, pathbuf, t, showfiles, newdepth, fp); make_successor(pathbuf); xi1 = trie_before(mappedfile, pathbuf); } } /* Display in units of 1Kb */ fprintf(fp, "%-11llu %s\n", (size) / 1024, querydir); } /* * Largely frivolous way to define all my command-line options. I * present here a parametric macro which declares a series of * _logical_ option identifiers, and for each one declares zero or * more short option characters and zero or more long option * words. Then I repeatedly invoke that macro with its arguments * defined to be various other macros, which allows me to * variously: * * - define an enum allocating a distinct integer value to each * logical option id * - define a string consisting of precisely all the short option * characters * - define a string array consisting of all the long option * strings * - define (with help from auxiliary enums) integer arrays * parallel to both of the above giving the logical option id * for each physical short and long option * - define an array indexed by logical option id indicating * whether the option in question takes a value * - define a function which prints out brief online help for all * the options. * * It's not at all clear to me that this trickery is actually * particularly _efficient_ - it still, after all, requires going * linearly through the option list at run time and doing a * strcmp, whereas in an ideal world I'd have liked the lists of * long and short options to be pre-sorted so that a binary search * or some other more efficient lookup was possible. (Not that * asymptotic algorithmic complexity is remotely vital in option * parsing, but if I were doing this in, say, Lisp or something * with an equivalently powerful preprocessor then once I'd had * the idea of preparing the option-parsing data structures at * compile time I would probably have made the effort to prepare * them _properly_. I could have Perl generate me a source file * from some sort of description, I suppose, but that would seem * like overkill. And in any case, it's more of a challenge to * achieve as much as possible by cunning use of cpp and enum than * to just write some sensible and logical code in a Turing- * complete language. I said it was largely frivolous :-) * * This approach does have the virtue that it brings together the * option ids, option spellings and help text into a single * combined list and defines them all in exactly one place. If I * want to add a new option, or a new spelling for an option, I * only have to modify the main OPTHELP macro below and then add * code to process the new logical id. * * (Though, really, even that isn't ideal, since it still involves * modifying the source file in more than one place. In a * _properly_ ideal world, I'd be able to interleave the option * definitions with the code fragments that process them. And then * not bother defining logical identifiers for them at all - those * would be automatically generated, since I wouldn't have any * need to specify them manually in another part of the code.) * * One other helpful consequence of the enum-based structure here * is that it causes a compiler error if I accidentally try to * define the same option (short or long) twice. */ #define OPTHELP(NOVAL, VAL, SHORT, LONG, HELPPFX, HELPARG, HELPLINE, HELPOPT) \ HELPPFX("usage") HELPLINE(PNAME " [options] action [action...]") \ HELPPFX("actions") \ VAL(SCAN) SHORT(s) LONG(scan) \ HELPARG("directory") HELPOPT("scan and index a directory") \ NOVAL(HTTPD) SHORT(w) LONG(web) LONG(server) LONG(httpd) \ HELPOPT("serve HTML reports from a temporary web server") \ VAL(TEXT) SHORT(t) LONG(text) \ HELPARG("subdir") HELPOPT("print a plain text report on a subdirectory") \ NOVAL(REMOVE) SHORT(R) LONG(remove) LONG(delete) LONG(unlink) \ HELPOPT("remove the index file") \ NOVAL(DUMP) SHORT(D) LONG(dump) HELPOPT("dump the index file on stdout") \ NOVAL(LOAD) SHORT(L) LONG(load) \ HELPOPT("load and index a dump file") \ VAL(SCANDUMP) SHORT(S) LONG(scan_dump) \ HELPARG("directory") HELPOPT("scan only, generating a dump") \ VAL(HTML) SHORT(H) LONG(html) \ HELPARG("subdir") HELPOPT("print an HTML report on a subdirectory") \ NOVAL(CGI) LONG(cgi) \ HELPOPT("do the right thing when run from a CGI script") \ HELPPFX("options") \ VAL(DATAFILE) SHORT(f) LONG(file) \ HELPARG("filename") HELPOPT("[most modes] specify index file") \ NOVAL(CROSSFS) LONG(cross_fs) \ HELPOPT("[--scan] cross filesystem boundaries") \ NOVAL(NOCROSSFS) LONG(no_cross_fs) \ HELPOPT("[--scan] stick to one filesystem") \ VAL(PRUNE) LONG(prune) \ HELPARG("wildcard") HELPOPT("[--scan] prune files matching pattern") \ VAL(PRUNEPATH) LONG(prune_path) \ HELPARG("wildcard") HELPOPT("[--scan] prune pathnames matching pattern") \ VAL(EXCLUDE) LONG(exclude) \ HELPARG("wildcard") HELPOPT("[--scan] exclude files matching pattern") \ VAL(EXCLUDEPATH) LONG(exclude_path) \ HELPARG("wildcard") HELPOPT("[--scan] exclude pathnames matching pattern") \ VAL(INCLUDE) LONG(include) \ HELPARG("wildcard") HELPOPT("[--scan] include files matching pattern") \ VAL(INCLUDEPATH) LONG(include_path) \ HELPARG("wildcard") HELPOPT("[--scan] include pathnames matching pattern") \ NOVAL(PROGRESS) LONG(progress) LONG(scan_progress) \ HELPOPT("[--scan] report progress on stderr") \ NOVAL(NOPROGRESS) LONG(no_progress) LONG(no_scan_progress) \ HELPOPT("[--scan] do not report progress") \ NOVAL(TTYPROGRESS) LONG(tty_progress) LONG(tty_scan_progress) \ LONG(progress_tty) LONG(scan_progress_tty) \ HELPOPT("[--scan] report progress if stderr is a tty") \ NOVAL(DIRATIME) LONG(dir_atime) LONG(dir_atimes) \ HELPOPT("[--scan,--load] keep real atimes on directories") \ NOVAL(NODIRATIME) LONG(no_dir_atime) LONG(no_dir_atimes) \ HELPOPT("[--scan,--load] fake atimes on directories") \ NOVAL(NOEOF) LONG(no_eof) LONG(noeof) \ HELPOPT("[--web] do not close web server on EOF") \ NOVAL(MTIME) LONG(mtime) \ HELPOPT("[--scan] use mtime instead of atime") \ NOVAL(SHOWFILES) LONG(files) \ HELPOPT("[--web,--html,--text] list individual files") \ VAL(AGERANGE) SHORT(r) LONG(age_range) LONG(range) LONG(ages) \ HELPARG("age[-age]") HELPOPT("[--web,--html] set limits of colour coding") \ VAL(OUTFILE) SHORT(o) LONG(output) \ HELPARG("filename") HELPOPT("[--html] specify output file or directory name") \ VAL(SERVERADDR) LONG(address) LONG(addr) LONG(server_address) \ LONG(server_addr) \ HELPARG("addr[:port]") HELPOPT("[--web] specify HTTP server address") \ VAL(AUTH) LONG(auth) LONG(http_auth) LONG(httpd_auth) \ LONG(server_auth) LONG(web_auth) \ HELPARG("type") HELPOPT("[--web] specify HTTP authentication method") \ VAL(AUTHFILE) LONG(auth_file) \ HELPARG("filename") HELPOPT("[--web] read HTTP Basic user/pass from file") \ VAL(AUTHFD) LONG(auth_fd) \ HELPARG("fd") HELPOPT("[--web] read HTTP Basic user/pass from fd") \ VAL(HTMLTITLE) LONG(title) \ HELPARG("title") HELPOPT("[--web,--html] title prefix for web pages") \ VAL(DEPTH) SHORT(d) LONG(depth) LONG(max_depth) LONG(maximum_depth) \ HELPARG("levels") HELPOPT("[--text,--html] recurse to this many levels") \ VAL(MINAGE) SHORT(a) LONG(age) LONG(min_age) LONG(minimum_age) \ HELPARG("age") HELPOPT("[--text] include only files older than this") \ HELPPFX("also") \ NOVAL(HELP) SHORT(h) LONG(help) HELPOPT("display this help text") \ NOVAL(VERSION) SHORT(V) LONG(version) HELPOPT("report version number") \ NOVAL(LICENCE) LONG(licence) LONG(license) \ HELPOPT("display (MIT) licence text") \ #define IGNORE(x) #define DEFENUM(x) OPT_ ## x, #define ZERO(x) 0, #define ONE(x) 1, #define STRING(x) #x , #define STRINGNOCOMMA(x) #x #define SHORTNEWOPT(x) SHORTtmp_ ## x = OPT_ ## x, #define SHORTTHISOPT(x) SHORTtmp2_ ## x, SHORTVAL_ ## x = SHORTtmp2_ ## x - 1, #define SHORTOPTVAL(x) SHORTVAL_ ## x, #define SHORTTMP(x) SHORTtmp3_ ## x, #define LONGNEWOPT(x) LONGtmp_ ## x = OPT_ ## x, #define LONGTHISOPT(x) LONGtmp2_ ## x, LONGVAL_ ## x = LONGtmp2_ ## x - 1, #define LONGOPTVAL(x) LONGVAL_ ## x, #define LONGTMP(x) SHORTtmp3_ ## x, #define OPTIONS(NOVAL, VAL, SHORT, LONG) \ OPTHELP(NOVAL, VAL, SHORT, LONG, IGNORE, IGNORE, IGNORE, IGNORE) enum { OPTIONS(DEFENUM,DEFENUM,IGNORE,IGNORE) NOPTIONS }; enum { OPTIONS(IGNORE,IGNORE,SHORTTMP,IGNORE) NSHORTOPTS }; enum { OPTIONS(IGNORE,IGNORE,IGNORE,LONGTMP) NLONGOPTS }; static const int opthasval[NOPTIONS] = {OPTIONS(ZERO,ONE,IGNORE,IGNORE)}; static const char shortopts[] = {OPTIONS(IGNORE,IGNORE,STRINGNOCOMMA,IGNORE)}; static const char *const longopts[] = {OPTIONS(IGNORE,IGNORE,IGNORE,STRING)}; enum { OPTIONS(SHORTNEWOPT,SHORTNEWOPT,SHORTTHISOPT,IGNORE) UNUSEDENUMVAL1 }; enum { OPTIONS(LONGNEWOPT,LONGNEWOPT,IGNORE,LONGTHISOPT) UNUSEDENUMVAL2 }; static const int shortvals[] = {OPTIONS(IGNORE,IGNORE,SHORTOPTVAL,IGNORE)}; static const int longvals[] = {OPTIONS(IGNORE,IGNORE,IGNORE,LONGOPTVAL)}; static void usage(FILE *fp) { char longbuf[80]; const char *prefix, *shortopt, *longopt, *optarg; int i, optex; #define HELPRESET prefix = shortopt = longopt = optarg = NULL, optex = -1 #define HELPNOVAL(s) optex = 0; #define HELPVAL(s) optex = 1; #define HELPSHORT(s) if (!shortopt) shortopt = "-" #s; #define HELPLONG(s) if (!longopt) { \ strcpy(longbuf, "--" #s); longopt = longbuf; \ for (i = 0; longbuf[i]; i++) if (longbuf[i] == '_') longbuf[i] = '-'; } #define HELPPFX(s) prefix = s; #define HELPARG(s) optarg = s; #define HELPLINE(s) assert(optex == -1); \ fprintf(fp, "%7s%c %s\n", prefix?prefix:"", prefix?':':' ', s); \ HELPRESET; #define HELPOPT(s) assert((optex == 1 && optarg) || (optex == 0 && !optarg)); \ assert(shortopt || longopt); \ i = fprintf(fp, "%7s%c %s%s%s%s%s", prefix?prefix:"", prefix?':':' ', \ shortopt?shortopt:"", shortopt&&longopt?", ":"", longopt?longopt:"", \ optarg?" ":"", optarg?optarg:""); \ fprintf(fp, "%*s %s\n", i<32?32-i:0,"",s); HELPRESET; HELPRESET; OPTHELP(HELPNOVAL, HELPVAL, HELPSHORT, HELPLONG, HELPPFX, HELPARG, HELPLINE, HELPOPT); #undef HELPRESET #undef HELPNOVAL #undef HELPVAL #undef HELPSHORT #undef HELPLONG #undef HELPPFX #undef HELPARG #undef HELPLINE #undef HELPOPT } static time_t parse_age(time_t now, const char *agestr) { time_t t; struct tm tm; int nunits; char unit[2]; t = now; if (2 != sscanf(agestr, "%d%1[DdWwMmYy]", &nunits, unit)) { fprintf(stderr, "%s: age specification should be a number followed by" " one of d,w,m,y\n", PNAME); exit(1); } if (unit[0] == 'd') { t -= 86400 * nunits; } else if (unit[0] == 'w') { t -= 86400 * 7 * nunits; } else { int ym; tm = *localtime(&t); ym = tm.tm_year * 12 + tm.tm_mon; if (unit[0] == 'm') ym -= nunits; else ym -= 12 * nunits; tm.tm_year = ym / 12; tm.tm_mon = ym % 12; t = mktime(&tm); } return t; } int main(int argc, char **argv) { int fd, count; struct ctx actx, *ctx = &actx; struct stat st; off_t totalsize, realsize; void *mappedfile; triewalk *tw; indexbuild *ib; const struct trie_file *tf, *prevtf; char *filename = PNAME ".dat"; int doing_opts = 1; enum { TEXT, HTML, SCAN, DUMP, SCANDUMP, LOAD, HTTPD, REMOVE }; struct action { int mode; char *arg; } *actions = NULL; int nactions = 0, actionsize = 0, action; time_t now = time(NULL); time_t textcutoff = now, htmlnewest = now, htmloldest = now; int htmlautoagerange = 1; const char *httpserveraddr = "localhost"; const char *httpserverport = NULL; const char *httpauthdata = NULL; const char *outfile = NULL; const char *html_title = PNAME; int auth = HTTPD_AUTH_MAGIC | HTTPD_AUTH_BASIC; int progress = 1; struct inclusion_exclusion *inex = NULL; int ninex = 0, inexsize = 0; int crossfs = 0; int depth = -1, gotdepth = 0; int fakediratimes = 1; int mtime = 0; int closeoneof = 1; int showfiles = 0; #ifdef DEBUG_MAD_OPTION_PARSING_MACROS { static const char *const optnames[NOPTIONS] = { OPTIONS(STRING,STRING,IGNORE,IGNORE) }; int i; for (i = 0; i < NSHORTOPTS; i++) printf("-%c == %s [%s]\n", shortopts[i], optnames[shortvals[i]], opthasval[shortvals[i]] ? "value" : "no value"); for (i = 0; i < NLONGOPTS; i++) printf("--%s == %s [%s]\n", longopts[i], optnames[longvals[i]], opthasval[longvals[i]] ? "value" : "no value"); } #endif while (--argc > 0) { char *p = *++argv; if (doing_opts && *p == '-') { int wordstart = 1; if (!strcmp(p, "--")) { doing_opts = 0; continue; } p++; while (*p) { int optid = -1; int i; char *optval; if (wordstart && *p == '-') { /* * GNU-style long option. */ p++; optval = strchr(p, '='); if (optval) *optval++ = '\0'; for (i = 0; i < NLONGOPTS; i++) { const char *opt = longopts[i], *s = p; int match = 1; /* * The underscores in the option names * defined above may be given by the user * as underscores or dashes, or omitted * entirely. */ while (*opt) { if (*opt == '_') { if (*s == '-' || *s == '_') s++; } else { if (*opt != *s) { match = 0; break; } s++; } opt++; } if (match && !*s) { optid = longvals[i]; break; } } if (optid < 0) { fprintf(stderr, "%s: unrecognised option '--%s'\n", PNAME, p); return 1; } if (!opthasval[optid]) { if (optval) { fprintf(stderr, "%s: unexpected argument to option" " '--%s'\n", PNAME, p); return 1; } } else { if (!optval) { if (--argc > 0) { optval = *++argv; } else { fprintf(stderr, "%s: option '--%s' expects" " an argument\n", PNAME, p); return 1; } } } p += strlen(p); /* finished with this argument word */ } else { /* * Short option. */ char c = *p++; for (i = 0; i < NSHORTOPTS; i++) if (c == shortopts[i]) { optid = shortvals[i]; break; } if (optid < 0) { fprintf(stderr, "%s: unrecognised option '-%c'\n", PNAME, c); return 1; } if (opthasval[optid]) { if (*p) { optval = p; p += strlen(p); } else if (--argc > 0) { optval = *++argv; } else { fprintf(stderr, "%s: option '-%c' expects" " an argument\n", PNAME, c); return 1; } } else { optval = NULL; } } wordstart = 0; /* * Now actually process the option. */ switch (optid) { case OPT_HELP: usage(stdout); return 0; case OPT_VERSION: #ifdef PACKAGE_VERSION printf("%s, revision %s\n", PNAME, PACKAGE_VERSION); #else printf("%s: version number not available when not built" " via automake\n", PNAME); #endif return 0; case OPT_LICENCE: { extern const char *const licence[]; int i; for (i = 0; licence[i]; i++) fputs(licence[i], stdout); } return 0; case OPT_SCAN: if (nactions >= actionsize) { actionsize = nactions * 3 / 2 + 16; actions = sresize(actions, actionsize, struct action); } actions[nactions].mode = SCAN; actions[nactions].arg = optval; nactions++; break; case OPT_SCANDUMP: if (nactions >= actionsize) { actionsize = nactions * 3 / 2 + 16; actions = sresize(actions, actionsize, struct action); } actions[nactions].mode = SCANDUMP; actions[nactions].arg = optval; nactions++; break; case OPT_DUMP: if (nactions >= actionsize) { actionsize = nactions * 3 / 2 + 16; actions = sresize(actions, actionsize, struct action); } actions[nactions].mode = DUMP; actions[nactions].arg = NULL; nactions++; break; case OPT_LOAD: if (nactions >= actionsize) { actionsize = nactions * 3 / 2 + 16; actions = sresize(actions, actionsize, struct action); } actions[nactions].mode = LOAD; actions[nactions].arg = NULL; nactions++; break; case OPT_TEXT: if (nactions >= actionsize) { actionsize = nactions * 3 / 2 + 16; actions = sresize(actions, actionsize, struct action); } actions[nactions].mode = TEXT; actions[nactions].arg = optval; nactions++; break; case OPT_HTML: case OPT_CGI: if (nactions >= actionsize) { actionsize = nactions * 3 / 2 + 16; actions = sresize(actions, actionsize, struct action); } actions[nactions].mode = HTML; actions[nactions].arg = (optid == OPT_HTML ? optval : NULL); nactions++; break; case OPT_HTTPD: if (nactions >= actionsize) { actionsize = nactions * 3 / 2 + 16; actions = sresize(actions, actionsize, struct action); } actions[nactions].mode = HTTPD; actions[nactions].arg = NULL; nactions++; break; case OPT_REMOVE: if (nactions >= actionsize) { actionsize = nactions * 3 / 2 + 16; actions = sresize(actions, actionsize, struct action); } actions[nactions].mode = REMOVE; actions[nactions].arg = NULL; nactions++; break; case OPT_PROGRESS: progress = 2; break; case OPT_NOPROGRESS: progress = 0; break; case OPT_TTYPROGRESS: progress = 1; break; case OPT_CROSSFS: crossfs = 1; break; case OPT_NOCROSSFS: crossfs = 0; break; case OPT_DIRATIME: fakediratimes = 0; break; case OPT_NODIRATIME: fakediratimes = 1; break; case OPT_SHOWFILES: showfiles = 1; break; case OPT_MTIME: mtime = 1; break; case OPT_NOEOF: closeoneof = 0; break; case OPT_DATAFILE: filename = optval; break; case OPT_DEPTH: if (!strcasecmp(optval, "unlimited") || !strcasecmp(optval, "infinity") || !strcasecmp(optval, "infinite") || !strcasecmp(optval, "inf") || !strcasecmp(optval, "maximum") || !strcasecmp(optval, "max")) depth = -1; else depth = atoi(optval); gotdepth = 1; break; case OPT_OUTFILE: outfile = optval; break; case OPT_HTMLTITLE: html_title = optval; break; case OPT_MINAGE: textcutoff = parse_age(now, optval); break; case OPT_AGERANGE: if (!strcmp(optval, "auto")) { htmlautoagerange = 1; } else { char *q = optval + strcspn(optval, "-:"); if (*q) *q++ = '\0'; htmloldest = parse_age(now, optval); htmlnewest = *q ? parse_age(now, q) : now; htmlautoagerange = 0; } break; case OPT_SERVERADDR: { char *port; if (optval[0] == '[' && (port = strchr(optval, ']')) != NULL) port++; else port = optval; port += strcspn(port, ":"); if (port && *port) *port++ = '\0'; if (!strcmp(optval, "ANY")) httpserveraddr = NULL; else httpserveraddr = optval; httpserverport = port; } break; case OPT_AUTH: if (!strcmp(optval, "magic")) auth = HTTPD_AUTH_MAGIC; else if (!strcmp(optval, "basic")) auth = HTTPD_AUTH_BASIC; else if (!strcmp(optval, "none")) auth = HTTPD_AUTH_NONE; else if (!strcmp(optval, "default")) auth = HTTPD_AUTH_MAGIC | HTTPD_AUTH_BASIC; else if (!strcmp(optval, "help") || !strcmp(optval, "list")) { printf(PNAME ": supported HTTP authentication types" " are:\n" " magic use Linux /proc/net/tcp to" " determine owner of peer socket\n" " basic HTTP Basic username and" " password authentication\n" " default use 'magic' if possible, " " otherwise fall back to 'basic'\n" " none unauthenticated HTTP (if" " the data file is non-confidential)\n"); return 0; } else { fprintf(stderr, "%s: unrecognised authentication" " type '%s'\n%*s options are 'magic'," " 'basic', 'none', 'default'\n", PNAME, optval, (int)strlen(PNAME), ""); return 1; } break; case OPT_AUTHFILE: case OPT_AUTHFD: { int fd; char namebuf[40]; const char *name; char *authbuf; int authlen, authsize; int ret; if (optid == OPT_AUTHFILE) { fd = open(optval, O_RDONLY); if (fd < 0) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, optval, strerror(errno)); return 1; } name = optval; } else { fd = atoi(optval); name = namebuf; sprintf(namebuf, "fd %d", fd); } authlen = 0; authsize = 256; authbuf = snewn(authsize, char); while ((ret = read(fd, authbuf+authlen, authsize-authlen)) > 0) { authlen += ret; if ((authsize - authlen) < (authsize / 16)) { authsize = authlen * 3 / 2 + 4096; authbuf = sresize(authbuf, authsize, char); } } if (ret < 0) { fprintf(stderr, "%s: %s: read: %s\n", PNAME, name, strerror(errno)); return 1; } if (optid == OPT_AUTHFILE) close(fd); httpauthdata = authbuf; } break; case OPT_INCLUDE: case OPT_INCLUDEPATH: case OPT_EXCLUDE: case OPT_EXCLUDEPATH: case OPT_PRUNE: case OPT_PRUNEPATH: if (ninex >= inexsize) { inexsize = ninex * 3 / 2 + 16; inex = sresize(inex, inexsize, struct inclusion_exclusion); } inex[ninex].path = (optid == OPT_INCLUDEPATH || optid == OPT_EXCLUDEPATH || optid == OPT_PRUNEPATH); inex[ninex].type = (optid == OPT_INCLUDE ? 1 : optid == OPT_INCLUDEPATH ? 1 : optid == OPT_EXCLUDE ? 0 : optid == OPT_EXCLUDEPATH ? 0 : optid == OPT_PRUNE ? -1 : /* optid == OPT_PRUNEPATH ? */ -1); inex[ninex].wildcard = optval; ninex++; break; } } } else { fprintf(stderr, "%s: unexpected argument '%s'\n", PNAME, p); return 1; } } if (nactions == 0) { usage(stderr); return 1; } for (action = 0; action < nactions; action++) { int mode = actions[action].mode; if (mode == SCAN || mode == SCANDUMP || mode == LOAD) { const char *scandir = actions[action].arg; if (mode == LOAD) { char *buf = fgetline(stdin); unsigned newpathsep; buf[strcspn(buf, "\r\n")] = '\0'; if (1 != sscanf(buf, DUMPHDR "%x", &newpathsep)) { fprintf(stderr, "%s: header in dump file not recognised\n", PNAME); return 1; } pathsep = (char)newpathsep; sfree(buf); } if (mode == SCAN || mode == LOAD) { /* * Prepare to write out the index file. */ fd = open(filename, O_RDWR | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR); if (fd < 0) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, filename, strerror(errno)); return 1; } if (fstat(fd, &st) < 0) { perror(PNAME ": fstat"); return 1; } ctx->datafile_dev = st.st_dev; ctx->datafile_ino = st.st_ino; ctx->straight_to_dump = 0; } else { ctx->datafile_dev = -1; ctx->datafile_ino = -1; ctx->straight_to_dump = 1; } if (mode == SCAN || mode == SCANDUMP) { if (stat(scandir, &st) < 0) { fprintf(stderr, "%s: %s: stat: %s\n", PNAME, scandir, strerror(errno)); return 1; } ctx->filesystem_dev = crossfs ? 0 : st.st_dev; } ctx->inex = inex; ctx->ninex = ninex; ctx->crossfs = crossfs; ctx->fakeatimes = fakediratimes; ctx->usemtime = mtime; ctx->last_output_update = time(NULL); /* progress==1 means report progress only if stderr is a tty */ if (progress == 1) progress = isatty(2) ? 2 : 0; ctx->progress = progress; { struct winsize ws; if (progress && ioctl(2, TIOCGWINSZ, &ws) == 0 && ws.ws_col > 0) ctx->progwidth = ws.ws_col - 1; else ctx->progwidth = 79; } if (mode == SCANDUMP) printf(DUMPHDR "%02x\n", (unsigned char)pathsep); /* * Scan the directory tree, and write out the trie component * of the data file. */ if (mode != SCANDUMP) { ctx->tb = triebuild_new(fd); } if (mode == LOAD) { char *buf; int line = 2; while ((buf = fgetline(stdin)) != NULL) { struct trie_file tf; char *p, *q; buf[strcspn(buf, "\r\n")] = '\0'; p = buf; q = p; while (*p && *p != ' ') p++; if (!*p) { fprintf(stderr, "%s: dump file line %d: expected at least" " three fields\n", PNAME, line); return 1; } *p++ = '\0'; tf.size = strtoull(q, NULL, 10); q = p; while (*p && *p != ' ') p++; if (!*p) { fprintf(stderr, "%s: dump file line %d: expected at least" " three fields\n", PNAME, line); return 1; } *p++ = '\0'; tf.atime = strtoull(q, NULL, 10); q = buf; while (*p) { int c = *p; if (*p == '%') { int i; p++; c = 0; for (i = 0; i < 2; i++) { c *= 16; if (*p >= '0' && *p <= '9') c += *p - '0'; else if (*p >= 'A' && *p <= 'F') c += *p - ('A' - 10); else if (*p >= 'a' && *p <= 'f') c += *p - ('a' - 10); else { fprintf(stderr, "%s: dump file line %d: unable" " to parse hex escape\n", PNAME, line); } p++; } } else { p++; } *q++ = c; } *q = '\0'; triebuild_add(ctx->tb, buf, &tf); sfree(buf); line++; } } else { du(scandir, gotdata, scan_error, ctx); } if (mode != SCANDUMP) { size_t maxpathlen; size_t delta; char *buf, *prevbuf; count = triebuild_finish(ctx->tb); triebuild_free(ctx->tb); if (ctx->progress) { fprintf(stderr, "%-*s\r", ctx->progwidth, ""); fflush(stderr); } /* * Work out how much space the cumulative index trees * will take; enlarge the file, and memory-map it. */ if (fstat(fd, &st) < 0) { perror(PNAME ": fstat"); return 1; } printf("Built pathname index, %d entries," " %llu bytes of index\n", count, (unsigned long long)st.st_size); totalsize = index_initial_size(st.st_size, count); totalsize += totalsize / 10; if (lseek(fd, totalsize-1, SEEK_SET) < 0) { perror(PNAME ": lseek"); return 1; } if (write(fd, "\0", 1) < 1) { perror(PNAME ": write"); return 1; } mappedfile = mmap(NULL, totalsize, PROT_READ|PROT_WRITE,MAP_SHARED, fd, 0); if (!mappedfile) { perror(PNAME ": mmap"); return 1; } if (fakediratimes) { printf("Faking directory atimes\n"); trie_fake_dir_atimes(mappedfile); } printf("Building index\n"); ib = indexbuild_new(mappedfile, st.st_size, count, &delta); maxpathlen = trie_maxpathlen(mappedfile); buf = snewn(maxpathlen, char); prevbuf = snewn(maxpathlen, char); tw = triewalk_new(mappedfile); prevbuf[0] = '\0'; tf = triewalk_next(tw, buf); assert(tf); while (1) { int i; if (totalsize - indexbuild_realsize(ib) < delta) { const void *oldfile = mappedfile; ptrdiff_t diff; /* * Unmap the file, grow it, and remap it. */ munmap(mappedfile, totalsize); totalsize += delta; totalsize += totalsize / 10; if (lseek(fd, totalsize-1, SEEK_SET) < 0) { perror(PNAME ": lseek"); return 1; } if (write(fd, "\0", 1) < 1) { perror(PNAME ": write"); return 1; } mappedfile = mmap(NULL, totalsize, PROT_READ|PROT_WRITE,MAP_SHARED, fd, 0); if (!mappedfile) { perror(PNAME ": mmap"); return 1; } indexbuild_rebase(ib, mappedfile); triewalk_rebase(tw, mappedfile); diff = (const unsigned char *)mappedfile - (const unsigned char *)oldfile; if (tf) tf = (const struct trie_file *) (((const unsigned char *)tf) + diff); } /* * Get the next file from the index. So we are * currently holding, and have not yet * indexed, prevtf (with pathname prevbuf) and * tf (with pathname buf). */ prevtf = tf; memcpy(prevbuf, buf, maxpathlen); tf = triewalk_next(tw, buf); if (!tf) buf[0] = '\0'; /* * Find the first differing character position * between our two pathnames. */ for (i = 0; prevbuf[i] && prevbuf[i] == buf[i]; i++); /* * If prevbuf was a directory name and buf is * something inside that directory, then * trie_before() will be called on prevbuf * itself. Hence we must drop a tag before it, * so that the resulting index is usable. */ if ((!prevbuf[i] && (buf[i] == pathsep || (i > 0 && buf[i-1] == pathsep)))) indexbuild_tag(ib); /* * Add prevtf to the index. */ indexbuild_add(ib, prevtf); if (!tf) { /* * Drop an unconditional final tag, and * get out of this loop. */ indexbuild_tag(ib); break; } /* * If prevbuf was a filename inside some * directory which buf is outside, then * trie_before() will be called on some * pathname either equal to buf or epsilon * less than it. Either way, we're going to * need to drop a tag after prevtf. */ if (strchr(prevbuf+i, pathsep) || !tf) indexbuild_tag(ib); } triewalk_free(tw); realsize = indexbuild_realsize(ib); indexbuild_free(ib); munmap(mappedfile, totalsize); if (ftruncate(fd, realsize) < 0) fatal("%s: truncate: %s\n", filename, strerror(errno)); close(fd); printf("Final index file size = %llu bytes\n", (unsigned long long)realsize); } } else if (mode == TEXT) { char *querydir = actions[action].arg; size_t pathlen; fd = open(filename, O_RDONLY); if (fd < 0) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, filename, strerror(errno)); return 1; } if (fstat(fd, &st) < 0) { perror(PNAME ": fstat"); return 1; } totalsize = st.st_size; mappedfile = mmap(NULL, totalsize, PROT_READ, MAP_SHARED, fd, 0); if (!mappedfile) { perror(PNAME ": mmap"); return 1; } if (!trie_check_magic(mappedfile)) { fprintf(stderr, "%s: %s: magic numbers did not match\n" "%s: check that the index was built by this version of agedu on this platform\n", PNAME, filename, PNAME); return 1; } pathsep = trie_pathsep(mappedfile); /* * Trim trailing slash, just in case. */ pathlen = strlen(querydir); if (pathlen > 0 && querydir[pathlen-1] == pathsep) querydir[--pathlen] = '\0'; if (!gotdepth) depth = 1; /* default for text mode */ if (outfile != NULL) { FILE *fp = fopen(outfile, "w"); if (!fp) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, outfile, strerror(errno)); return 1; } text_query(mappedfile, querydir, textcutoff, showfiles, depth, fp); fclose(fp); } else { text_query(mappedfile, querydir, textcutoff, showfiles, depth, stdout); } munmap(mappedfile, totalsize); } else if (mode == HTML) { char *querydir = actions[action].arg; size_t pathlen, maxpathlen; char *pathbuf; struct html_config cfg; unsigned long xi; char *html; fd = open(filename, O_RDONLY); if (fd < 0) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, filename, strerror(errno)); if (!querydir) { printf("Status: 500\nContent-type: text/html\n\n" "" "500 Internal Server Error" "" "

500 Internal Server Error

" "

agedu suffered an internal error." "\n"); return 0; } return 1; } if (fstat(fd, &st) < 0) { fprintf(stderr, "%s: %s: fstat: %s\n", PNAME, filename, strerror(errno)); if (!querydir) { printf("Status: 500\nContent-type: text/html\n\n" "" "500 Internal Server Error" "" "

500 Internal Server Error

" "

agedu suffered an internal error." "\n"); return 0; } return 1; } totalsize = st.st_size; mappedfile = mmap(NULL, totalsize, PROT_READ, MAP_SHARED, fd, 0); if (!mappedfile) { fprintf(stderr, "%s: %s: mmap: %s\n", PNAME, filename, strerror(errno)); if (!querydir) { printf("Status: 500\nContent-type: text/html\n\n" "" "500 Internal Server Error" "" "

500 Internal Server Error

" "

agedu suffered an internal error." "\n"); return 0; } return 1; } if (!trie_check_magic(mappedfile)) { fprintf(stderr, "%s: %s: magic numbers did not match\n" "%s: check that the index was built by this version of agedu on this platform\n", PNAME, filename, PNAME); if (!querydir) { printf("Status: 500\nContent-type: text/html\n\n" "" "500 Internal Server Error" "" "

500 Internal Server Error

" "

agedu suffered an internal error." "\n"); return 0; } return 1; } pathsep = trie_pathsep(mappedfile); maxpathlen = trie_maxpathlen(mappedfile); pathbuf = snewn(maxpathlen, char); if (!querydir || !gotdepth) { /* * Single output file. */ if (!querydir) { cfg.uriformat = "/%|/%p/%|%|/%p"; } else { cfg.uriformat = NULL; } cfg.autoage = htmlautoagerange; cfg.oldest = htmloldest; cfg.newest = htmlnewest; cfg.showfiles = showfiles; } else { cfg.uriformat = "/index.html%|/%/p.html"; cfg.fileformat = "/index.html%|/%/p.html"; cfg.autoage = htmlautoagerange; cfg.oldest = htmloldest; cfg.newest = htmlnewest; cfg.showfiles = showfiles; } cfg.html_title = html_title; if (!querydir) { /* * If we're run in --cgi mode, read PATH_INFO to get * a numeric pathname index. */ char *path_info = getenv("PATH_INFO"); if (!path_info) path_info = ""; /* * Parse the path. */ if (!html_parse_path(mappedfile, path_info, &cfg, &xi)) { printf("Status: 404\nContent-type: text/html\n\n" "" "404 Not Found" "" "

400 Not Found

" "

Invalid agedu pathname." "\n"); return 0; } /* * If the path was parseable but not canonically * expressed, return a redirect to the canonical * version. */ char *canonpath = html_format_path(mappedfile, &cfg, xi); if (strcmp(canonpath, path_info)) { char *servername = getenv("SERVER_NAME"); char *scriptname = getenv("SCRIPT_NAME"); if (!servername || !scriptname) { if (servername) fprintf(stderr, "%s: SCRIPT_NAME unset\n", PNAME); else if (scriptname) fprintf(stderr, "%s: SCRIPT_NAME unset\n", PNAME); else fprintf(stderr, "%s: SERVER_NAME and " "SCRIPT_NAME both unset\n", PNAME); printf("Status: 500\nContent-type: text/html\n\n" "" "500 Internal Server Error" "" "

500 Internal Server Error

" "

agedu suffered an internal " "error." "\n"); return 0; } printf("Status: 301\n" "Location: http://%s/%s%s\n" "Content-type: text/html\n\n" "" "301 Moved" "" "

301 Moved

" "

Moved." "\n", servername, scriptname, canonpath); return 0; } } else { /* * In ordinary --html mode, process a query * directory passed in on the command line. */ /* * Trim trailing slash, just in case. */ pathlen = strlen(querydir); if (pathlen > 0 && querydir[pathlen-1] == pathsep) querydir[--pathlen] = '\0'; xi = trie_before(mappedfile, querydir); if (xi >= trie_count(mappedfile) || (trie_getpath(mappedfile, xi, pathbuf), strcmp(pathbuf, querydir))) { fprintf(stderr, "%s: pathname '%s' does not exist in index\n" "%*s(check it is spelled exactly as it is in the " "index, including\n%*sany leading './')\n", PNAME, querydir, (int)(1+sizeof(PNAME)), "", (int)(1+sizeof(PNAME)), ""); return 1; } else if (!index_has_root(mappedfile, xi)) { fprintf(stderr, "%s: pathname '%s' is" " a file, not a directory\n", PNAME, querydir); return 1; } } if (!querydir || !gotdepth) { /* * Single output file. */ html = html_query(mappedfile, xi, &cfg, 1); if (querydir && outfile != NULL) { FILE *fp = fopen(outfile, "w"); if (!fp) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, outfile, strerror(errno)); return 1; } else if (fputs(html, fp) < 0) { fprintf(stderr, "%s: %s: write: %s\n", PNAME, outfile, strerror(errno)); fclose(fp); return 1; } else if (fclose(fp) < 0) { fprintf(stderr, "%s: %s: fclose: %s\n", PNAME, outfile, strerror(errno)); return 1; } } else { if (!querydir) { printf("Content-type: text/html\n\n"); } fputs(html, stdout); } } else { /* * Multiple output files. */ int dirlen = outfile ? 2+strlen(outfile) : 3; char prefix[dirlen]; if (outfile) { if (mkdir(outfile, 0777) < 0 && errno != EEXIST) { fprintf(stderr, "%s: %s: mkdir: %s\n", PNAME, outfile, strerror(errno)); return 1; } snprintf(prefix, dirlen, "%s/", outfile); } else snprintf(prefix, dirlen, "./"); unsigned long xi2; /* * pathbuf is only set up in the plain-HTML case and * not in the CGI case; but that's OK, because the * CGI case can't come to this branch of the if * anyway. */ make_successor(pathbuf); xi2 = trie_before(mappedfile, pathbuf); if (html_dump(mappedfile, xi, xi2, depth, &cfg, prefix)) return 1; } munmap(mappedfile, totalsize); sfree(pathbuf); } else if (mode == DUMP) { size_t maxpathlen; char *buf; fd = open(filename, O_RDONLY); if (fd < 0) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, filename, strerror(errno)); return 1; } if (fstat(fd, &st) < 0) { perror(PNAME ": fstat"); return 1; } totalsize = st.st_size; mappedfile = mmap(NULL, totalsize, PROT_READ, MAP_SHARED, fd, 0); if (!mappedfile) { perror(PNAME ": mmap"); return 1; } if (!trie_check_magic(mappedfile)) { fprintf(stderr, "%s: %s: magic numbers did not match\n" "%s: check that the index was built by this version of agedu on this platform\n", PNAME, filename, PNAME); return 1; } pathsep = trie_pathsep(mappedfile); maxpathlen = trie_maxpathlen(mappedfile); buf = snewn(maxpathlen, char); printf(DUMPHDR "%02x\n", (unsigned char)pathsep); tw = triewalk_new(mappedfile); while ((tf = triewalk_next(tw, buf)) != NULL) dump_line(buf, tf); triewalk_free(tw); munmap(mappedfile, totalsize); } else if (mode == HTTPD) { struct html_config pcfg; struct httpd_config dcfg; fd = open(filename, O_RDONLY); if (fd < 0) { fprintf(stderr, "%s: %s: open: %s\n", PNAME, filename, strerror(errno)); return 1; } if (fstat(fd, &st) < 0) { perror(PNAME ": fstat"); return 1; } totalsize = st.st_size; mappedfile = mmap(NULL, totalsize, PROT_READ, MAP_SHARED, fd, 0); if (!mappedfile) { perror(PNAME ": mmap"); return 1; } if (!trie_check_magic(mappedfile)) { fprintf(stderr, "%s: %s: magic numbers did not match\n" "%s: check that the index was built by this version of agedu on this platform\n", PNAME, filename, PNAME); return 1; } pathsep = trie_pathsep(mappedfile); dcfg.address = httpserveraddr; dcfg.port = httpserverport; dcfg.closeoneof = closeoneof; dcfg.basicauthdata = httpauthdata; pcfg.uriformat = "/%|/%p/%|%|/%p"; pcfg.autoage = htmlautoagerange; pcfg.oldest = htmloldest; pcfg.newest = htmlnewest; pcfg.showfiles = showfiles; pcfg.html_title = html_title; run_httpd(mappedfile, auth, &dcfg, &pcfg); munmap(mappedfile, totalsize); } else if (mode == REMOVE) { if (remove(filename) < 0) { fprintf(stderr, "%s: %s: remove: %s\n", PNAME, filename, strerror(errno)); return 1; } } } return 0; } agedu-r9723/Buildscr0000644000175300017530000000210212163703774013470 0ustar simonsimon# -*- sh -*- # # bob script to build the agedu tarball. module agedu in agedu do sed '/AC_INIT/s/6.66/r$(revision)/' configure.ac > tmp.ac in agedu do mv tmp.ac configure.ac in agedu do ./mkauto.sh # Build the man page. This also tests the automake setup to ensure # configure actually works; but we use a self-delegation (i.e. do all # of this in a throwaway copy of the build directory) to avoid # accidentally shipping any outputs of configure. Instead we return # only the actual man page from the delegation environment. delegate - in agedu do ./configure in agedu do make doc return agedu/*.1 enddelegate in . do cp -R agedu agedu-r$(revision) in . do tar chzvf agedu-r$(revision).tar.gz agedu-r$(revision) in agedu do halibut --html=manpage.html agedu.but in agedu do halibut --html=tree.html tree.but deliver agedu-r$(revision).tar.gz $@ deliver agedu/manpage.html $@ deliver agedu/tree.html $@ delegate windows # FIXME: Cygwin alternative? in agedu do cmd /c vcvars32 \& cl winscan.c return agedu/winscan.exe enddelegate deliver agedu/winscan.exe ageduscan.exe agedu-r9723/Makefile.am0000644000175300017530000000123312163703774014036 0ustar simonsimonbin_PROGRAMS = agedu agedu_SOURCES = agedu.c du.c alloc.c trie.c index.c html.c httpd.c \ fgetline.c licence.c agedu_LDADD = $(LIBOBJS) man1_MANS = agedu.1 # If Halibut is available to rebuild the man pages from their .but # source, then man pages are treated as derived files in the obvious # way, and deleted by 'make clean'. If Halibut is not available (the # typical case if someone has downloaded the source archive and rerun # mkauto.sh), the man pages are treated as source files by this # makefile. if HAVE_HALIBUT BUILT_MANS = $(man1_MANS) CLEANFILES = $(BUILT_MANS) .SUFFIXES = .but .1 .but.1: halibut --man=$@ $< doc: $(BUILT_MANS) endif agedu-r9723/httpd.h0000644000175300017530000000063212163703774013300 0ustar simonsimon/* * httpd.h: a minimal custom HTTP server designed to serve the * pages generated by html.h. */ #define HTTPD_AUTH_MAGIC 1 #define HTTPD_AUTH_BASIC 2 #define HTTPD_AUTH_NONE 4 struct httpd_config { const char *address, *port; int closeoneof; const char *basicauthdata; }; void run_httpd(const void *t, int authmask, const struct httpd_config *dcfg, const struct html_config *pcfg); agedu-r9723/mkauto.sh0000755000175300017530000000006112163703774013637 0ustar simonsimon#!/bin/sh autoreconf -i && rm -rf autom4te.cache agedu-r9723/alloc.c0000644000175300017530000000535212163703774013246 0ustar simonsimon/* * alloc.c: implementation of alloc.h */ #include "agedu.h" #include "alloc.h" extern void fatal(const char *, ...); void *smalloc(size_t size) { void *p; p = malloc(size); if (!p) { fatal("out of memory"); } return p; } void sfree(void *p) { if (p) { free(p); } } void *srealloc(void *p, size_t size) { void *q; if (p) { q = realloc(p, size); } else { q = malloc(size); } if (!q) fatal("out of memory"); return q; } char *dupstr(const char *s) { char *r = smalloc(1+strlen(s)); strcpy(r,s); return r; } char *dupfmt(const char *fmt, ...) { int pass; int totallen; char *ret = NULL, *rp = NULL; char datebuf[80]; va_list ap; time_t t; struct tm tm; int got_time = 0; datebuf[0] = '\0'; totallen = 0; for (pass = 0; pass < 2; pass++) { const char *p = fmt; va_start(ap, fmt); while (*p) { const char *data = NULL; int datalen = 0, stuffcr = 0, htmlesc = 0; if (*p == '%') { p++; if (*p == 'D') { if (!datebuf[0]) { if (!got_time) { t = time(NULL); tm = *gmtime(&t); got_time = 1; } strftime(datebuf, lenof(datebuf), "%a, %d %b %Y %H:%M:%S GMT", &tm); } data = datebuf; datalen = strlen(data); } else if (*p == 'd') { int i = va_arg(ap, int); sprintf(datebuf, "%d", i); data = datebuf; datalen = strlen(data); } else if (*p == 's') { data = va_arg(ap, const char *); datalen = strlen(data); } else if (*p == 'h') { htmlesc = 1; data = va_arg(ap, const char *); datalen = strlen(data); } else if (assert(*p == 'S'), 1) { stuffcr = va_arg(ap, int); data = va_arg(ap, const char *); datalen = strlen(data); } p++; } else { data = p; while (*p && *p != '%') p++; datalen = p - data; } if (pass == 0) { while (datalen > 0) { totallen++; if (stuffcr && *data == '\n') totallen++; if (htmlesc && (*data == '<' || *data == '>' || *data == '&')) totallen += 4; /* max(len("gt;"),len("amp;")) */ data++, datalen--; } } else { while (datalen > 0) { if (htmlesc && (*data < 32 || *data >= 127)) *rp++ = '?'; /* *shrug* */ else if (htmlesc && *data == '<') rp += sprintf(rp, "<"); else if (htmlesc && *data == '>') rp += sprintf(rp, ">"); else if (htmlesc && *data == '&') rp += sprintf(rp, "&"); else if (stuffcr && *data == '\n') *rp++ = '\r', *rp++ = '\n'; else *rp++ = *data; data++, datalen--; } } } va_end(ap); if (pass == 0) { rp = ret = snewn(totallen+1, char); } else { assert(rp - ret == totallen); *rp = '\0'; } } return ret; } agedu-r9723/agedu.h0000644000175300017530000000426212163703774013245 0ustar simonsimon/* * Central header file for agedu, defining various useful things. */ #include "config.h" #ifdef HAVE_FEATURES_H #define _GNU_SOURCE #include #endif #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_ERRNO_H # include #endif #ifdef HAVE_TIME_H # include #endif #ifdef HAVE_ASSERT_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STDARG_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STDDEF_H # include #endif #ifdef HAVE_LIMITS_H # include #endif #ifdef HAVE_CTYPE_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_FCNTL_H # include #endif #ifdef HAVE_SYS_MMAN_H # include #endif #ifdef HAVE_TERMIOS_H # include #endif #ifdef HAVE_SYS_IOCTL_H # include #endif #ifdef HAVE_FNMATCH_H # include #endif #ifdef HAVE_PWD_H # include #endif #ifdef HAVE_SYS_WAIT_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_ARPA_INET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_SYSLOG_H # include #endif #ifdef HAVE_SYS_SELECT_H # include #endif #ifdef HAVE_NETDB_H # include #endif #ifndef HOST_NAME_MAX /* Reportedly at least one Solaris fails to comply with its POSIX * requirement to define this (see POSIX spec for gethostname) */ #define HOST_NAME_MAX 255 /* upper bound specified in SUS */ #endif #define PNAME "agedu" #define DUMPHDR "agedu dump file. pathsep=" #define lenof(x) (sizeof((x))/sizeof(*(x))) extern char pathsep; #if defined HAVE_LSTAT64 && HAVE_STAT64 #define STRUCT_STAT struct stat64 #define LSTAT_FUNC lstat64 #define STAT_FUNC stat64 #else #define STRUCT_STAT struct stat #define LSTAT_FUNC lstat #define STAT_FUNC stat #endif #define max(x,y) ( (x) > (y) ? (x) : (y) ) #define min(x,y) ( (x) < (y) ? (x) : (y) ) agedu-r9723/fgetline.c0000644000175300017530000000104112163703774013740 0ustar simonsimon/* * fgetline.c: implementation of fgetline.h. */ #include "agedu.h" #include "alloc.h" #include "fgetline.h" char *fgetline(FILE *fp) { char *ret = snewn(512, char); int size = 512, len = 0; while (fgets(ret + len, size - len, fp)) { len += strlen(ret + len); if (ret[len-1] == '\n') break; /* got a newline, we're done */ size = len + 512; ret = sresize(ret, size, char); } if (len == 0) { /* first fgets returned NULL */ sfree(ret); return NULL; } ret[len] = '\0'; return ret; } agedu-r9723/agedu.but0000644000175300017530000007344412163703774013620 0ustar simonsimon\cfg{man-identity}{agedu}{1}{2008-11-02}{Simon Tatham}{Simon Tatham} \define{dash} \u2013{-} \title Man page for \cw{agedu} \U NAME \cw{agedu} \dash correlate disk usage with last-access times to identify large and disused data \U SYNOPSIS \c agedu [ options ] action [action...] \e bbbbb iiiiiii iiiiii iiiiii \U DESCRIPTION \cw{agedu} scans a directory tree and produces reports about how much disk space is used in each directory and subdirectory, and also how that usage of disk space corresponds to files with last-access times a long time ago. In other words, \cw{agedu} is a tool you might use to help you free up disk space. It lets you see which directories are taking up the most space, as \cw{du} does; but unlike \cw{du}, it also distinguishes between large collections of data which are still in use and ones which have not been accessed in months or years \dash for instance, large archives downloaded, unpacked, used once, and never cleaned up. Where \cw{du} helps you find what's using your disk space, \cw{agedu} helps you find what's \e{wasting} your disk space. \cw{agedu} has several operating modes. In one mode, it scans your disk and builds an index file containing a data structure which allows it to efficiently retrieve any information it might need. Typically, you would use it in this mode first, and then run it in one of a number of \q{query} modes to display a report of the disk space usage of a particular directory and its subdirectories. Those reports can be produced as plain text (much like \cw{du}) or as HTML. \cw{agedu} can even run as a miniature web server, presenting each directory's HTML report with hyperlinks to let you navigate around the file system to similar reports for other directories. So you would typically start using \cw{agedu} by telling it to do a scan of a directory tree and build an index. This is done with a command such as \c $ agedu -s /home/fred \e bbbbbbbbbbbbbbbbbbb which will build a large data file called \c{agedu.dat} in your current directory. (If that current directory is \e{inside} \cw{/home/fred}, don't worry \dash \cw{agedu} is smart enough to discount its own index file.) Having built the index, you would now query it for reports of disk space usage. If you have a graphical web browser, the simplest and nicest way to query the index is by running \cw{agedu} in web server mode: \c $ agedu -w \e bbbbbbbb which will print (among other messages) a URL on its standard output along the lines of \c URL: http://127.0.0.1:48638/ (That URL will always begin with \cq{127.}, meaning that it's in the \cw{localhost} address space. So only processes running on the same computer can even try to connect to that web server, and also there is access control to prevent other users from seeing it \dash see below for more detail.) Now paste that URL into your web browser, and you will be shown a graphical representation of the disk usage in \cw{/home/fred} and its immediate subdirectories, with varying colours used to show the difference between disused and recently-accessed data. Click on any subdirectory to descend into it and see a report for its subdirectories in turn; click on parts of the pathname at the top of any page to return to higher-level directories. When you've finished browsing, you can just press Ctrl-D to send an end-of-file indication to \cw{agedu}, and it will shut down. After that, you probably want to delete the data file \cw{agedu.dat}, since it's pretty large. In fact, the command \cw{agedu -R} will do this for you; and you can chain \cw{agedu} commands on the same command line, so that instead of the above you could have done \c $ agedu -s /home/fred -w -R \e bbbbbbbbbbbbbbbbbbbbbbbbb for a single self-contained run of \cw{agedu} which builds its index, serves web pages from it, and cleans it up when finished. If you don't have a graphical web browser, you can do text-based queries as well. Having scanned \cw{/home/fred} as above, you might run \c $ agedu -t /home/fred \e bbbbbbbbbbbbbbbbbbb which again gives a summary of the disk usage in \cw{/home/fred} and its immediate subdirectories; but this time \cw{agedu} will print it on standard output, in much the same format as \cw{du}. If you then want to find out how much \e{old} data is there, you can add the \cw{-a} option to show only files last accessed a certain length of time ago. For example, to show only files which haven't been looked at in six months or more: \c $ agedu -t /home/fred -a 6m \e bbbbbbbbbbbbbbbbbbbbbbbbb That's the essence of what \cw{agedu} does. It has other modes of operation for more complex situations, and the usual array of configurable options. The following sections contain a complete reference for all its functionality. \U OPERATING MODES This section describes the operating modes supported by \cw{agedu}. Each of these is in the form of a command-line option, sometimes with an argument. Multiple operating-mode options may appear on the command line, in which case \cw{agedu} will perform the specified actions one after another. For instance, as shown in the previous section, you might want to perform a disk scan and immediately launch a web server giving reports from that scan. \dt \cw{-s} \e{directory} or \cw{--scan} \e{directory} \dd In this mode, \cw{agedu} scans the file system starting at the specified directory, and indexes the results of the scan into a large data file which other operating modes can query. \lcont{ By default, the scan is restricted to a single file system (since the expected use of \cw{agedu} is that you would probably use it because a particular disk partition was running low on space). You can remove that restriction using the \cw{--cross-fs} option; other configuration options allow you to include or exclude files or entire subdirectories from the scan. See the next section for full details of the configurable options. The index file is created with restrictive permissions, in case the file system you are scanning contains confidential information in its structure. Index files are dependent on the characteristics of the CPU architecture you created them on. You should not expect to be able to move an index file between different types of computer and have it continue to work. If you need to transfer the results of a disk scan to a different kind of computer, see the \cw{-D} and \cw{-L} options below. } \dt \cw{-w} or \cw{--web} \dd In this mode, \cw{agedu} expects to find an index file already written. It allocates a network port, and starts up a web server on that port which serves reports generated from the index file. By default it invents its own URL and prints it out. \lcont{ The web server runs until \cw{agedu} receives an end-of-file event on its standard input. (The expected usage is that you run it from the command line, immediately browse web pages until you're satisfied, and then press Ctrl-D.) To disable the EOF behaviour, use the \cw{--no-eof} option. In case the index file contains any confidential information about your file system, the web server protects the pages it serves from access by other people. On Linux, this is done transparently by means of using \cw{/proc/net/tcp} to check the owner of each incoming connection; failing that, the web server will require a password to view the reports, and \cw{agedu} will print the password it invented on standard output along with the URL. Configurable options for this mode let you specify your own address and port number to listen on, and also specify your own choice of authentication method (including turning authentication off completely) and a username and password of your choice. } \dt \cw{-t} \e{directory} or \cw{--text} \e{directory} \dd In this mode, \cw{agedu} generates a textual report on standard output, listing the disk usage in the specified directory and all its subdirectories down to a given depth. By default that depth is 1, so that you see a report for \e{directory} itself and all of its immediate subdirectories. You can configure a different depth (or no depth limit) using \cw{-d}, described in the next section. \lcont{ Used on its own, \cw{-t} merely lists the \e{total} disk usage in each subdirectory; \cw{agedu}'s additional ability to distinguish unused from recently-used data is not activated. To activate it, use the \cw{-a} option to specify a minimum age. The directory structure stored in \cw{agedu}'s index file is treated as a set of literal strings. This means that you cannot refer to directories by synonyms. So if you ran \cw{agedu -s .}, then all the path names you later pass to the \cw{-t} option must be either \cq{.} or begin with \cq{./}. Similarly, symbolic links within the directory you scanned will not be followed; you must refer to each directory by its canonical, symlink-free pathname. } \dt \cw{-R} or \cw{--remove} \dd In this mode, \cw{agedu} deletes its index file. Running just \cw{agedu -R} on its own is therefore equivalent to typing \cw{rm agedu.dat}. However, you can also put \cw{-R} on the end of a command line to indicate that \cw{agedu} should delete its index file after it finishes performing other operations. \dt \cw{-D} or \cw{--dump} \dd In this mode, \cw{agedu} reads an existing index file and produces a dump of its contents on standard output. This dump can later be loaded into a new index file, perhaps on another computer. \dt \cw{-L} or \cw{--load} \dd In this mode, \cw{agedu} expects to read a dump produced by the \cw{-D} option from its standard input. It constructs an index file from that dump, exactly as it would have if it had read the same data from a disk scan in \cw{-s} mode. \dt \cw{-S} \e{directory} or \cw{--scan-dump} \e{directory} \dd In this mode, \cw{agedu} will scan a directory tree and convert the results straight into a dump on standard output, without generating an index file at all. So running \cw{agedu -S /path} should produce equivalent output to that of \cw{agedu -s /path -D}, except that the latter will produce an index file as a side effect whereas \cw{-S} will not. \lcont{ (The output will not be exactly \e{identical}, due to a difference in treatment of last-access times on directories. However, it should be effectively equivalent for most purposes. See the documentation of the \cw{--dir-atime} option in the next section for further detail.) } \dt \cw{-H} \e{directory} or \cw{--html} \e{directory} \dd In this mode, \cw{agedu} will generate an HTML report of the disk usage in the specified directory and its immediate subdirectories, in the same form that it serves from its web server in \cw{-w} mode. \lcont{ By default, a single HTML report will be generated and simply written to standard output, with no hyperlinks pointing to other similar pages. If you also specify the \cw{-d} option (see below), \cw{agedu} will instead write out a collection of HTML files with hyperlinks between them, and call the top-level file \cw{index.html}. } \dt \cw{--cgi} \dd In this mode, \cw{agedu} will run as the bulk of a CGI script which provides the same set of web pages as the built-in web server would. It will read the usual CGI environment variables, and write CGI-style data to its standard output. \lcont{ The actual CGI program itself should be a tiny wrapper around \cw{agedu} which passes it the \cw{--cgi} option, and also (probably) \cw{-f} to locate the index file. \cw{agedu} will do everything else. No access control is performed in this mode: restricting access to CGI scripts is assumed to be the job of the web server. } \dt \cw{-h} or \cw{--help} \dd Causes \cw{agedu} to print some help text and terminate immediately. \dt \cw{-V} or \cw{--version} \dd Causes \cw{agedu} to print its version number and terminate immediately. \U OPTIONS This section describes the various configuration options that affect \cw{agedu}'s operation in one mode or another. The following option affects nearly all modes (except \cw{-S}): \dt \cw{-f} \e{filename} or \cw{--file} \e{filename} \dd Specifies the location of the index file which \cw{agedu} creates, reads or removes depending on its operating mode. By default, this is simply \cq{agedu.dat}, in whatever is the current working directory when you run \cw{agedu}. The following options affect the disk-scanning modes, \cw{-s} and \cw{-S}: \dt \cw{--cross-fs} and \cw{--no-cross-fs} \dd These configure whether or not the disk scan is permitted to cross between different file systems. The default is not to: \cw{agedu} will normally skip over subdirectories on which a different file system is mounted. This makes it convenient when you want to free up space on a particular file system which is running low. However, in other circumstances you might wish to see general information about the use of space no matter which file system it's on (for instance, if your real concern is your backup media running out of space, and if your backups do not treat different file systems specially); in that situation, use \cw{--cross-fs}. \lcont{ (Note that this default is the opposite way round from the corresponding option in \cw{du}.) } \dt \cw{--prune} \e{wildcard} and \cw{--prune-path} \e{wildcard} \dd These cause particular files or directories to be omitted entirely from the scan. If \cw{agedu}'s scan encounters a file or directory whose name matches the wildcard provided to the \cw{--prune} option, it will not include that file in its index, and also if it's a directory it will skip over it and not scan its contents. \lcont{ Note that in most Unix shells, wildcards will probably need to be escaped on the command line, to prevent the shell from expanding the wildcard before \cw{agedu} sees it. \cw{--prune-path} is similar to \cw{--prune}, except that the wildcard is matched against the entire pathname instead of just the filename at the end of it. So whereas \cw{--prune *a*b*} will match any file whose actual name contains an \cw{a} somewhere before a \cw{b}, \cw{--prune-path *a*b*} will also match a file whose name contains \cw{b} and which is inside a directory containing an \cw{a}, or any file inside a directory of that form, and so on. } \dt \cw{--exclude} \e{wildcard} and \cw{--exclude-path} \e{wildcard} \dd These cause particular files or directories to be omitted from the index, but not from the scan. If \cw{agedu}'s scan encounters a file or directory whose name matches the wildcard provided to the \cw{--exclude} option, it will not include that file in its index \dash but unlike \cw{--prune}, if the file in question is a directory it will still scan its contents and index them if they are not ruled out themselves by \cw{--exclude} options. \lcont{ As above, \cw{--exclude-path} is similar to \cw{--exclude}, except that the wildcard is matched against the entire pathname. } \dt \cw{--include} \e{wildcard} and \cw{--include-path} \e{wildcard} \dd These cause particular files or directories to be re-included in the index and the scan, if they had previously been ruled out by one of the above exclude or prune options. You can interleave include, exclude and prune options as you wish on the command line, and if more than one of them applies to a file then the last one takes priority. \lcont{ For example, if you wanted to see only the disk space taken up by MP3 files, you might run \c $ agedu -s . --exclude '*' --include '*.mp3' \e bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb which will cause everything to be omitted from the scan, but then the MP3 files to be put back in. If you then wanted only a subset of those MP3s, you could then exclude some of them again by adding, say, \cq{--exclude-path './queen/*'} (or, more efficiently, \cq{--prune ./queen}) on the end of that command. As with the previous two options, \cw{--include-path} is similar to \cw{--include} except that the wildcard is matched against the entire pathname. } \dt \cw{--progress}, \cw{--no-progress} and \cw{--tty-progress} \dd When \cw{agedu} is scanning a directory tree, it will typically print a one-line progress report every second showing where it has reached in the scan, so you can have some idea of how much longer it will take. (Of course, it can't predict \e{exactly} how long it will take, since it doesn't know which of the directories it hasn't scanned yet will turn out to be huge.) \lcont{ By default, those progress reports are displayed on \cw{agedu}'s standard error channel, if that channel points to a terminal device. If you need to manually enable or disable them, you can use the above three options to do so: \cw{--progress} unconditionally enables the progress reports, \cw{--no-progress} unconditionally disables them, and \cw{--tty-progress} reverts to the default behaviour which is conditional on standard error being a terminal. } \dt \cw{--dir-atime} and \cw{--no-dir-atime} \dd In normal operation, \cw{agedu} ignores the atimes (last access times) on the \e{directories} it scans: it only pays attention to the atimes of the \e{files} inside those directories. This is because directory atimes tend to be reset by a lot of system administrative tasks, such as \cw{cron} jobs which scan the file system for one reason or another \dash or even other invocations of \cw{agedu} itself, though it tries to avoid modifying any atimes if possible. So the literal atimes on directories are typically not representative of how long ago the data in question was last accessed with real intent to use that data in particular. \lcont{ Instead, \cw{agedu} makes up a fake atime for every directory it scans, which is equal to the newest atime of any file in or below that directory (or the directory's last \e{modification} time, whichever is newest). This is based on the assumption that all \e{important} accesses to directories are actually accesses to the files inside those directories, so that when any file is accessed all the directories on the path leading to it should be considered to have been accessed as well. In unusual cases it is possible that a directory itself might embody important data which is accessed by reading the directory. In that situation, \cw{agedu}'s atime-faking policy will misreport the directory as disused. In the unlikely event that such directories form a significant part of your disk space usage, you might want to turn off the faking. The \cw{--dir-atime} option does this: it causes the disk scan to read the original atimes of the directories it scans. The faking of atimes on directories also requires a processing pass over the index file after the main disk scan is complete. \cw{--dir-atime} also turns this pass off. Hence, this option affects the \cw{-L} option as well as \cw{-s} and \cw{-S}. (The previous section mentioned that there might be subtle differences between the output of \cw{agedu -s /path -D} and \cw{agedu -S /path}. This is why. Doing a scan with \cw{-s} and then dumping it with \cw{-D} will dump the fully faked atimes on the directories, whereas doing a scan-to-dump with \cw{-S} will dump only \e{partially} faked atimes \dash specifically, each directory's last modification time \dash since the subsequent processing pass will not have had a chance to take place. However, loading either of the resulting dump files with \cw{-L} will perform the atime-faking processing pass, leading to the same data in the index file in each case. In normal usage it should be safe to ignore all of this complexity.) } \dt \cw{--mtime} \dd This option causes \cw{agedu} to index files by their last modification time instead of their last access time. You might want to use this if your last access times were completely useless for some reason: for example, if you had recently searched every file on your system, the system would have lost all the information about what files you hadn't recently accessed before then. Using this option is liable to be less effective at finding genuinely wasted space than the normal mode (that is, it will be more likely to flag things as disused when they're not, so you will have more candidates to go through by hand looking for data you don't need), but may be better than nothing if your last-access times are unhelpful. \lcont{ Another use for this mode might be to find \e{recently created} large data. If your disk has been gradually filling up for years, the default mode of \cw{agedu} will let you find unused data to delete; but if you know your disk had plenty of space recently and now it's suddenly full, and you suspect that some rogue program has left a large core dump or output file, then \cw{agedu --mtime} might be a convenient way to locate the culprit. } The following option affects all the modes that generate reports: the web server mode \cw{-w}, the stand-alone HTML generation mode \cw{-H} and the text report mode \cw{-t}. \dt \cw{--files} \dd This option causes \cw{agedu}'s reports to list the individual files in each directory, instead of just giving a combined report for everything that's not in a subdirectory. The following option affects the text report mode \cw{-t}. \dt \cw{-a} \e{age} or \cw{--age} \e{age} \dd This option tells \cw{agedu} to report only files of at least the specified age. An age is specified as a number, followed by one of \cq{y} (years), \cq{m} (months), \cq{w} (weeks) or \cq{d} (days). (This syntax is also used by the \cw{-r} option.) For example, \cw{-a 6m} will produce a text report which includes only files at least six months old. The following options affect the stand-alone HTML generation mode \cw{-H} and the text report mode \cw{-t}. \dt \cw{-d} \e{depth} or \cw{--depth} \e{depth} \dd This option controls the maximum depth to which \cw{agedu} recurses when generating a text or HTML report. \lcont{ In text mode, the default is 1, meaning that the report will include the directory given on the command line and all of its immediate subdirectories. A depth of two includes another level below that, and so on; a depth of zero means \e{only} the directory on the command line. In HTML mode, specifying this option switches \cw{agedu} from writing out a single HTML file to writing out multiple files which link to each other. A depth of 1 means \cw{agedu} will write out an HTML file for the given directory and also one for each of its immediate subdirectories. If you want \cw{agedu} to recurse as deeply as possible, give the special word \cq{max} as an argument to \cw{-d}. } \dt \cw{-o} \e{filename} or \cw{--output} \e{filename} \dd This option is used to specify an output file for \cw{agedu} to write its report to. In text mode or single-file HTML mode, the argument is treated as the name of a file. In multiple-file HTML mode, the argument is treated as the name of a directory: the directory will be created if it does not already exist, and the output HTML files will be created inside it. The following options affect the web server mode \cw{-w}, and in some cases also the stand-alone HTML generation mode \cw{-H}: \dt \cw{-r} \e{age range} or \cw{--age-range} \e{age range} \dd The HTML reports produced by \cw{agedu} use a range of colours to indicate how long ago data was last accessed, running from red (representing the most disused data) to green (representing the newest). By default, the lengths of time represented by the two ends of that spectrum are chosen by examining the data file to see what range of ages appears in it. However, you might want to set your own limits, and you can do this using \cw{-r}. \lcont{ The argument to \cw{-r} consists of a single age, or two ages separated by a minus sign. An age is a number, followed by one of \cq{y} (years), \cq{m} (months), \cq{w} (weeks) or \cq{d} (days). (This syntax is also used by the \cw{-a} option.) The first age in the range represents the oldest data, and will be coloured red in the HTML; the second age represents the newest, coloured green. If the second age is not specified, it will default to zero (so that green means data which has been accessed \e{just now}). For example, \cw{-r 2y} will mark data in red if it has been unused for two years or more, and green if it has been accessed just now. \cw{-r 2y-3m} will similarly mark data red if it has been unused for two years or more, but will mark it green if it has been accessed three months ago or later. } \dt \cw{--address} \e{addr}[\cw{:}\e{port}] \dd Specifies the network address and port number on which \cw{agedu} should listen when running its web server. If you want \cw{agedu} to listen for connections coming in from any source, specify the address as the special value \cw{ANY}. If the port number is omitted, an arbitrary unused port will be chosen for you and displayed. \lcont{ If you specify this option, \cw{agedu} will not print its URL on standard output (since you are expected to know what address you told it to listen to). } \dt \cw{--auth} \e{auth-type} \dd Specifies how \cw{agedu} should control access to the web pages it serves. The options are as follows: \lcont{ \dt \cw{magic} \dd This option only works on Linux, and only when the incoming connection is from the same machine that \cw{agedu} is running on. On Linux, the special file \cw{/proc/net/tcp} contains a list of network connections currently known to the operating system kernel, including which user id created them. So \cw{agedu} will look up each incoming connection in that file, and allow access if it comes from the same user id under which \cw{agedu} itself is running. Therefore, in \cw{agedu}'s normal web server mode, you can safely run it on a multi-user machine and no other user will be able to read data out of your index file. \dt \cw{basic} \dd In this mode, \cw{agedu} will use HTTP Basic authentication: the user will have to provide a username and password via their browser. \cw{agedu} will normally make up a username and password for the purpose, but you can specify your own; see below. \dt \cw{none} \dd In this mode, the web server is unauthenticated: anyone connecting to it has full access to the reports generated by \cw{agedu}. Do not do this unless there is nothing confidential at all in your index file, or unless you are certain that nobody but you can run processes on your computer. \dt \cw{default} \dd This is the default mode if you do not specify one of the above. In this mode, \cw{agedu} will attempt to use Linux magic authentication, but if it detects at startup time that \cw{/proc/net/tcp} is absent or non-functional then it will fall back to using HTTP Basic authentication and invent a user name and password. } \dt \cw{--auth-file} \e{filename} or \cw{--auth-fd} \e{fd} \dd When \cw{agedu} is using HTTP Basic authentication, these options allow you to specify your own user name and password. If you specify \cw{--auth-file}, these will be read from the specified file; if you specify \cw{--auth-fd} they will instead be read from a given file descriptor which you should have arranged to pass to \cw{agedu}. In either case, the authentication details should consist of the username, followed by a colon, followed by the password, followed \e{immediately} by end of file (no trailing newline, or else it will be considered part of the password). \dt \cw{--title} \e{title} \dd Specify the string that appears at the start of the \cw{} section of the output HTML pages. The default is \cq{agedu}. This title is followed by a colon and then the path you're viewing within the index file. You might use this option if you were serving \cw{agedu} reports for several different servers and wanted to make it clearer which one a user was looking at. \dt \cw{--no-eof} \dd Stop \cw{agedu} in web server mode from looking for end-of-file on standard input and treating it as a signal to terminate. \U LIMITATIONS The data file is pretty large. The core of \cw{agedu} is the tree-based data structure it uses in its index in order to efficiently perform the queries it needs; this data structure requires \cw{O(N log N)} storage. This is larger than you might expect; a scan of my own home directory, containing half a million files and directories and about 20Gb of data, produced an index file over 60Mb in size. Furthermore, since the data file must be memory-mapped during most processing, it can never grow larger than available address space, so a \e{really} big filesystem may need to be indexed on a 64-bit computer. (This is one reason for the existence of the \cw{-D} and \cw{-L} options: you can do the scanning on the machine with access to the filesystem, and the indexing on a machine big enough to handle it.) The data structure also does not usefully permit access control within the data file, so it would be difficult \dash even given the willingness to do additional coding \dash to run a system-wide \cw{agedu} scan on a \cw{cron} job and serve the right subset of reports to each user. In certain circumstances, \cw{agedu} can report false positives (reporting files as disused which are in fact in use) as well as the more benign false negatives (reporting files as in use which are not). This arises when a file is, semantically speaking, \q{read} without actually being physically \e{read}. Typically this occurs when a program checks whether the file's mtime has changed and only bothers re-reading it if it has; programs which do this include \cw{rsync}(\e{1}) and \cw{make}(\e{1}). Such programs will fail to update the atime of unmodified files despite depending on their continued existence; a directory full of such files will be reported as disused by \cw{agedu} even in situations where deleting them will cause trouble. Finally, of course, \cw{agedu}'s normal usage mode depends critically on the OS providing last-access times which are at least approximately right. So a file system mounted with Linux's \cq{noatime} option, or the equivalent on any other OS, will not give useful results! (However, the Linux mount option \cq{relatime}, which distributions now tend to use by default, should be fine for all but specialist purposes: it reduces the accuracy of last-access times so that they might be wrong by up to 24 hours, but if you're looking for files that have been unused for months or years, that's not a problem.) \U LICENCE \cw{agedu} is free software, distributed under the MIT licence. Type \cw{agedu --licence} to see the full licence text. \versionid $Id: agedu.but 9671 2012-09-19 16:57:03Z simon $ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/aclocal.m4������������������������������������������������������������������������������0000644�0001753�0001753�00000103463�12163703774�013652� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, [m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar <conftest.tar]) grep GrepMe conftest.dir/file >/dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/configure�������������������������������������������������������������������������������0000755�0001753�0001753�00000600021�12163703774�013711� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.67 for agedu r9723. # # Report bugs to <anakin@pobox.com>. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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. 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 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" 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 : # 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. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} 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 anakin@pobox.com $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: 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_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; } # 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 -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' 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 if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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 </dev/null exec 6>&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='agedu' PACKAGE_TARNAME='agedu' PACKAGE_VERSION='r9723' PACKAGE_STRING='agedu r9723' PACKAGE_BUGREPORT='anakin@pobox.com' PACKAGE_URL='' ac_unique_file="agedu.c" # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif #ifdef STDC_HEADERS # include <stdlib.h> # include <stddef.h> #else # ifdef HAVE_STDLIB_H # include <stdlib.h> # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include <memory.h> # endif # include <string.h> #endif #ifdef HAVE_STRINGS_H # include <strings.h> #endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #ifdef HAVE_STDINT_H # include <stdint.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS EGREP GREP CPP HAVE_HALIBUT_FALSE HAVE_HALIBUT_TRUE HALIBUT am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_ipv6 enable_ipv4 ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS 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' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 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 agedu r9723 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/agedu] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of agedu r9723:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-ipv6 disable IPv6 in the built-in web server --disable-ipv4 disable IPv4 in the built-in web server Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> 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 <anakin@pobox.com>. _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 agedu configure r9723 generated by GNU Autoconf 2.67 Copyright (C) 2010 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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_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 || $as_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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link # 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; test "x$as_lineno_stack" = x && { as_lineno=; 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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; 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 anakin@pobox.com ## ## ------------------------------- ##" ) | 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 "test \"\${$3+set}\"" = set; 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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; 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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_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 "test \"\${$3+set}\"" = set; 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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type # 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 "test \"\${$3+set}\"" = set; 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 <limits.h> declares $2. For example, HP-UX 11i <limits.h> declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer <limits.h> to <assert.h> if __STDC__ is defined, since <limits.h> exists even on freestanding compilers. */ #ifdef __STDC__ # include <limits.h> #else # include <assert.h> #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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by agedu $as_me r9723, which was generated by GNU Autoconf 2.67. 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 " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" am__api_version='1.11' 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 test "${ac_cv_path_install+set}" = set; 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='agedu' VERSION='r9723' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # 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 test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 <stdio.h> 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 test "${ac_cv_objext+set}" = set; 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 test "${ac_cv_c_compiler_gnu+set}" = set; 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 test "${ac_cv_prog_cc_g+set}" = set; 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 test "${ac_cv_prog_cc_c89+set}" = set; 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 <stdarg.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if test "${ac_cv_prog_cc_c99+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> #include <stdbool.h> #include <stdlib.h> #include <wchar.h> #include <stdio.h> // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" 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_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : fi # Extract the first word of "halibut", so it can be a program name with args. set dummy halibut; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_HALIBUT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$HALIBUT"; then ac_cv_prog_HALIBUT="$HALIBUT" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_HALIBUT="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_HALIBUT" && ac_cv_prog_HALIBUT="no" fi fi HALIBUT=$ac_cv_prog_HALIBUT if test -n "$HALIBUT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HALIBUT" >&5 $as_echo "$HALIBUT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$HALIBUT" = "xyes"; then HAVE_HALIBUT_TRUE= HAVE_HALIBUT_FALSE='#' else HAVE_HALIBUT_TRUE='#' HAVE_HALIBUT_FALSE= fi # Checks for libraries. # Checks for header files. ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if eval "test \"\${$as_ac_Header+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then : break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then : break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi 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 test "${ac_cv_prog_CPP+set}" = set; 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 <limits.h> to <assert.h> if __STDC__ is defined, since # <limits.h> 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 <limits.h> #else # include <assert.h> #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 <ac_nonexistent.h> _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 <limits.h> to <assert.h> if __STDC__ is defined, since # <limits.h> 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 <limits.h> #else # include <assert.h> #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 <ac_nonexistent.h> _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 test "${ac_cv_path_GREP+set}" = set; 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" { test -f "$ac_path_GREP" && $as_test_x "$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 test "${ac_cv_path_EGREP+set}" = set; 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" { test -f "$ac_path_EGREP" && $as_test_x "$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 test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> 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 <string.h> _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 <stdlib.h> _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 <ctype.h> #include <stdlib.h> #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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <sys/wait.h> #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=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_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in assert.h arpa/inet.h ctype.h errno.h fcntl.h features.h fnmatch.h limits.h netdb.h netinet/in.h pwd.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h sys/ioctl.h sys/mman.h sys/socket.h syslog.h termios.h time.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* 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. */ char *t; 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 saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; 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 ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = x""yes; 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" = x""yes; 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 test "${ac_cv_struct_tm+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <time.h> 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 # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether closedir returns void" >&5 $as_echo_n "checking whether closedir returns void... " >&6; } if test "${ac_cv_func_closedir_void+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_closedir_void=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #include <$ac_header_dirent> #ifndef __cplusplus int closedir (); #endif int main () { return closedir (opendir (".")) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_closedir_void=no else ac_cv_func_closedir_void=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_closedir_void" >&5 $as_echo "$ac_cv_func_closedir_void" >&6; } if test $ac_cv_func_closedir_void = yes; then $as_echo "#define CLOSEDIR_VOID 1" >>confdefs.h fi if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if test "${ac_cv_prog_gcc_traditional+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sgtty.h> Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <termio.h> Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi 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 getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include <fcntl.h> #include <sys/mman.h> #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include <sys/param.h> # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=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_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt for ac_header in sys/select.h sys/socket.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5 $as_echo_n "checking types of arguments for select... " >&6; } if test "${ac_cv_func_select_args+set}" = set; then : $as_echo_n "(cached) " >&6 else for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> #endif #ifdef HAVE_SYS_SOCKET_H # include <sys/socket.h> #endif int main () { extern int select ($ac_arg1, $ac_arg234, $ac_arg234, $ac_arg234, $ac_arg5); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done done # Provide a safe default value. : ${ac_cv_func_select_args='int,int *,struct timeval *'} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5 $as_echo "$ac_cv_func_select_args" >&6; } ac_save_IFS=$IFS; IFS=',' set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` IFS=$ac_save_IFS shift cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG1 $1 _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG234 ($2) _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG5 ($3) _ACEOF rm -f conftest* for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRFTIME 1 _ACEOF else # strftime is in -lintl on SCO UNIX. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 $as_echo_n "checking for strftime in -lintl... " >&6; } if test "${ac_cv_lib_intl_strftime+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strftime (); int main () { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_strftime=yes else ac_cv_lib_intl_strftime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 $as_echo "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = x""yes; then : $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = x""yes; 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" = x""yes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing connect" >&5 $as_echo_n "checking for library containing connect... " >&6; } if test "${ac_cv_search_connect+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char connect (); int main () { return connect (); ; return 0; } _ACEOF for ac_lib in '' socket nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_connect=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_connect+set}" = set; then : break fi done if test "${ac_cv_search_connect+set}" = set; then : else ac_cv_search_connect=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_connect" >&5 $as_echo "$ac_cv_search_connect" >&6; } ac_res=$ac_cv_search_connect if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_ntoa" >&5 $as_echo_n "checking for library containing inet_ntoa... " >&6; } if test "${ac_cv_search_inet_ntoa+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_ntoa (); int main () { return inet_ntoa (); ; return 0; } _ACEOF for ac_lib in '' socket nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_inet_ntoa=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_inet_ntoa+set}" = set; then : break fi done if test "${ac_cv_search_inet_ntoa+set}" = set; then : else ac_cv_search_inet_ntoa=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_ntoa" >&5 $as_echo "$ac_cv_search_inet_ntoa" >&6; } ac_res=$ac_cv_search_inet_ntoa if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_addr" >&5 $as_echo_n "checking for library containing inet_addr... " >&6; } if test "${ac_cv_search_inet_addr+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_addr (); int main () { return inet_addr (); ; return 0; } _ACEOF for ac_lib in '' socket nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_inet_addr=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_inet_addr+set}" = set; then : break fi done if test "${ac_cv_search_inet_addr+set}" = set; then : else ac_cv_search_inet_addr=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_addr" >&5 $as_echo "$ac_cv_search_inet_addr" >&6; } ac_res=$ac_cv_search_inet_addr if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if test "${ac_cv_search_gethostbyname+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF for ac_lib in '' socket nsl resolv; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gethostbyname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_gethostbyname+set}" = set; then : break fi done if test "${ac_cv_search_gethostbyname+set}" = set; then : else ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 $as_echo "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getaddrinfo" >&5 $as_echo_n "checking for library containing getaddrinfo... " >&6; } if test "${ac_cv_search_getaddrinfo+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getaddrinfo (); int main () { return getaddrinfo (); ; return 0; } _ACEOF for ac_lib in '' socket nsl resolv; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_getaddrinfo=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_getaddrinfo+set}" = set; then : break fi done if test "${ac_cv_search_getaddrinfo+set}" = set; then : else ac_cv_search_getaddrinfo=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getaddrinfo" >&5 $as_echo "$ac_cv_search_getaddrinfo" >&6; } ac_res=$ac_cv_search_getaddrinfo if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi for ac_func in ftruncate fdopendir lstat64 stat64 memchr munmap select socket strcasecmp strchr strcspn strerror strrchr strspn strtoul strtoull connect inet_ntoa inet_addr gethostbyname getaddrinfo 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 # Check whether --enable-ipv6 was given. if test "${enable_ipv6+set}" = set; then : enableval=$enable_ipv6; ipv6=$enableval else ipv6=$ac_cv_func_getaddrinfo fi # Check whether --enable-ipv4 was given. if test "${enable_ipv4+set}" = set; then : enableval=$enable_ipv4; ipv4=$enableval else ipv4=yes fi if test "$ipv6" = "no"; then $as_echo "#define NO_IPV6 1" >>confdefs.h fi if test "$ipv4" = "no"; then $as_echo "#define NO_IPV4 1" >>confdefs.h fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_HALIBUT_TRUE}" && test -z "${HAVE_HALIBUT_FALSE}"; then as_fn_error $? "conditional \"HAVE_HALIBUT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. 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 -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' 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 if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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 agedu $as_me r9723, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to <anakin@pobox.com>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ agedu config.status r9723 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "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 test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$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 -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # 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 2>/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 {' >"$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 >>"\$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 ' <conf$$subs.awk | sed ' /^[^""]/{ N s/\n// } ' >>$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$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 < "$tmp/subs1.awk" > "$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 >"$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_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; 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 ' <confdefs.h | sed ' s/'"$ac_delim"'/"\\\ "/g' >>$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$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 >"$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 "$tmp/subs.awk" >$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' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$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 "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$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 "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$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 "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; 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 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/config.h.in�����������������������������������������������������������������������������0000644�0001753�0001753�00000014603�12163703774�014032� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */ #undef CLOSEDIR_VOID /* Define to 1 if you have the <arpa/inet.h> header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the <assert.h> header file. */ #undef HAVE_ASSERT_H /* Define to 1 if you have the `connect' function. */ #undef HAVE_CONNECT /* Define to 1 if you have the <ctype.h> header file. */ #undef HAVE_CTYPE_H /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the <errno.h> header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fdopendir' function. */ #undef HAVE_FDOPENDIR /* Define to 1 if you have the <features.h> header file. */ #undef HAVE_FEATURES_H /* Define to 1 if you have the <fnmatch.h> header file. */ #undef HAVE_FNMATCH_H /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `gethostbyname' function. */ #undef HAVE_GETHOSTBYNAME /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the `inet_addr' function. */ #undef HAVE_INET_ADDR /* Define to 1 if you have the `inet_ntoa' function. */ #undef HAVE_INET_NTOA /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `lstat64' function. */ #undef HAVE_LSTAT64 /* Define to 1 if you have the `memchr' function. */ #undef HAVE_MEMCHR /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the `munmap' function. */ #undef HAVE_MUNMAP /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the <netdb.h> header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the <pwd.h> header file. */ #undef HAVE_PWD_H /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the `stat64' function. */ #undef HAVE_STAT64 /* Define to 1 if you have the <stdarg.h> header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the <stddef.h> header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the <stdio.h> header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the <stdlib.h> 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 `strcspn' function. */ #undef HAVE_STRCSPN /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strspn' function. */ #undef HAVE_STRSPN /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if you have the `strtoull' function. */ #undef HAVE_STRTOULL /* Define to 1 if you have the <syslog.h> header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the <sys/ioctl.h> header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the <sys/mman.h> header file. */ #undef HAVE_SYS_MMAN_H /* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the <sys/param.h> header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the <sys/select.h> header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the <sys/socket.h> header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the <sys/types.h> header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the <termios.h> header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the <time.h> header file. */ #undef HAVE_TIME_H /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* define if IPv4 is disabled at configure time */ #undef NO_IPV4 /* define if IPv6 is disabled at configure time */ #undef NO_IPV6 /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to the type of arg 1 for `select'. */ #undef SELECT_TYPE_ARG1 /* Define to the type of args 2, 3 and 4 for `select'. */ #undef SELECT_TYPE_ARG234 /* Define to the type of arg 5 for `select'. */ #undef SELECT_TYPE_ARG5 /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if your <sys/time.h> declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `long int' if <sys/types.h> does not define. */ #undef off_t /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t �����������������������������������������������������������������������������������������������������������������������������agedu-r9723/install-sh������������������������������������������������������������������������������0000755�0001753�0001753�00000032537�12163703774�014021� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg 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 "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # 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: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-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 eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -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"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: �����������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/missing���������������������������������������������������������������������������������0000755�0001753�0001753�00000026233�12163703774�013410� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to <bug-automake@gnu.org>." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/depcomp���������������������������������������������������������������������������������0000755�0001753�0001753�00000044267�12163703774�013375� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free # Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to <bug-automake@gnu.org>. EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/Makefile.in�����������������������������������������������������������������������������0000644�0001753�0001753�00000057206�12163703774�014062� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = agedu$(EXEEXT) subdir = . DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure TODO depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) am_agedu_OBJECTS = agedu.$(OBJEXT) du.$(OBJEXT) alloc.$(OBJEXT) \ trie.$(OBJEXT) index.$(OBJEXT) html.$(OBJEXT) httpd.$(OBJEXT) \ fgetline.$(OBJEXT) licence.$(OBJEXT) agedu_OBJECTS = $(am_agedu_OBJECTS) agedu_DEPENDENCIES = $(LIBOBJS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(agedu_SOURCES) DIST_SOURCES = $(agedu_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man1_MANS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HALIBUT = @HALIBUT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ agedu_SOURCES = agedu.c du.c alloc.c trie.c index.c html.c httpd.c \ fgetline.c licence.c agedu_LDADD = $(LIBOBJS) man1_MANS = agedu.1 # If Halibut is available to rebuild the man pages from their .but # source, then man pages are treated as derived files in the obvious # way, and deleted by 'make clean'. If Halibut is not available (the # typical case if someone has downloaded the source archive and rerun # mkauto.sh), the man pages are treated as source files by this # makefile. @HAVE_HALIBUT_TRUE@BUILT_MANS = $(man1_MANS) @HAVE_HALIBUT_TRUE@CLEANFILES = $(BUILT_MANS) @HAVE_HALIBUT_TRUE@.SUFFIXES = .but .1 all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .1 .but .c .o .obj am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) agedu$(EXEEXT): $(agedu_OBJECTS) $(agedu_DEPENDENCIES) @rm -f agedu$(EXEEXT) $(LINK) $(agedu_OBJECTS) $(agedu_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agedu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/du.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fgetline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/html.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/index.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/licence.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trie.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` install-man1: $(man1_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(MANS) config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-man: uninstall-man1 .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-compile distclean-generic \ distclean-hdr distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man1 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-man \ uninstall-man1 @HAVE_HALIBUT_TRUE@.but.1: @HAVE_HALIBUT_TRUE@ halibut --man=$@ $< @HAVE_HALIBUT_TRUE@doc: $(BUILT_MANS) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������agedu-r9723/agedu.1���������������������������������������������������������������������������������0000644�0001753�0001753�00000074340�12163703774�013162� 0����������������������������������������������������������������������������������������������������ustar �simon���������������������������simon������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������.\" $Id: agedu.but 9671 2012-09-19 16:57:03Z simon $ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .TH "agedu" "1" "2008\(hy11\(hy02" "Simon\ Tatham" "Simon\ Tatham" .SH "NAME" .PP \fBagedu\fP - correlate disk usage with last-access times to identify large and disused data .SH "SYNOPSIS" .PP .nf \fBagedu\fP\ [\ \fIoptions\fP\ ]\ \fIaction\fP\ [\fIaction\fP...] .fi .SH "DESCRIPTION" .PP \fBagedu\fP scans a directory tree and produces reports about how much disk space is used in each directory and subdirectory, and also how that usage of disk space corresponds to files with last-access times a long time ago. .PP In other words, \fBagedu\fP is a tool you might use to help you free up disk space. It lets you see which directories are taking up the most space, as \fBdu\fP does; but unlike \fBdu\fP, it also distinguishes between large collections of data which are still in use and ones which have not been accessed in months or years - for instance, large archives downloaded, unpacked, used once, and never cleaned up. Where \fBdu\fP helps you find what\*(Aqs using your disk space, \fBagedu\fP helps you find what\*(Aqs \fIwasting\fP your disk space. .PP \fBagedu\fP has several operating modes. In one mode, it scans your disk and builds an index file containing a data structure which allows it to efficiently retrieve any information it might need. Typically, you would use it in this mode first, and then run it in one of a number of `query' modes to display a report of the disk space usage of a particular directory and its subdirectories. Those reports can be produced as plain text (much like \fBdu\fP) or as HTML. \fBagedu\fP can even run as a miniature web server, presenting each directory\*(Aqs HTML report with hyperlinks to let you navigate around the file system to similar reports for other directories. .PP So you would typically start using \fBagedu\fP by telling it to do a scan of a directory tree and build an index. This is done with a command such as .PP .nf $\ \fBagedu\ \-s\ /home/fred\fP .fi .PP which will build a large data file called \fBagedu.dat\fP in your current directory. (If that current directory is \fIinside\fP \fB/home/fred\fP, don\*(Aqt worry - \fBagedu\fP is smart enough to discount its own index file.) .PP Having built the index, you would now query it for reports of disk space usage. If you have a graphical web browser, the simplest and nicest way to query the index is by running \fBagedu\fP in web server mode: .PP .nf $\ \fBagedu\ \-w\fP .fi .PP which will print (among other messages) a URL on its standard output along the lines of .PP .nf URL:\ http://127.0.0.1:48638/ .fi .PP (That URL will always begin with `\fB127.\fP', meaning that it\*(Aqs in the \fBlocalhost\fP address space. So only processes running on the same computer can even try to connect to that web server, and also there is access control to prevent other users from seeing it - see below for more detail.) .PP Now paste that URL into your web browser, and you will be shown a graphical representation of the disk usage in \fB/home/fred\fP and its immediate subdirectories, with varying colours used to show the difference between disused and recently-accessed data. Click on any subdirectory to descend into it and see a report for its subdirectories in turn; click on parts of the pathname at the top of any page to return to higher-level directories. When you\*(Aqve finished browsing, you can just press Ctrl-D to send an end-of-file indication to \fBagedu\fP, and it will shut down. .PP After that, you probably want to delete the data file \fBagedu.dat\fP, since it\*(Aqs pretty large. In fact, the command \fBagedu -R\fP will do this for you; and you can chain \fBagedu\fP commands on the same command line, so that instead of the above you could have done .PP .nf $\ \fBagedu\ \-s\ /home/fred\ \-w\ \-R\fP .fi .PP for a single self-contained run of \fBagedu\fP which builds its index, serves web pages from it, and cleans it up when finished. .PP If you don't have a graphical web browser, you can do text-based queries as well. Having scanned \fB/home/fred\fP as above, you might run .PP .nf $\ \fBagedu\ \-t\ /home/fred\fP .fi .PP which again gives a summary of the disk usage in \fB/home/fred\fP and its immediate subdirectories; but this time \fBagedu\fP will print it on standard output, in much the same format as \fBdu\fP. If you then want to find out how much \fIold\fP data is there, you can add the \fB-a\fP option to show only files last accessed a certain length of time ago. For example, to show only files which haven\*(Aqt been looked at in six months or more: .PP .nf $\ \fBagedu\ \-t\ /home/fred\ \-a\ 6m\fP .fi .PP That's the essence of what \fBagedu\fP does. It has other modes of operation for more complex situations, and the usual array of configurable options. The following sections contain a complete reference for all its functionality. .SH "OPERATING MODES" .PP This section describes the operating modes supported by \fBagedu\fP. Each of these is in the form of a command-line option, sometimes with an argument. Multiple operating-mode options may appear on the command line, in which case \fBagedu\fP will perform the specified actions one after another. For instance, as shown in the previous section, you might want to perform a disk scan and immediately launch a web server giving reports from that scan. .IP "\fB-s\fP \fIdirectory\fP or \fB--scan\fP \fIdirectory\fP" In this mode, \fBagedu\fP scans the file system starting at the specified directory, and indexes the results of the scan into a large data file which other operating modes can query. .RS .PP By default, the scan is restricted to a single file system (since the expected use of \fBagedu\fP is that you would probably use it because a particular disk partition was running low on space). You can remove that restriction using the \fB--cross-fs\fP option; other configuration options allow you to include or exclude files or entire subdirectories from the scan. See the next section for full details of the configurable options. .PP The index file is created with restrictive permissions, in case the file system you are scanning contains confidential information in its structure. .PP Index files are dependent on the characteristics of the CPU architecture you created them on. You should not expect to be able to move an index file between different types of computer and have it continue to work. If you need to transfer the results of a disk scan to a different kind of computer, see the \fB-D\fP and \fB-L\fP options below. .RE .IP "\fB-w\fP or \fB--web\fP" In this mode, \fBagedu\fP expects to find an index file already written. It allocates a network port, and starts up a web server on that port which serves reports generated from the index file. By default it invents its own URL and prints it out. .RS .PP The web server runs until \fBagedu\fP receives an end-of-file event on its standard input. (The expected usage is that you run it from the command line, immediately browse web pages until you\*(Aqre satisfied, and then press Ctrl-D.) To disable the EOF behaviour, use the \fB--no-eof\fP option. .PP In case the index file contains any confidential information about your file system, the web server protects the pages it serves from access by other people. On Linux, this is done transparently by means of using \fB/proc/net/tcp\fP to check the owner of each incoming connection; failing that, the web server will require a password to view the reports, and \fBagedu\fP will print the password it invented on standard output along with the URL. .PP Configurable options for this mode let you specify your own address and port number to listen on, and also specify your own choice of authentication method (including turning authentication off completely) and a username and password of your choice. .RE .IP "\fB-t\fP \fIdirectory\fP or \fB--text\fP \fIdirectory\fP" In this mode, \fBagedu\fP generates a textual report on standard output, listing the disk usage in the specified directory and all its subdirectories down to a given depth. By default that depth is 1, so that you see a report for \fIdirectory\fP itself and all of its immediate subdirectories. You can configure a different depth (or no depth limit) using \fB-d\fP, described in the next section. .RS .PP Used on its own, \fB-t\fP merely lists the \fItotal\fP disk usage in each subdirectory; \fBagedu\fP\*(Aqs additional ability to distinguish unused from recently-used data is not activated. To activate it, use the \fB-a\fP option to specify a minimum age. .PP The directory structure stored in \fBagedu\fP\*(Aqs index file is treated as a set of literal strings. This means that you cannot refer to directories by synonyms. So if you ran \fBagedu -s .\fP, then all the path names you later pass to the \fB-t\fP option must be either `\fB.\fP' or begin with `\fB./\fP'. Similarly, symbolic links within the directory you scanned will not be followed; you must refer to each directory by its canonical, symlink-free pathname. .RE .IP "\fB-R\fP or \fB--remove\fP" In this mode, \fBagedu\fP deletes its index file. Running just \fBagedu -R\fP on its own is therefore equivalent to typing \fBrm agedu.dat\fP. However, you can also put \fB-R\fP on the end of a command line to indicate that \fBagedu\fP should delete its index file after it finishes performing other operations. .IP "\fB-D\fP or \fB--dump\fP" In this mode, \fBagedu\fP reads an existing index file and produces a dump of its contents on standard output. This dump can later be loaded into a new index file, perhaps on another computer. .IP "\fB-L\fP or \fB--load\fP" In this mode, \fBagedu\fP expects to read a dump produced by the \fB-D\fP option from its standard input. It constructs an index file from that dump, exactly as it would have if it had read the same data from a disk scan in \fB-s\fP mode. .IP "\fB-S\fP \fIdirectory\fP or \fB--scan-dump\fP \fIdirectory\fP" In this mode, \fBagedu\fP will scan a directory tree and convert the results straight into a dump on standard output, without generating an index file at all. So running \fBagedu -S /path\fP should produce equivalent output to that of \fBagedu -s /path -D\fP, except that the latter will produce an index file as a side effect whereas \fB-S\fP will not. .RS .PP (The output will not be exactly \fIidentical\fP, due to a difference in treatment of last-access times on directories. However, it should be effectively equivalent for most purposes. See the documentation of the \fB--dir-atime\fP option in the next section for further detail.) .RE .IP "\fB-H\fP \fIdirectory\fP or \fB--html\fP \fIdirectory\fP" In this mode, \fBagedu\fP will generate an HTML report of the disk usage in the specified directory and its immediate subdirectories, in the same form that it serves from its web server in \fB-w\fP mode. .RS .PP By default, a single HTML report will be generated and simply written to standard output, with no hyperlinks pointing to other similar pages. If you also specify the \fB-d\fP option (see below), \fBagedu\fP will instead write out a collection of HTML files with hyperlinks between them, and call the top-level file \fBindex.html\fP. .RE .IP "\fB--cgi\fP" In this mode, \fBagedu\fP will run as the bulk of a CGI script which provides the same set of web pages as the built-in web server would. It will read the usual CGI environment variables, and write CGI-style data to its standard output. .RS .PP The actual CGI program itself should be a tiny wrapper around \fBagedu\fP which passes it the \fB--cgi\fP option, and also (probably) \fB-f\fP to locate the index file. \fBagedu\fP will do everything else. .PP No access control is performed in this mode: restricting access to CGI scripts is assumed to be the job of the web server. .RE .IP "\fB-h\fP or \fB--help\fP" Causes \fBagedu\fP to print some help text and terminate immediately. .IP "\fB-V\fP or \fB--version\fP" Causes \fBagedu\fP to print its version number and terminate immediately. .SH "OPTIONS" .PP This section describes the various configuration options that affect \fBagedu\fP\*(Aqs operation in one mode or another. .PP The following option affects nearly all modes (except \fB-S\fP): .IP "\fB-f\fP \fIfilename\fP or \fB--file\fP \fIfilename\fP" Specifies the location of the index file which \fBagedu\fP creates, reads or removes depending on its operating mode. By default, this is simply `\fBagedu.dat\fP', in whatever is the current working directory when you run \fBagedu\fP. .PP The following options affect the disk-scanning modes, \fB-s\fP and \fB-S\fP: .IP "\fB--cross-fs\fP and \fB--no-cross-fs\fP" These configure whether or not the disk scan is permitted to cross between different file systems. The default is not to: \fBagedu\fP will normally skip over subdirectories on which a different file system is mounted. This makes it convenient when you want to free up space on a particular file system which is running low. However, in other circumstances you might wish to see general information about the use of space no matter which file system it\*(Aqs on (for instance, if your real concern is your backup media running out of space, and if your backups do not treat different file systems specially); in that situation, use \fB--cross-fs\fP. .RS .PP (Note that this default is the opposite way round from the corresponding option in \fBdu\fP.) .RE .IP "\fB--prune\fP \fIwildcard\fP and \fB--prune-path\fP \fIwildcard\fP" These cause particular files or directories to be omitted entirely from the scan. If \fBagedu\fP\*(Aqs scan encounters a file or directory whose name matches the wildcard provided to the \fB--prune\fP option, it will not include that file in its index, and also if it\*(Aqs a directory it will skip over it and not scan its contents. .RS .PP Note that in most Unix shells, wildcards will probably need to be escaped on the command line, to prevent the shell from expanding the wildcard before \fBagedu\fP sees it. .PP \fB--prune-path\fP is similar to \fB--prune\fP, except that the wildcard is matched against the entire pathname instead of just the filename at the end of it. So whereas \fB--prune *a*b*\fP will match any file whose actual name contains an \fBa\fP somewhere before a \fBb\fP, \fB--prune-path *a*b*\fP will also match a file whose name contains \fBb\fP and which is inside a directory containing an \fBa\fP, or any file inside a directory of that form, and so on. .RE .IP "\fB--exclude\fP \fIwildcard\fP and \fB--exclude-path\fP \fIwildcard\fP" These cause particular files or directories to be omitted from the index, but not from the scan. If \fBagedu\fP\*(Aqs scan encounters a file or directory whose name matches the wildcard provided to the \fB--exclude\fP option, it will not include that file in its index - but unlike \fB--prune\fP, if the file in question is a directory it will still scan its contents and index them if they are not ruled out themselves by \fB--exclude\fP options. .RS .PP As above, \fB--exclude-path\fP is similar to \fB--exclude\fP, except that the wildcard is matched against the entire pathname. .RE .IP "\fB--include\fP \fIwildcard\fP and \fB--include-path\fP \fIwildcard\fP" These cause particular files or directories to be re-included in the index and the scan, if they had previously been ruled out by one of the above exclude or prune options. You can interleave include, exclude and prune options as you wish on the command line, and if more than one of them applies to a file then the last one takes priority. .RS .PP For example, if you wanted to see only the disk space taken up by MP3 files, you might run .PP .nf $\ \fBagedu\ \-s\ .\ \-\-exclude\ \*(Aq*\*(Aq\ \-\-include\ \*(Aq*.mp3\*(Aq\fP .fi .PP which will cause everything to be omitted from the scan, but then the MP3 files to be put back in. If you then wanted only a subset of those MP3s, you could then exclude some of them again by adding, say, `\fB--exclude-path \*(Aq./queen/*\*(Aq\fP' (or, more efficiently, `\fB--prune ./queen\fP') on the end of that command. .PP As with the previous two options, \fB--include-path\fP is similar to \fB--include\fP except that the wildcard is matched against the entire pathname. .RE .IP "\fB--progress\fP, \fB--no-progress\fP and \fB--tty-progress\fP" When \fBagedu\fP is scanning a directory tree, it will typically print a one-line progress report every second showing where it has reached in the scan, so you can have some idea of how much longer it will take. (Of course, it can\*(Aqt predict \fIexactly\fP how long it will take, since it doesn\*(Aqt know which of the directories it hasn\*(Aqt scanned yet will turn out to be huge.) .RS .PP By default, those progress reports are displayed on \fBagedu\fP\*(Aqs standard error channel, if that channel points to a terminal device. If you need to manually enable or disable them, you can use the above three options to do so: \fB--progress\fP unconditionally enables the progress reports, \fB--no-progress\fP unconditionally disables them, and \fB--tty-progress\fP reverts to the default behaviour which is conditional on standard error being a terminal. .RE .IP "\fB--dir-atime\fP and \fB--no-dir-atime\fP" In normal operation, \fBagedu\fP ignores the atimes (last access times) on the \fIdirectories\fP it scans: it only pays attention to the atimes of the \fIfiles\fP inside those directories. This is because directory atimes tend to be reset by a lot of system administrative tasks, such as \fBcron\fP jobs which scan the file system for one reason or another - or even other invocations of \fBagedu\fP itself, though it tries to avoid modifying any atimes if possible. So the literal atimes on directories are typically not representative of how long ago the data in question was last accessed with real intent to use that data in particular. .RS .PP Instead, \fBagedu\fP makes up a fake atime for every directory it scans, which is equal to the newest atime of any file in or below that directory (or the directory\*(Aqs last \fImodification\fP time, whichever is newest). This is based on the assumption that all \fIimportant\fP accesses to directories are actually accesses to the files inside those directories, so that when any file is accessed all the directories on the path leading to it should be considered to have been accessed as well. .PP In unusual cases it is possible that a directory itself might embody important data which is accessed by reading the directory. In that situation, \fBagedu\fP\*(Aqs atime-faking policy will misreport the directory as disused. In the unlikely event that such directories form a significant part of your disk space usage, you might want to turn off the faking. The \fB--dir-atime\fP option does this: it causes the disk scan to read the original atimes of the directories it scans. .PP The faking of atimes on directories also requires a processing pass over the index file after the main disk scan is complete. \fB--dir-atime\fP also turns this pass off. Hence, this option affects the \fB-L\fP option as well as \fB-s\fP and \fB-S\fP. .PP (The previous section mentioned that there might be subtle differences between the output of \fBagedu -s /path -D\fP and \fBagedu -S /path\fP. This is why. Doing a scan with \fB-s\fP and then dumping it with \fB-D\fP will dump the fully faked atimes on the directories, whereas doing a scan-to-dump with \fB-S\fP will dump only \fIpartially\fP faked atimes - specifically, each directory\*(Aqs last modification time - since the subsequent processing pass will not have had a chance to take place. However, loading either of the resulting dump files with \fB-L\fP will perform the atime-faking processing pass, leading to the same data in the index file in each case. In normal usage it should be safe to ignore all of this complexity.) .RE .IP "\fB--mtime\fP" This option causes \fBagedu\fP to index files by their last modification time instead of their last access time. You might want to use this if your last access times were completely useless for some reason: for example, if you had recently searched every file on your system, the system would have lost all the information about what files you hadn\*(Aqt recently accessed before then. Using this option is liable to be less effective at finding genuinely wasted space than the normal mode (that is, it will be more likely to flag things as disused when they\*(Aqre not, so you will have more candidates to go through by hand looking for data you don\*(Aqt need), but may be better than nothing if your last-access times are unhelpful. .RS .PP Another use for this mode might be to find \fIrecently created\fP large data. If your disk has been gradually filling up for years, the default mode of \fBagedu\fP will let you find unused data to delete; but if you know your disk had plenty of space recently and now it\*(Aqs suddenly full, and you suspect that some rogue program has left a large core dump or output file, then \fBagedu --mtime\fP might be a convenient way to locate the culprit. .RE .PP The following option affects all the modes that generate reports: the web server mode \fB-w\fP, the stand-alone HTML generation mode \fB-H\fP and the text report mode \fB-t\fP. .IP "\fB--files\fP" This option causes \fBagedu\fP\*(Aqs reports to list the individual files in each directory, instead of just giving a combined report for everything that\*(Aqs not in a subdirectory. .PP The following option affects the text report mode \fB-t\fP. .IP "\fB-a\fP \fIage\fP or \fB--age\fP \fIage\fP" This option tells \fBagedu\fP to report only files of at least the specified age. An age is specified as a number, followed by one of `\fBy\fP' (years), `\fBm\fP' (months), `\fBw\fP' (weeks) or `\fBd\fP' (days). (This syntax is also used by the \fB-r\fP option.) For example, \fB-a 6m\fP will produce a text report which includes only files at least six months old. .PP The following options affect the stand-alone HTML generation mode \fB-H\fP and the text report mode \fB-t\fP. .IP "\fB-d\fP \fIdepth\fP or \fB--depth\fP \fIdepth\fP" This option controls the maximum depth to which \fBagedu\fP recurses when generating a text or HTML report. .RS .PP In text mode, the default is 1, meaning that the report will include the directory given on the command line and all of its immediate subdirectories. A depth of two includes another level below that, and so on; a depth of zero means \fIonly\fP the directory on the command line. .PP In HTML mode, specifying this option switches \fBagedu\fP from writing out a single HTML file to writing out multiple files which link to each other. A depth of 1 means \fBagedu\fP will write out an HTML file for the given directory and also one for each of its immediate subdirectories. .PP If you want \fBagedu\fP to recurse as deeply as possible, give the special word `\fBmax\fP' as an argument to \fB-d\fP. .RE .IP "\fB-o\fP \fIfilename\fP or \fB--output\fP \fIfilename\fP" This option is used to specify an output file for \fBagedu\fP to write its report to. In text mode or single-file HTML mode, the argument is treated as the name of a file. In multiple-file HTML mode, the argument is treated as the name of a directory: the directory will be created if it does not already exist, and the output HTML files will be created inside it. .PP The following options affect the web server mode \fB-w\fP, and in some cases also the stand-alone HTML generation mode \fB-H\fP: .IP "\fB-r\fP \fIage range\fP or \fB--age-range\fP \fIage range\fP" The HTML reports produced by \fBagedu\fP use a range of colours to indicate how long ago data was last accessed, running from red (representing the most disused data) to green (representing the newest). By default, the lengths of time represented by the two ends of that spectrum are chosen by examining the data file to see what range of ages appears in it. However, you might want to set your own limits, and you can do this using \fB-r\fP. .RS .PP The argument to \fB-r\fP consists of a single age, or two ages separated by a minus sign. An age is a number, followed by one of `\fBy\fP' (years), `\fBm\fP' (months), `\fBw\fP' (weeks) or `\fBd\fP' (days). (This syntax is also used by the \fB-a\fP option.) The first age in the range represents the oldest data, and will be coloured red in the HTML; the second age represents the newest, coloured green. If the second age is not specified, it will default to zero (so that green means data which has been accessed \fIjust now\fP). .PP For example, \fB-r 2y\fP will mark data in red if it has been unused for two years or more, and green if it has been accessed just now. \fB-r 2y-3m\fP will similarly mark data red if it has been unused for two years or more, but will mark it green if it has been accessed three months ago or later. .RE .IP "\fB--address\fP \fIaddr\fP[\fB:\fP\fIport\fP]" Specifies the network address and port number on which \fBagedu\fP should listen when running its web server. If you want \fBagedu\fP to listen for connections coming in from any source, specify the address as the special value \fBANY\fP. If the port number is omitted, an arbitrary unused port will be chosen for you and displayed. .RS .PP If you specify this option, \fBagedu\fP will not print its URL on standard output (since you are expected to know what address you told it to listen to). .RE .IP "\fB--auth\fP \fIauth-type\fP" Specifies how \fBagedu\fP should control access to the web pages it serves. The options are as follows: .RS .IP "\fBmagic\fP" This option only works on Linux, and only when the incoming connection is from the same machine that \fBagedu\fP is running on. On Linux, the special file \fB/proc/net/tcp\fP contains a list of network connections currently known to the operating system kernel, including which user id created them. So \fBagedu\fP will look up each incoming connection in that file, and allow access if it comes from the same user id under which \fBagedu\fP itself is running. Therefore, in \fBagedu\fP\*(Aqs normal web server mode, you can safely run it on a multi-user machine and no other user will be able to read data out of your index file. .IP "\fBbasic\fP" In this mode, \fBagedu\fP will use HTTP Basic authentication: the user will have to provide a username and password via their browser. \fBagedu\fP will normally make up a username and password for the purpose, but you can specify your own; see below. .IP "\fBnone\fP" In this mode, the web server is unauthenticated: anyone connecting to it has full access to the reports generated by \fBagedu\fP. Do not do this unless there is nothing confidential at all in your index file, or unless you are certain that nobody but you can run processes on your computer. .IP "\fBdefault\fP" This is the default mode if you do not specify one of the above. In this mode, \fBagedu\fP will attempt to use Linux magic authentication, but if it detects at startup time that \fB/proc/net/tcp\fP is absent or non-functional then it will fall back to using HTTP Basic authentication and invent a user name and password. .RE .IP "\fB--auth-file\fP \fIfilename\fP or \fB--auth-fd\fP \fIfd\fP" When \fBagedu\fP is using HTTP Basic authentication, these options allow you to specify your own user name and password. If you specify \fB--auth-file\fP, these will be read from the specified file; if you specify \fB--auth-fd\fP they will instead be read from a given file descriptor which you should have arranged to pass to \fBagedu\fP. In either case, the authentication details should consist of the username, followed by a colon, followed by the password, followed \fIimmediately\fP by end of file (no trailing newline, or else it will be considered part of the password). .IP "\fB--title\fP \fItitle\fP" Specify the string that appears at the start of the \fB<title>\fP section of the output HTML pages. The default is `\fBagedu\fP'. This title is followed by a colon and then the path you\*(Aqre viewing within the index file. You might use this option if you were serving \fBagedu\fP reports for several different servers and wanted to make it clearer which one a user was looking at. .IP "\fB--no-eof\fP" Stop \fBagedu\fP in web server mode from looking for end-of-file on standard input and treating it as a signal to terminate. .SH "LIMITATIONS" .PP The data file is pretty large. The core of \fBagedu\fP is the tree-based data structure it uses in its index in order to efficiently perform the queries it needs; this data structure requires \fBO(N log N)\fP storage. This is larger than you might expect; a scan of my own home directory, containing half a million files and directories and about 20Gb of data, produced an index file over 60Mb in size. Furthermore, since the data file must be memory-mapped during most processing, it can never grow larger than available address space, so a \fIreally\fP big filesystem may need to be indexed on a 64-bit computer. (This is one reason for the existence of the \fB-D\fP and \fB-L\fP options: you can do the scanning on the machine with access to the filesystem, and the indexing on a machine big enough to handle it.) .PP The data structure also does not usefully permit access control within the data file, so it would be difficult - even given the willingness to do additional coding - to run a system-wide \fBagedu\fP scan on a \fBcron\fP job and serve the right subset of reports to each user. .PP In certain circumstances, \fBagedu\fP can report false positives (reporting files as disused which are in fact in use) as well as the more benign false negatives (reporting files as in use which are not). This arises when a file is, semantically speaking, `read' without actually being physically \fIread\fP. Typically this occurs when a program checks whether the file\*(Aqs mtime has changed and only bothers re-reading it if it has; programs which do this include \fBrsync\fP(\fI1\fP) and \fBmake\fP(\fI1\fP). Such programs will fail to update the atime of unmodified files despite depending on their continued existence; a directory full of such files will be reported as disused by \fBagedu\fP even in situations where deleting them will cause trouble. .PP Finally, of course, \fBagedu\fP\*(Aqs normal usage mode depends critically on the OS providing last-access times which are at least approximately right. So a file system mounted with Linux\*(Aqs `\fBnoatime\fP' option, or the equivalent on any other OS, will not give useful results! (However, the Linux mount option `\fBrelatime\fP', which distributions now tend to use by default, should be fine for all but specialist purposes: it reduces the accuracy of last-access times so that they might be wrong by up to 24 hours, but if you\*(Aqre looking for files that have been unused for months or years, that\*(Aqs not a problem.) .SH "LICENCE" .PP \fBagedu\fP is free software, distributed under the MIT licence. Type \fBagedu --licence\fP to see the full licence text. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������