tftp-hpa-5.2/0000775000200200020020000000000011671225441011170 5ustar hpahpatftp-hpa-5.2/tftp/0000775000200200020020000000000011671225440012144 5ustar hpahpatftp-hpa-5.2/tftp/tftp.1.in0000664000200200020020000001445411671225440013620 0ustar hpahpa.\" -*- nroff -*- --------------------------------------------------------- * .\" .\" Copyright (c) 1990, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" Copyright 2001 H. Peter Anvin - All Rights Reserved .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\"----------------------------------------------------------------------- */ .TH TFTP 1 "23 July 2008" "tftp-hpa @@VERSION@@" "User's Manual" .SH NAME .B tftp \- IPv4 Trivial File Transfer Protocol client .SH SYNOPSIS .B tftp [ \fIoptions...\fP ] [\fIhost\fP [\fIport\fP]] [\fB\-c\fP \fIcommand\fP] .br .SH DESCRIPTION .B tftp is a client for the Trivial file Transfer Protocol, which can be used to transfer files to and from remote machines, including some very minimalistic, usually embedded, systems. The remote .I host may be specified on the command line, in which case .B tftp uses .I host as the default host for future transfers (see the .B connect command below.) .SH OPTIONS .TP .B \-4 Connect with IPv4 only, even if IPv6 support was compiled in. .TP .B \-6 Connect with IPv6 only, if compiled in. .TP \fB\-c\fP \fIcommand\fP Execute \fIcommand\fP as if it had been entered on the tftp prompt. Must be specified last on the command line. .TP .B \-l Default to literal mode. Used to avoid special processing of ':' in a file name. .TP \fB\-m\fP \fImode\fP Set the default transfer mode to \fImode\fP. This is usually used with \-c. .TP \fB\-R\fP \fIport:port\fP Force the originating port number to be in the specified range of port numbers. .TP .B \-v Default to verbose mode. .TP .B \-V Print the version number and configuration to standard output, then exit gracefully. .SH COMMANDS Once .B tftp is running, it issues the prompt \f(CWtftp>\fP and recognizes the following commands: .TP \fB?\fP \fIcommand-name...\fP .TP \fBhelp\fP \fIcommand-name...\fP Print help information .TP .B ascii Shorthand for .BR "mode ascii" . .TP .B binary Shorthand for .BR "mode binary" . .TP \fBconnect\fP \fIhost [port]\fP Set the .I host (and optionally .IR port ) for transfers. Note that the TFTP protocol, unlike the FTP protocol, does not maintain connections between transfers; thus, the .B connect command does not actually create a connection, but merely remembers what host is to be used for transfers. You do not have to use the .B connect command; the remote host can be specified as part of the .B get or .B put commands. .TP \fBget\fP \fIfile\fP .sp -.6l .TP \fBget\fP \fIremotefile localfile\fP .sp -.6l .TP \fBget\fP \fIfile1 file2 file3...\fP Get a file or set of files from the specified sources. A remote filename can be in one of two forms: a plain filename on the remote host, if the host has already been specified, or a string of the form .I "host:filename" to specify both a host and filename at the same time. If the latter form is used, the last hostname specified becomes the default for future transfers. Enable .B literal mode to prevent special treatment of the ':' character (e.g. C:\\dir\\file). .TP .B literal Toggle literal mode. When set, this mode prevents special treatment of ':' in filenames. .TP \fBmode\fP \fItransfer-mode\fP Specify the mode for transfers; .I transfer-mode may be one of .B ascii (or .BR netascii ) or .B binary (or .BR octet .) The default is .BR ascii . .TP \fBput\fP \fIfile\fP .sp -.6l .TP \fBput\fP \fIlocalfile remotefile\fP .sp -.6l .TP \fBput\fP \fIfile1 file2 file3... remote-directory\fP Put a file or set of files to the specified remote file or directory. The destination can be in one of two forms: a filename on the remote host, if the host has already been specified, or a string of the form .I "host:filename" to specify both a host and filename at the same time. If the latter form is used, the hostname specified becomes the default for future transfers. If the remote-directory form is used, the remote host is assumed to be a UNIX system or another system using .B / as directory separator. Enable .B literal mode to prevent special treatment of the ':' character (e.g. C:\\dir\\file). .TP .B quit Exit .BR tftp . End-of-file will also exit. .TP \fBrexmt\fP \fIretransmission-timeout\fP Set the per-packet retransmission timeout, in seconds. .TP .B status Show current status. .TP \fBtimeout\fP \fItotal-transmission-timeout\fP Set the total transmission timeout, in seconds. .TP .B trace Toggle packet tracing (a debugging feature.) .TP .B verbose Toggle verbose mode. .SH "NOTES" The TFTP protocol provides no provisions for authentication or security. Therefore, the remote server will probably implement some kinds of access restriction or firewalling. These access restrictions are likely to be site- and server-specific. .SH "AUTHOR" This version of .B tftp is maintained by H. Peter Anvin . It was derived from, but has substantially diverged from, an OpenBSD source base, with added patches by Markus Gutschke and Gero Kulhman. .SH "SEE ALSO" .BR tftpd (8). tftp-hpa-5.2/tftp/extern.h0000664000200200020020000000367311671225440013633 0ustar hpahpa/* * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef RECVFILE_H #define RECVFILE_H void tftp_recvfile(int, const char *, const char *); void tftp_sendfile(int, const char *, const char *); #endif tftp-hpa-5.2/tftp/tftp.c0000664000200200020020000003113611671225440013271 0ustar hpahpa/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "common/tftpsubs.h" /* * TFTP User Program -- Protocol Machines */ #include "extern.h" extern union sock_addr peeraddr; /* filled in by main */ extern int f; /* the opened socket */ extern int trace; extern int verbose; extern int rexmtval; extern int maxtimeout; #define PKTSIZE SEGSIZE+4 char ackbuf[PKTSIZE]; int timeout; sigjmp_buf toplevel; sigjmp_buf timeoutbuf; static void nak(int, const char *); static int makerequest(int, const char *, struct tftphdr *, const char *); static void printstats(const char *, unsigned long); static void startclock(void); static void stopclock(void); static void timer(int); static void tpacket(const char *, struct tftphdr *, int); /* * Send the requested file. */ void tftp_sendfile(int fd, const char *name, const char *mode) { struct tftphdr *ap; /* data and ack packets */ struct tftphdr *dp; int n; volatile int is_request; volatile u_short block; volatile int size, convert; volatile off_t amount; union sock_addr from; socklen_t fromlen; FILE *file; u_short ap_opcode, ap_block; startclock(); /* start stat's clock */ dp = r_init(); /* reset fillbuf/read-ahead code */ ap = (struct tftphdr *)ackbuf; convert = !strcmp(mode, "netascii"); file = fdopen(fd, convert ? "rt" : "rb"); block = 0; is_request = 1; /* First packet is the actual WRQ */ amount = 0; bsd_signal(SIGALRM, timer); do { if (is_request) { size = makerequest(WRQ, name, dp, mode) - 4; } else { /* size = read(fd, dp->th_data, SEGSIZE); */ size = readit(file, &dp, convert); if (size < 0) { nak(errno + 100, NULL); break; } dp->th_opcode = htons((u_short) DATA); dp->th_block = htons((u_short) block); } timeout = 0; (void)sigsetjmp(timeoutbuf, 1); if (trace) tpacket("sent", dp, size + 4); n = sendto(f, dp, size + 4, 0, &peeraddr.sa, SOCKLEN(&peeraddr)); if (n != size + 4) { perror("tftp: sendto"); goto abort; } read_ahead(file, convert); for (;;) { alarm(rexmtval); do { fromlen = sizeof(from); n = recvfrom(f, ackbuf, sizeof(ackbuf), 0, &from.sa, &fromlen); } while (n <= 0); alarm(0); if (n < 0) { perror("tftp: recvfrom"); goto abort; } sa_set_port(&peeraddr, SOCKPORT(&from)); /* added */ if (trace) tpacket("received", ap, n); /* should verify packet came from server */ ap_opcode = ntohs((u_short) ap->th_opcode); ap_block = ntohs((u_short) ap->th_block); if (ap_opcode == ERROR) { printf("Error code %d: %s\n", ap_block, ap->th_msg); goto abort; } if (ap_opcode == ACK) { int j; if (ap_block == block) { break; } /* On an error, try to synchronize * both sides. */ j = synchnet(f); if (j && trace) { printf("discarded %d packets\n", j); } /* * RFC1129/RFC1350: We MUST NOT re-send the DATA * packet in response to an invalid ACK. Doing so * would cause the Sorcerer's Apprentice bug. */ } } if (!is_request) amount += size; is_request = 0; block++; } while (size == SEGSIZE || block == 1); abort: fclose(file); stopclock(); if (amount > 0) printstats("Sent", amount); } /* * Receive a file. */ void tftp_recvfile(int fd, const char *name, const char *mode) { struct tftphdr *ap; struct tftphdr *dp; int n; volatile u_short block; volatile int size, firsttrip; volatile unsigned long amount; union sock_addr from; socklen_t fromlen; FILE *file; volatile int convert; /* true if converting crlf -> lf */ u_short dp_opcode, dp_block; startclock(); dp = w_init(); ap = (struct tftphdr *)ackbuf; convert = !strcmp(mode, "netascii"); file = fdopen(fd, convert ? "wt" : "wb"); block = 1; firsttrip = 1; amount = 0; bsd_signal(SIGALRM, timer); do { if (firsttrip) { size = makerequest(RRQ, name, ap, mode); firsttrip = 0; } else { ap->th_opcode = htons((u_short) ACK); ap->th_block = htons((u_short) block); size = 4; block++; } timeout = 0; (void)sigsetjmp(timeoutbuf, 1); send_ack: if (trace) tpacket("sent", ap, size); if (sendto(f, ackbuf, size, 0, &peeraddr.sa, SOCKLEN(&peeraddr)) != size) { alarm(0); perror("tftp: sendto"); goto abort; } write_behind(file, convert); for (;;) { alarm(rexmtval); do { fromlen = sizeof(from); n = recvfrom(f, dp, PKTSIZE, 0, &from.sa, &fromlen); } while (n <= 0); alarm(0); if (n < 0) { perror("tftp: recvfrom"); goto abort; } sa_set_port(&peeraddr, SOCKPORT(&from)); /* added */ if (trace) tpacket("received", dp, n); /* should verify client address */ dp_opcode = ntohs((u_short) dp->th_opcode); dp_block = ntohs((u_short) dp->th_block); if (dp_opcode == ERROR) { printf("Error code %d: %s\n", dp_block, dp->th_msg); goto abort; } if (dp_opcode == DATA) { int j; if (dp_block == block) { break; /* have next packet */ } /* On an error, try to synchronize * both sides. */ j = synchnet(f); if (j && trace) { printf("discarded %d packets\n", j); } if (dp_block == (block - 1)) { goto send_ack; /* resend ack */ } } } /* size = write(fd, dp->th_data, n - 4); */ size = writeit(file, &dp, n - 4, convert); if (size < 0) { nak(errno + 100, NULL); break; } amount += size; } while (size == SEGSIZE); abort: /* ok to ack, since user */ ap->th_opcode = htons((u_short) ACK); /* has seen err msg */ ap->th_block = htons((u_short) block); (void)sendto(f, ackbuf, 4, 0, (struct sockaddr *)&peeraddr, SOCKLEN(&peeraddr)); write_behind(file, convert); /* flush last buffer */ fclose(file); stopclock(); if (amount > 0) printstats("Received", amount); } static int makerequest(int request, const char *name, struct tftphdr *tp, const char *mode) { char *cp; tp->th_opcode = htons((u_short) request); cp = (char *)&(tp->th_stuff); strcpy(cp, name); cp += strlen(name); *cp++ = '\0'; strcpy(cp, mode); cp += strlen(mode); *cp++ = '\0'; return (cp - (char *)tp); } static const char *const errmsgs[] = { "Undefined error code", /* 0 - EUNDEF */ "File not found", /* 1 - ENOTFOUND */ "Access denied", /* 2 - EACCESS */ "Disk full or allocation exceeded", /* 3 - ENOSPACE */ "Illegal TFTP operation", /* 4 - EBADOP */ "Unknown transfer ID", /* 5 - EBADID */ "File already exists", /* 6 - EEXISTS */ "No such user", /* 7 - ENOUSER */ "Failure to negotiate RFC2347 options" /* 8 - EOPTNEG */ }; #define ERR_CNT (sizeof(errmsgs)/sizeof(const char *)) /* * Send a nak packet (error message). * Error code passed in is one of the * standard TFTP codes, or a UNIX errno * offset by 100. */ static void nak(int error, const char *msg) { struct tftphdr *tp; int length; tp = (struct tftphdr *)ackbuf; tp->th_opcode = htons((u_short) ERROR); tp->th_code = htons((u_short) error); if (error >= 100) { /* This is a Unix errno+100 */ if (!msg) msg = strerror(error - 100); error = EUNDEF; } else { if ((unsigned)error >= ERR_CNT) error = EUNDEF; if (!msg) msg = errmsgs[error]; } tp->th_code = htons((u_short) error); length = strlen(msg) + 1; memcpy(tp->th_msg, msg, length); length += 4; /* Add space for header */ if (trace) tpacket("sent", tp, length); if (sendto(f, ackbuf, length, 0, &peeraddr.sa, SOCKLEN(&peeraddr)) != length) perror("nak"); } static void tpacket(const char *s, struct tftphdr *tp, int n) { static const char *opcodes[] = { "#0", "RRQ", "WRQ", "DATA", "ACK", "ERROR", "OACK" }; char *cp, *file; u_short op = ntohs((u_short) tp->th_opcode); if (op < RRQ || op > ERROR) printf("%s opcode=%x ", s, op); else printf("%s %s ", s, opcodes[op]); switch (op) { case RRQ: case WRQ: n -= 2; file = cp = (char *)&(tp->th_stuff); cp = strchr(cp, '\0'); printf("\n", file, cp + 1); break; case DATA: printf("\n", ntohs(tp->th_block), n - 4); break; case ACK: printf("\n", ntohs(tp->th_block)); break; case ERROR: printf("\n", ntohs(tp->th_code), tp->th_msg); break; } } struct timeval tstart; struct timeval tstop; static void startclock(void) { (void)gettimeofday(&tstart, NULL); } static void stopclock(void) { (void)gettimeofday(&tstop, NULL); } static void printstats(const char *direction, unsigned long amount) { double delta; delta = (tstop.tv_sec + (tstop.tv_usec / 100000.0)) - (tstart.tv_sec + (tstart.tv_usec / 100000.0)); if (verbose) { printf("%s %lu bytes in %.1f seconds", direction, amount, delta); printf(" [%.0f bit/s]", (amount * 8.) / delta); putchar('\n'); } } static void timer(int sig) { int save_errno = errno; (void)sig; /* Shut up unused warning */ timeout += rexmtval; if (timeout >= maxtimeout) { printf("Transfer timed out.\n"); errno = save_errno; siglongjmp(toplevel, -1); } errno = save_errno; siglongjmp(timeoutbuf, 1); } tftp-hpa-5.2/tftp/main.c0000664000200200020020000005631111671225440013242 0ustar hpahpa/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "common/tftpsubs.h" /* Many bug fixes are from Jim Guyton */ /* * TFTP User Program -- Command Interface. */ #include #include #ifdef WITH_READLINE #include #ifdef HAVE_READLINE_HISTORY_H #include #endif #endif #include "extern.h" #define TIMEOUT 5 /* secs between rexmt's */ #define LBUFLEN 200 /* size of input buffer */ struct modes { const char *m_name; const char *m_mode; int m_openflags; }; static const struct modes modes[] = { {"netascii", "netascii", O_TEXT}, {"ascii", "netascii", O_TEXT}, {"octet", "octet", O_BINARY}, {"binary", "octet", O_BINARY}, {"image", "octet", O_BINARY}, {0, 0, 0} }; #define MODE_OCTET (&modes[2]) #define MODE_NETASCII (&modes[0]) #define MODE_DEFAULT MODE_NETASCII #ifdef HAVE_IPV6 int ai_fam = AF_UNSPEC; int ai_fam_sock = AF_UNSPEC; #else int ai_fam = AF_INET; int ai_fam_sock = AF_INET; #endif union sock_addr peeraddr; int f = -1; u_short port; int trace; int verbose; int literal; int connected; const struct modes *mode; #ifdef WITH_READLINE char *line = NULL; #else char line[LBUFLEN]; #endif int margc; char *margv[20]; const char *prompt = "tftp> "; sigjmp_buf toplevel; void intr(int); struct servent *sp; int portrange = 0; unsigned int portrange_from = 0; unsigned int portrange_to = 0; void get(int, char **); void help(int, char **); void modecmd(int, char **); void put(int, char **); void quit(int, char **); void setascii(int, char **); void setbinary(int, char **); void setpeer(int, char **); void setrexmt(int, char **); void settimeout(int, char **); void settrace(int, char **); void setverbose(int, char **); void status(int, char **); void setliteral(int, char **); static void command(void); static void getusage(char *); static void makeargv(void); static void putusage(char *); static void settftpmode(const struct modes *); #define HELPINDENT (sizeof("connect")) struct cmd { const char *name; const char *help; void (*handler) (int, char **); }; struct cmd cmdtab[] = { {"connect", "connect to remote tftp", setpeer}, {"mode", "set file transfer mode", modecmd}, {"put", "send file", put}, {"get", "receive file", get}, {"quit", "exit tftp", quit}, {"verbose", "toggle verbose mode", setverbose}, {"trace", "toggle packet tracing", settrace}, {"literal", "toggle literal mode, ignore ':' in file name", setliteral}, {"status", "show current status", status}, {"binary", "set mode to octet", setbinary}, {"ascii", "set mode to netascii", setascii}, {"rexmt", "set per-packet transmission timeout", setrexmt}, {"timeout", "set total retransmission timeout", settimeout}, {"?", "print help information", help}, {"help", "print help information", help}, {0, 0, 0} }; struct cmd *getcmd(char *); char *tail(char *); char *xstrdup(const char *); const char *program; static inline void usage(int errcode) { fprintf(stderr, #ifdef HAVE_IPV6 "Usage: %s [-4][-6][-v][-l][-m mode] [host [port]] [-c command]\n", #else "Usage: %s [-v][-l][-m mode] [host [port]] [-c command]\n", #endif program); exit(errcode); } int main(int argc, char *argv[]) { union sock_addr sa; int arg; static int pargc, peerargc; static int iscmd = 0; char **pargv; const char *optx; char *peerargv[3]; program = argv[0]; mode = MODE_DEFAULT; peerargv[0] = argv[0]; peerargc = 1; for (arg = 1; !iscmd && arg < argc; arg++) { if (argv[arg][0] == '-') { for (optx = &argv[arg][1]; *optx; optx++) { switch (*optx) { case '4': ai_fam = AF_INET; break; #ifdef HAVE_IPV6 case '6': ai_fam = AF_INET6; break; #endif case 'v': verbose = 1; break; case 'V': /* Print version and configuration to stdout and exit */ printf("%s\n", TFTP_CONFIG_STR); exit(0); case 'l': literal = 1; break; case 'm': if (++arg >= argc) usage(EX_USAGE); { const struct modes *p; for (p = modes; p->m_name; p++) { if (!strcmp(argv[arg], p->m_name)) break; } if (p->m_name) { settftpmode(p); } else { fprintf(stderr, "%s: invalid mode: %s\n", argv[0], argv[arg]); exit(EX_USAGE); } } break; case 'c': iscmd = 1; break; case 'R': if (++arg >= argc) usage(EX_USAGE); if (sscanf (argv[arg], "%u:%u", &portrange_from, &portrange_to) != 2 || portrange_from > portrange_to || portrange_to > 65535) { fprintf(stderr, "Bad port range: %s\n", argv[arg]); exit(EX_USAGE); } portrange = 1; break; case 'h': default: usage(*optx == 'h' ? 0 : EX_USAGE); } } } else { if (peerargc >= 3) usage(EX_USAGE); peerargv[peerargc++] = argv[arg]; } } ai_fam_sock = ai_fam; pargv = argv + arg; pargc = argc - arg; sp = getservbyname("tftp", "udp"); if (sp == 0) { /* Use canned values */ if (verbose) fprintf(stderr, "tftp: tftp/udp: unknown service, faking it...\n"); sp = xmalloc(sizeof(struct servent)); sp->s_name = (char *)"tftp"; sp->s_aliases = NULL; sp->s_port = htons(IPPORT_TFTP); sp->s_proto = (char *)"udp"; } bsd_signal(SIGINT, intr); if (peerargc) { /* Set peer */ if (sigsetjmp(toplevel, 1) != 0) exit(EX_NOHOST); setpeer(peerargc, peerargv); } if (ai_fam_sock == AF_UNSPEC) ai_fam_sock = AF_INET; f = socket(ai_fam_sock, SOCK_DGRAM, 0); if (f < 0) { perror("tftp: socket"); exit(EX_OSERR); } bzero(&sa, sizeof(sa)); sa.sa.sa_family = ai_fam_sock; if (pick_port_bind(f, &sa, portrange_from, portrange_to)) { perror("tftp: bind"); exit(EX_OSERR); } if (iscmd && pargc) { /* -c specified; execute command and exit */ struct cmd *c; if (sigsetjmp(toplevel, 1) != 0) exit(EX_UNAVAILABLE); c = getcmd(pargv[0]); if (c == (struct cmd *)-1 || c == (struct cmd *)0) { fprintf(stderr, "%s: invalid command: %s\n", argv[0], pargv[1]); exit(EX_USAGE); } (*c->handler) (pargc, pargv); exit(0); } #ifdef WITH_READLINE #ifdef HAVE_READLINE_HISTORY_H using_history(); #endif #endif if (sigsetjmp(toplevel, 1) != 0) (void)putchar('\n'); command(); return 0; /* Never reached */ } char *hostname; /* Called when a command is incomplete; modifies the global variable "line" */ static void getmoreargs(const char *partial, const char *mprompt) { #ifdef WITH_READLINE char *eline; int len, elen; len = strlen(partial); eline = readline(mprompt); if (!eline) exit(0); /* EOF */ elen = strlen(eline); if (line) { free(line); line = NULL; } line = xmalloc(len + elen + 1); strcpy(line, partial); strcpy(line + len, eline); free(eline); #ifdef HAVE_READLINE_HISTORY_H add_history(line); #endif #else int len = strlen(partial); strcpy(line, partial); fputs(mprompt, stdout); if (fgets(line + len, LBUFLEN - len, stdin) == 0) if (feof(stdin)) exit(0); /* EOF */ #endif } void setpeer(int argc, char *argv[]) { int err; if (argc < 2) { getmoreargs("connect ", "(to) "); makeargv(); argc = margc; argv = margv; } if ((argc < 2) || (argc > 3)) { printf("usage: %s host-name [port]\n", argv[0]); return; } peeraddr.sa.sa_family = ai_fam; err = set_sock_addr(argv[1], &peeraddr, &hostname); if (err) { printf("Error: %s\n", gai_strerror(err)); printf("%s: unknown host\n", argv[1]); connected = 0; return; } ai_fam = peeraddr.sa.sa_family; if (f == -1) { /* socket not open */ ai_fam_sock = ai_fam; } else { /* socket was already open */ if (ai_fam_sock != ai_fam) { /* need reopen socken for new family */ union sock_addr sa; close(f); ai_fam_sock = ai_fam; f = socket(ai_fam_sock, SOCK_DGRAM, 0); if (f < 0) { perror("tftp: socket"); exit(EX_OSERR); } bzero((char *)&sa, sizeof (sa)); sa.sa.sa_family = ai_fam_sock; if (pick_port_bind(f, &sa, portrange_from, portrange_to)) { perror("tftp: bind"); exit(EX_OSERR); } } } port = sp->s_port; if (argc == 3) { struct servent *usp; usp = getservbyname(argv[2], "udp"); if (usp) { port = usp->s_port; } else { unsigned long myport; char *ep; myport = strtoul(argv[2], &ep, 10); if (*ep || myport > 65535UL) { printf("%s: bad port number\n", argv[2]); connected = 0; return; } port = htons((u_short) myport); } } if (verbose) { char tmp[INET6_ADDRSTRLEN], *tp; tp = (char *)inet_ntop(peeraddr.sa.sa_family, SOCKADDR_P(&peeraddr), tmp, INET6_ADDRSTRLEN); if (!tp) tp = (char *)"???"; printf("Connected to %s (%s), port %u\n", hostname, tp, (unsigned int)ntohs(port)); } connected = 1; } void modecmd(int argc, char *argv[]) { const struct modes *p; const char *sep; if (argc < 2) { printf("Using %s mode to transfer files.\n", mode->m_mode); return; } if (argc == 2) { for (p = modes; p->m_name; p++) if (strcmp(argv[1], p->m_name) == 0) break; if (p->m_name) { settftpmode(p); return; } printf("%s: unknown mode\n", argv[1]); /* drop through and print usage message */ } printf("usage: %s [", argv[0]); sep = " "; for (p = modes; p->m_name; p++) { printf("%s%s", sep, p->m_name); if (*sep == ' ') sep = " | "; } printf(" ]\n"); return; } void setbinary(int argc, char *argv[]) { (void)argc; (void)argv; /* Quiet unused warning */ settftpmode(MODE_OCTET); } void setascii(int argc, char *argv[]) { (void)argc; (void)argv; /* Quiet unused warning */ settftpmode(MODE_NETASCII); } static void settftpmode(const struct modes *newmode) { mode = newmode; if (verbose) printf("mode set to %s\n", mode->m_mode); } /* * Send file(s). */ void put(int argc, char *argv[]) { int fd; int n, err; char *cp, *targ; if (argc < 2) { getmoreargs("send ", "(file) "); makeargv(); argc = margc; argv = margv; } if (argc < 2) { putusage(argv[0]); return; } targ = argv[argc - 1]; if (!literal && strchr(argv[argc - 1], ':')) { for (n = 1; n < argc - 1; n++) if (strchr(argv[n], ':')) { putusage(argv[0]); return; } cp = argv[argc - 1]; targ = strchr(cp, ':'); *targ++ = 0; peeraddr.sa.sa_family = ai_fam; err = set_sock_addr(cp, &peeraddr,&hostname); if (err) { printf("Error: %s\n", gai_strerror(err)); printf("%s: unknown host\n", argv[1]); connected = 0; return; } ai_fam = peeraddr.sa.sa_family; connected = 1; } if (!connected) { printf("No target machine specified.\n"); return; } if (argc < 4) { cp = argc == 2 ? tail(targ) : argv[1]; fd = open(cp, O_RDONLY | mode->m_openflags); if (fd < 0) { fprintf(stderr, "tftp: "); perror(cp); return; } if (verbose) printf("putting %s to %s:%s [%s]\n", cp, hostname, targ, mode->m_mode); sa_set_port(&peeraddr, port); tftp_sendfile(fd, targ, mode->m_mode); return; } /* this assumes the target is a directory */ /* on a remote unix system. hmmmm. */ cp = strchr(targ, '\0'); *cp++ = '/'; for (n = 1; n < argc - 1; n++) { strcpy(cp, tail(argv[n])); fd = open(argv[n], O_RDONLY | mode->m_openflags); if (fd < 0) { fprintf(stderr, "tftp: "); perror(argv[n]); continue; } if (verbose) printf("putting %s to %s:%s [%s]\n", argv[n], hostname, targ, mode->m_mode); sa_set_port(&peeraddr, port); tftp_sendfile(fd, targ, mode->m_mode); } } static void putusage(char *s) { printf("usage: %s file ... host:target, or\n", s); printf(" %s file ... target (when already connected)\n", s); } /* * Receive file(s). */ void get(int argc, char *argv[]) { int fd; int n; char *cp; char *src; if (argc < 2) { getmoreargs("get ", "(files) "); makeargv(); argc = margc; argv = margv; } if (argc < 2) { getusage(argv[0]); return; } if (!connected) { for (n = 1; n < argc; n++) if (literal || strchr(argv[n], ':') == 0) { getusage(argv[0]); return; } } for (n = 1; n < argc; n++) { src = strchr(argv[n], ':'); if (literal || src == NULL) src = argv[n]; else { int err; *src++ = 0; peeraddr.sa.sa_family = ai_fam; err = set_sock_addr(argv[n], &peeraddr, &hostname); if (err) { printf("Warning: %s\n", gai_strerror(err)); printf("%s: unknown host\n", argv[1]); continue; } ai_fam = peeraddr.sa.sa_family; connected = 1; } if (argc < 4) { cp = argc == 3 ? argv[2] : tail(src); fd = open(cp, O_WRONLY | O_CREAT | O_TRUNC | mode->m_openflags, 0666); if (fd < 0) { fprintf(stderr, "tftp: "); perror(cp); return; } if (verbose) printf("getting from %s:%s to %s [%s]\n", hostname, src, cp, mode->m_mode); sa_set_port(&peeraddr, port); tftp_recvfile(fd, src, mode->m_mode); break; } cp = tail(src); /* new .. jdg */ fd = open(cp, O_WRONLY | O_CREAT | O_TRUNC | mode->m_openflags, 0666); if (fd < 0) { fprintf(stderr, "tftp: "); perror(cp); continue; } if (verbose) printf("getting from %s:%s to %s [%s]\n", hostname, src, cp, mode->m_mode); sa_set_port(&peeraddr, port); tftp_recvfile(fd, src, mode->m_mode); } } static void getusage(char *s) { printf("usage: %s host:file host:file ... file, or\n", s); printf(" %s file file ... file if connected\n", s); } int rexmtval = TIMEOUT; void setrexmt(int argc, char *argv[]) { int t; if (argc < 2) { getmoreargs("rexmt-timeout ", "(value) "); makeargv(); argc = margc; argv = margv; } if (argc != 2) { printf("usage: %s value\n", argv[0]); return; } t = atoi(argv[1]); if (t < 0) printf("%s: bad value\n", argv[1]); else rexmtval = t; } int maxtimeout = 5 * TIMEOUT; void settimeout(int argc, char *argv[]) { int t; if (argc < 2) { getmoreargs("maximum-timeout ", "(value) "); makeargv(); argc = margc; argv = margv; } if (argc != 2) { printf("usage: %s value\n", argv[0]); return; } t = atoi(argv[1]); if (t < 0) printf("%s: bad value\n", argv[1]); else maxtimeout = t; } void setliteral(int argc, char *argv[]) { (void)argc; (void)argv; /* Quiet unused warning */ literal = !literal; printf("Literal mode %s.\n", literal ? "on" : "off"); } void status(int argc, char *argv[]) { (void)argc; (void)argv; /* Quiet unused warning */ if (connected) printf("Connected to %s.\n", hostname); else printf("Not connected.\n"); printf("Mode: %s Verbose: %s Tracing: %s Literal: %s\n", mode->m_mode, verbose ? "on" : "off", trace ? "on" : "off", literal ? "on" : "off"); printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n", rexmtval, maxtimeout); } void intr(int sig) { (void)sig; /* Quiet unused warning */ bsd_signal(SIGALRM, SIG_IGN); alarm(0); siglongjmp(toplevel, -1); } char *tail(char *filename) { char *s; while (*filename) { s = strrchr(filename, '/'); if (s == NULL) break; if (s[1]) return (s + 1); *s = '\0'; } return (filename); } /* * Command parser. */ static void command(void) { struct cmd *c; for (;;) { #ifdef WITH_READLINE if (line) { free(line); line = NULL; } line = readline(prompt); if (!line) exit(0); /* EOF */ #else fputs(prompt, stdout); if (fgets(line, LBUFLEN, stdin) == 0) { if (feof(stdin)) { exit(0); } else { continue; } } #endif if ((line[0] == 0) || (line[0] == '\n')) continue; #ifdef WITH_READLINE #ifdef HAVE_READLINE_HISTORY_H add_history(line); #endif #endif makeargv(); if (margc == 0) continue; c = getcmd(margv[0]); if (c == (struct cmd *)-1) { printf("?Ambiguous command\n"); continue; } if (c == 0) { printf("?Invalid command\n"); continue; } (*c->handler) (margc, margv); } } struct cmd *getcmd(char *name) { const char *p; char *q; struct cmd *c, *found; int nmatches, longest; longest = 0; nmatches = 0; found = 0; for (c = cmdtab; (p = c->name) != NULL; c++) { for (q = name; *q == *p++; q++) if (*q == 0) /* exact match? */ return (c); if (!*q) { /* the name was a prefix */ if (q - name > longest) { longest = q - name; nmatches = 1; found = c; } else if (q - name == longest) nmatches++; } } if (nmatches > 1) return ((struct cmd *)-1); return (found); } /* * Slice a string up into argc/argv. */ static void makeargv(void) { char *cp; char **argp = margv; margc = 0; for (cp = line; *cp;) { while (isspace(*cp)) cp++; if (*cp == '\0') break; *argp++ = cp; margc += 1; while (*cp != '\0' && !isspace(*cp)) cp++; if (*cp == '\0') break; *cp++ = '\0'; } *argp++ = 0; } void quit(int argc, char *argv[]) { (void)argc; (void)argv; /* Quiet unused warning */ exit(0); } /* * Help command. */ void help(int argc, char *argv[]) { struct cmd *c; printf("%s\n", VERSION); if (argc == 1) { printf("Commands may be abbreviated. Commands are:\n\n"); for (c = cmdtab; c->name; c++) printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help); return; } while (--argc > 0) { char *arg; arg = *++argv; c = getcmd(arg); if (c == (struct cmd *)-1) printf("?Ambiguous help command %s\n", arg); else if (c == (struct cmd *)0) printf("?Invalid help command %s\n", arg); else printf("%s\n", c->help); } } void settrace(int argc, char *argv[]) { (void)argc; (void)argv; /* Quiet unused warning */ trace = !trace; printf("Packet tracing %s.\n", trace ? "on" : "off"); } void setverbose(int argc, char *argv[]) { (void)argc; (void)argv; /* Quiet unused warning */ verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); } tftp-hpa-5.2/tftp/Makefile0000664000200200020020000000106211671225440013603 0ustar hpahpaSRCROOT = .. VERSION = $(shell cat ../version) -include ../MCONFIG include ../MRULES OBJS = tftp.$(O) main.$(O) all: tftp$(X) tftp.1 tftp$(X): $(OBJS) $(CC) $(LDFLAGS) $^ $(TFTP_LIBS) -o $@ $(OBJS): ../common/tftpsubs.h tftp.1: tftp.1.in ../version sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@ install: all mkdir -p $(INSTALLROOT)$(BINDIR) $(INSTALLROOT)$(MANDIR)/man1 $(INSTALL_PROGRAM) tftp$(X) $(INSTALLROOT)$(BINDIR) $(INSTALL_DATA) tftp.1 $(INSTALLROOT)$(MANDIR)/man1 clean: rm -f *.o *.obj *.exe tftp tftp.1 distclean: clean rm -f *~ tftp-hpa-5.2/README0000664000200200020020000000160711671225440012053 0ustar hpahpaThis is tftp-hpa, a conglomerate of a number of versions of the BSD TFTP code, changed around to port to a whole collection of operating systems. The goal is to work on any reasonably modern Unix with sockets. The tftp-hpa series is maintained by H. Peter Anvin . The latest version of this collection can be found at: ftp://ftp.kernel.org/pub/software/network/tftp/ See the file CHANGES for a list of changes between versions. Please see the INSTALL and INSTALL.tftp files for compilation and installation instructions. ===> IMPORTANT: IF YOU ARE UPGRADING FROM ANOTHER TFTP SERVER, OR FROM ===> A VERSION OF TFTP-HPA OLDER THAN 0.17 SEE THE FILE ===> "README.security" FOR IMPORTANT SECURITY MODEL CHANGES! This software can be discussed on the SYSLINUX mailing list. To subscribe, go to the list subscription page at: http://www.zytor.com/mailman/listinfo/syslinux tftp-hpa-5.2/aconfig.h.in0000664000200200020020000001710111671225441013354 0ustar hpahpa/* aconfig.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define if bsd_signal function was found */ #undef HAVE_BSD_SIGNAL /* Define to 1 if you have the `daemon' function. */ #undef HAVE_DAEMON /* Define to 1 if you have the `dup2' function. */ #undef HAVE_DUP2 /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE /* Define if fcntl.h defines F_SETLK */ #undef HAVE_F_SETLK_DEFINITION /* Define if getaddrinfo function was found */ #undef HAVE_GETADDRINFO /* Define if getopt_long function was found */ #undef HAVE_GETOPT_LONG /* Define to 1 if you have the header file. */ #undef HAVE_GRP_H /* Define if inet_ntop function was found */ #undef HAVE_INET_NTOP /* Define to 1 if you have the `initgroups' function. */ #undef HAVE_INITGROUPS /* Define to 1 if the system has the type `intmax_t'. */ #undef HAVE_INTMAX_T /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if netinet/in.h defines IPPORT_TFTP */ #undef HAVE_IPPORT_TFTP_DEFINITION /* Define if IPv6 support is enabled. */ #undef HAVE_IPV6 /* Define to 1 if you have the header file. */ #undef HAVE_LIBGEN_H /* Define to 1 if you have the `wrap' library (-lwrap). */ #undef HAVE_LIBWRAP /* Define if sys/file.h defines LOCK_EX */ #undef HAVE_LOCK_EX_DEFINITION /* Define if sys/file.h defines LOCK_SH */ #undef HAVE_LOCK_SH_DEFINITION /* Define to 1 if the system has the type `long long'. */ #undef HAVE_LONG_LONG /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define if struct msghdr has the msg_control field. */ #undef HAVE_MSGHDR_MSG_CONTROL /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define if fcntl.h defines O_BINARY */ #undef HAVE_O_BINARY_DEFINITION /* Define if fcntl.h defines O_NONBLOCK */ #undef HAVE_O_NONBLOCK_DEFINITION /* Define if fcntl.h defines O_TEXT */ #undef HAVE_O_TEXT_DEFINITION /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_HISTORY_H /* Define to 1 if you have the `recvmsg' function. */ #undef HAVE_RECVMSG /* Define to 1 if you have the `setgroups' function. */ #undef HAVE_SETGROUPS /* Define to 1 if you have the header file. */ #undef HAVE_SETJMP_H /* Define to 1 if you have the `setregid' function. */ #undef HAVE_SETREGID /* Define to 1 if you have the `setreuid' function. */ #undef HAVE_SETREUID /* Define to 1 if you have the `setsid' function. */ #undef HAVE_SETSID /* Define if we have sigsetjmp, siglongjmp and sigjmp_buf. */ #undef HAVE_SIGSETJMP /* Define to 1 if the system has the type `socklen_t'. */ #undef HAVE_SOCKLEN_T /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtoull' function. */ #undef HAVE_STRTOULL /* Define to 1 if you have the `strtoumax' function. */ #undef HAVE_STRTOUMAX /* Define if struct addrinfo is defined. */ #undef HAVE_STRUCT_ADDRINFO /* Define if struct in6_pktinfo is defined. */ #undef HAVE_STRUCT_IN6_PKTINFO /* Define if struct in_pktinfo is defined. */ #undef HAVE_STRUCT_IN_PKTINFO /* Define if struct sockaddr_in6 is defined. */ #undef HAVE_STRUCT_SOCKADDR_IN6 /* Define to 1 if you have the header file. */ #undef HAVE_SYSEXITS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define if we have tcpwrappers (-lwrap) and . */ #undef HAVE_TCPWRAPPERS /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* Define to 1 if the system has the type `uint16_t'. */ #undef HAVE_UINT16_T /* Define to 1 if the system has the type `uint32_t'. */ #undef HAVE_UINT32_T /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if the system has the type `u_long'. */ #undef HAVE_U_LONG /* Define to 1 if the system has the type `u_short'. */ #undef HAVE_U_SHORT /* Define to 1 if you have the header file. */ #undef HAVE_WINSOCK2_H /* Define to 1 if you have the header file. */ #undef HAVE_WINSOCK_H /* Define if xmalloc function was found */ #undef HAVE_XMALLOC /* Define if xstrdup function was found */ #undef HAVE_XSTRDUP /* Define if the macros in are usable */ #undef INTTYPES_H_IS_SANE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Define if we are compiling with readline/editline command-line editing. */ #undef WITH_READLINE /* Define if we are compiling with regex filename remapping. */ #undef WITH_REGEX /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef mode_t /* Define to `long int' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t tftp-hpa-5.2/autogen.sh0000775000200200020020000000003011671225440013161 0ustar hpahpa#!/bin/sh make autoconf tftp-hpa-5.2/configure0000775000200200020020000075137211671225441013116 0ustar hpahpa#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68. # # # 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. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH 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. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_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 &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= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="MCONFIG.in" ac_default_prefix=/usr # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM RANLIB LN_S TFTPDOBJS TFTPD_LIBS TFTP_LIBS OBJROOT SRCROOT LIBOBJS EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC 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_largefile with_tcpwrappers with_remap with_readline with_ipv6 ' 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}' 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 this package 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/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then 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-largefile omit support for large files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-tcpwrappers disable tcpwrapper permissions checking --without-remap disable regex-based filename remapping --without-readline disable the use of readline command-line editing --without-ipv6 disable the support for IPv6 Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.68 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; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $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; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { 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 ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { 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 ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if ${ac_cv_search_strerror+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; 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_strerror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_strerror+:} false; then : break fi done if ${ac_cv_search_strerror+:} false; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 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 if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -W" >&5 $as_echo_n "checking if $CC accepts -W... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -W" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wall" >&5 $as_echo_n "checking if $CC accepts -Wall... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wall" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wpointer-arith" >&5 $as_echo_n "checking if $CC accepts -Wpointer-arith... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wpointer-arith" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wbad-function-cast" >&5 $as_echo_n "checking if $CC accepts -Wbad-function-cast... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wbad-function-cast" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wcast-equal" >&5 $as_echo_n "checking if $CC accepts -Wcast-equal... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wcast-equal" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wstrict-prototypes" >&5 $as_echo_n "checking if $CC accepts -Wstrict-prototypes... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wstrict-prototypes" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wmissing-prototypes" >&5 $as_echo_n "checking if $CC accepts -Wmissing-prototypes... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wmissing-prototypes" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wmissing-declarations" >&5 $as_echo_n "checking if $CC accepts -Wmissing-declarations... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wmissing-declarations" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wnested-externs" >&5 $as_echo_n "checking if $CC accepts -Wnested-externs... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wnested-externs" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Winline" >&5 $as_echo_n "checking if $CC accepts -Winline... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Winline" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wwrite-strings" >&5 $as_echo_n "checking if $CC accepts -Wwrite-strings... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wwrite-strings" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wundef" >&5 $as_echo_n "checking if $CC accepts -Wundef... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wundef" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wshadow" >&5 $as_echo_n "checking if $CC accepts -Wshadow... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wshadow" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -Wsign-compare" >&5 $as_echo_n "checking if $CC accepts -Wsign-compare... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wsign-compare" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -pipe" >&5 $as_echo_n "checking if $CC accepts -pipe... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -pipe" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-strict-aliasing" >&5 $as_echo_n "checking if $CC accepts -fno-strict-aliasing... " >&6; } pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS -fno-strict-aliasing" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("Hello, World!\n"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CFLAGS="$pa_add_cflags__old_cflags" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in inttypes.h do : ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" if test "x$ac_cv_header_inttypes_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_INTTYPES_H 1 _ACEOF fi done for ac_header in stdint.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" if test "x$ac_cv_header_stdint_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDINT_H 1 _ACEOF fi done for ac_header in inttypes.h do : ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" if test "x$ac_cv_header_inttypes_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_INTTYPES_H 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inttypes.h is sane" >&5 $as_echo_n "checking if inttypes.h is sane... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { uintmax_t max = UINTMAX_C(0); printf("%"PRIuMAX"\n", max); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define INTTYPES_H_IS_SANE 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (AIX, eh?)" >&5 $as_echo "no (AIX, eh?)" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi done for ac_header in fcntl.h do : ac_fn_c_check_header_mongrel "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" if test "x$ac_cv_header_fcntl_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FCNTL_H 1 _ACEOF fi done for ac_header in grp.h do : ac_fn_c_check_header_mongrel "$LINENO" "grp.h" "ac_cv_header_grp_h" "$ac_includes_default" if test "x$ac_cv_header_grp_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GRP_H 1 _ACEOF fi done for ac_header in libgen.h do : ac_fn_c_check_header_mongrel "$LINENO" "libgen.h" "ac_cv_header_libgen_h" "$ac_includes_default" if test "x$ac_cv_header_libgen_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGEN_H 1 _ACEOF fi done for ac_header in memory.h do : ac_fn_c_check_header_mongrel "$LINENO" "memory.h" "ac_cv_header_memory_h" "$ac_includes_default" if test "x$ac_cv_header_memory_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMORY_H 1 _ACEOF fi done for ac_header in setjmp.h do : ac_fn_c_check_header_mongrel "$LINENO" "setjmp.h" "ac_cv_header_setjmp_h" "$ac_includes_default" if test "x$ac_cv_header_setjmp_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETJMP_H 1 _ACEOF fi done for ac_header in stddef.h do : ac_fn_c_check_header_mongrel "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" if test "x$ac_cv_header_stddef_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDDEF_H 1 _ACEOF fi done for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done for ac_header in string.h do : ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRING_H 1 _ACEOF fi done for ac_header in strings.h do : ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" if test "x$ac_cv_header_strings_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRINGS_H 1 _ACEOF fi done for ac_header in sysexits.h do : ac_fn_c_check_header_mongrel "$LINENO" "sysexits.h" "ac_cv_header_sysexits_h" "$ac_includes_default" if test "x$ac_cv_header_sysexits_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYSEXITS_H 1 _ACEOF fi done for ac_header in time.h do : ac_fn_c_check_header_mongrel "$LINENO" "time.h" "ac_cv_header_time_h" "$ac_includes_default" if test "x$ac_cv_header_time_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TIME_H 1 _ACEOF fi done for ac_header in unistd.h do : ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNISTD_H 1 _ACEOF fi done for ac_header in sys/file.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/file.h" "ac_cv_header_sys_file_h" "$ac_includes_default" if test "x$ac_cv_header_sys_file_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_FILE_H 1 _ACEOF fi done for ac_header in sys/filio.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" if test "x$ac_cv_header_sys_filio_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_FILIO_H 1 _ACEOF fi done for ac_header in sys/stat.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/stat.h" "ac_cv_header_sys_stat_h" "$ac_includes_default" if test "x$ac_cv_header_sys_stat_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_STAT_H 1 _ACEOF fi done for ac_header in sys/time.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" if test "x$ac_cv_header_sys_time_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_TIME_H 1 _ACEOF fi done for ac_header in sys/types.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_TYPES_H 1 _ACEOF fi done for ac_header in arpa/inet.h do : ac_fn_c_check_header_mongrel "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" if test "x$ac_cv_header_arpa_inet_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ARPA_INET_H 1 _ACEOF fi done for ac_header in netdb.h do : ac_fn_c_check_header_mongrel "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" if test "x$ac_cv_header_netdb_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NETDB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi for ac_header in machine/param.h do : ac_fn_c_check_header_mongrel "$LINENO" "machine/param.h" "ac_cv_header_machine_param_h" "$ac_includes_default" if test "x$ac_cv_header_machine_param_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MACHINE_PARAM_H 1 _ACEOF fi done for ac_header in sys/socket.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" if test "x$ac_cv_header_sys_socket_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_SOCKET_H 1 _ACEOF fi done for ac_header in winsock2.h do : ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" if test "x$ac_cv_header_winsock2_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_WINSOCK2_H 1 _ACEOF fi done for ac_header in winsock.h do : ac_fn_c_check_header_mongrel "$LINENO" "winsock.h" "ac_cv_header_winsock_h" "$ac_includes_default" if test "x$ac_cv_header_winsock_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_WINSOCK_H 1 _ACEOF fi done # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" "$ac_includes_default" if test "x$ac_cv_type_intmax_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_INTMAX_T 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default" if test "x$ac_cv_type_long_long" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LONG_LONG 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" if test "x$ac_cv_type_uint16_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINT16_T 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" if test "x$ac_cv_type_uint32_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINT32_T 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "u_short" "ac_cv_type_u_short" "$ac_includes_default" if test "x$ac_cv_type_u_short" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_U_SHORT 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "u_long" "ac_cv_type_u_long" "$ac_includes_default" if test "x$ac_cv_type_u_long" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_U_LONG 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif " if test "x$ac_cv_type_socklen_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SOCKLEN_T 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if ${ac_cv_search_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF for ac_lib in '' socket ws2_32 wsock32; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_socket+:} false; then : break fi done if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 $as_echo "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "socket library not found" "$LINENO" 5 fi for ac_func in fcntl do : ac_fn_c_check_func "$LINENO" "fcntl" "ac_cv_func_fcntl" if test "x$ac_cv_func_fcntl" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FCNTL 1 _ACEOF fi done for ac_func in setsid do : ac_fn_c_check_func "$LINENO" "setsid" "ac_cv_func_setsid" if test "x$ac_cv_func_setsid" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETSID 1 _ACEOF fi done for ac_func in recvmsg do : ac_fn_c_check_func "$LINENO" "recvmsg" "ac_cv_func_recvmsg" if test "x$ac_cv_func_recvmsg" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_RECVMSG 1 _ACEOF fi done for ac_func in ftruncate do : ac_fn_c_check_func "$LINENO" "ftruncate" "ac_cv_func_ftruncate" if test "x$ac_cv_func_ftruncate" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FTRUNCATE 1 _ACEOF fi done for ac_func in setreuid do : ac_fn_c_check_func "$LINENO" "setreuid" "ac_cv_func_setreuid" if test "x$ac_cv_func_setreuid" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETREUID 1 _ACEOF fi done for ac_func in setregid do : ac_fn_c_check_func "$LINENO" "setregid" "ac_cv_func_setregid" if test "x$ac_cv_func_setregid" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETREGID 1 _ACEOF fi done for ac_func in initgroups do : ac_fn_c_check_func "$LINENO" "initgroups" "ac_cv_func_initgroups" if test "x$ac_cv_func_initgroups" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_INITGROUPS 1 _ACEOF fi done for ac_func in setgroups do : ac_fn_c_check_func "$LINENO" "setgroups" "ac_cv_func_setgroups" if test "x$ac_cv_func_setgroups" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETGROUPS 1 _ACEOF fi done for ac_func in strtoumax do : ac_fn_c_check_func "$LINENO" "strtoumax" "ac_cv_func_strtoumax" if test "x$ac_cv_func_strtoumax" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRTOUMAX 1 _ACEOF fi done for ac_func in strtoull do : ac_fn_c_check_func "$LINENO" "strtoull" "ac_cv_func_strtoull" if test "x$ac_cv_func_strtoull" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRTOULL 1 _ACEOF fi done ac_fn_c_check_member "$LINENO" "struct msghdr" "msg_control" "ac_cv_member_struct_msghdr_msg_control" " #include #include #include " if test "x$ac_cv_member_struct_msghdr_msg_control" = xyes; then : $as_echo "#define HAVE_MSGHDR_MSG_CONTROL 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct in_pktinfo" "ipi_addr" "ac_cv_member_struct_in_pktinfo_ipi_addr" " #include #include #include #include #include #include " if test "x$ac_cv_member_struct_in_pktinfo_ipi_addr" = xyes; then : $as_echo "#define HAVE_STRUCT_IN_PKTINFO 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct addrinfo" "ai_addr" "ac_cv_member_struct_addrinfo_ai_addr" " #include #include #include " if test "x$ac_cv_member_struct_addrinfo_ai_addr" = xyes; then : $as_echo "#define HAVE_STRUCT_ADDRINFO 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl.h defines O_NONBLOCK" >&5 $as_echo_n "checking if fcntl.h defines O_NONBLOCK... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int main() { int dummy = O_NONBLOCK; return 0; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pa_header_define=`echo HAVE_O_NONBLOCK_DEFINITION | tr 'a-z' 'A-Z'` cat >>confdefs.h <<_ACEOF #define $pa_header_define 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl.h defines O_BINARY" >&5 $as_echo_n "checking if fcntl.h defines O_BINARY... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int main() { int dummy = O_BINARY; return 0; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pa_header_define=`echo HAVE_O_BINARY_DEFINITION | tr 'a-z' 'A-Z'` cat >>confdefs.h <<_ACEOF #define $pa_header_define 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl.h defines O_TEXT" >&5 $as_echo_n "checking if fcntl.h defines O_TEXT... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int main() { int dummy = O_TEXT; return 0; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pa_header_define=`echo HAVE_O_TEXT_DEFINITION | tr 'a-z' 'A-Z'` cat >>confdefs.h <<_ACEOF #define $pa_header_define 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl.h defines F_SETLK" >&5 $as_echo_n "checking if fcntl.h defines F_SETLK... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int main() { int dummy = F_SETLK; return 0; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pa_header_define=`echo HAVE_F_SETLK_DEFINITION | tr 'a-z' 'A-Z'` cat >>confdefs.h <<_ACEOF #define $pa_header_define 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sys/file.h defines LOCK_SH" >&5 $as_echo_n "checking if sys/file.h defines LOCK_SH... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int main() { int dummy = LOCK_SH; return 0; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pa_header_define=`echo HAVE_LOCK_SH_DEFINITION | tr 'a-z' 'A-Z'` cat >>confdefs.h <<_ACEOF #define $pa_header_define 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sys/file.h defines LOCK_EX" >&5 $as_echo_n "checking if sys/file.h defines LOCK_EX... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int main() { int dummy = LOCK_EX; return 0; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pa_header_define=`echo HAVE_LOCK_EX_DEFINITION | tr 'a-z' 'A-Z'` cat >>confdefs.h <<_ACEOF #define $pa_header_define 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigsetjmp" >&5 $as_echo_n "checking for sigsetjmp... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_SETJMP_H #include #endif int main () { sigjmp_buf buf; sigsetjmp(buf,1); siglongjmp(buf,2); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_SIGSETJMP 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext SRCROOT=`cd $srcdir && pwd` OBJROOT=`pwd` XTRA=false { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing xmalloc" >&5 $as_echo_n "checking for library containing xmalloc... " >&6; } if ${ac_cv_search_xmalloc+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char xmalloc (); int main () { return xmalloc (); ; return 0; } _ACEOF for ac_lib in '' iberty; 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_xmalloc=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_xmalloc+:} false; then : break fi done if ${ac_cv_search_xmalloc+:} false; then : else ac_cv_search_xmalloc=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_xmalloc" >&5 $as_echo "$ac_cv_search_xmalloc" >&6; } ac_res=$ac_cv_search_xmalloc if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" cat >>confdefs.h <<_ACEOF #define HAVE_XMALLOC 1 _ACEOF pa_add_xmalloc=false; else XTRA=true; if test 2 -eq 3; then case " $LIBOBJS " in *" .$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS .$ac_objext" ;; esac else case " $LIBOBJS " in *" xmalloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS xmalloc.$ac_objext" ;; esac fi pa_add_xmalloc=true; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing xstrdup" >&5 $as_echo_n "checking for library containing xstrdup... " >&6; } if ${ac_cv_search_xstrdup+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char xstrdup (); int main () { return xstrdup (); ; return 0; } _ACEOF for ac_lib in '' iberty; 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_xstrdup=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_xstrdup+:} false; then : break fi done if ${ac_cv_search_xstrdup+:} false; then : else ac_cv_search_xstrdup=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_xstrdup" >&5 $as_echo "$ac_cv_search_xstrdup" >&6; } ac_res=$ac_cv_search_xstrdup if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" cat >>confdefs.h <<_ACEOF #define HAVE_XSTRDUP 1 _ACEOF pa_add_xstrdup=false; else XTRA=true; if test 2 -eq 3; then case " $LIBOBJS " in *" .$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS .$ac_objext" ;; esac else case " $LIBOBJS " in *" xstrdup.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS xstrdup.$ac_objext" ;; esac fi pa_add_xstrdup=true; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing bsd_signal" >&5 $as_echo_n "checking for library containing bsd_signal... " >&6; } if ${ac_cv_search_bsd_signal+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char bsd_signal (); int main () { return bsd_signal (); ; return 0; } _ACEOF for ac_lib in '' bsd; 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_bsd_signal=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_bsd_signal+:} false; then : break fi done if ${ac_cv_search_bsd_signal+:} false; then : else ac_cv_search_bsd_signal=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_bsd_signal" >&5 $as_echo "$ac_cv_search_bsd_signal" >&6; } ac_res=$ac_cv_search_bsd_signal if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" cat >>confdefs.h <<_ACEOF #define HAVE_BSD_SIGNAL 1 _ACEOF pa_add_bsd_signal=false; else XTRA=true; if test 3 -eq 3; then case " $LIBOBJS " in *" bsdsignal.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS bsdsignal.$ac_objext" ;; esac else case " $LIBOBJS " in *" bsd_signal.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS bsd_signal.$ac_objext" ;; esac fi pa_add_bsd_signal=true; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getopt_long" >&5 $as_echo_n "checking for library containing getopt_long... " >&6; } if ${ac_cv_search_getopt_long+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getopt_long (); int main () { return getopt_long (); ; return 0; } _ACEOF for ac_lib in '' getopt; 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_getopt_long=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_getopt_long+:} false; then : break fi done if ${ac_cv_search_getopt_long+:} false; then : else ac_cv_search_getopt_long=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getopt_long" >&5 $as_echo "$ac_cv_search_getopt_long" >&6; } ac_res=$ac_cv_search_getopt_long if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" cat >>confdefs.h <<_ACEOF #define HAVE_GETOPT_LONG 1 _ACEOF pa_add_getopt_long=false; else XTRA=true; if test 3 -eq 3; then case " $LIBOBJS " in *" getopt_long.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getopt_long.$ac_objext" ;; esac else case " $LIBOBJS " in *" getopt_long.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getopt_long.$ac_objext" ;; esac fi pa_add_getopt_long=true; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getaddrinfo" >&5 $as_echo_n "checking for library containing getaddrinfo... " >&6; } if ${ac_cv_search_getaddrinfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getaddrinfo (); int main () { return getaddrinfo (); ; return 0; } _ACEOF for ac_lib in '' 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 ${ac_cv_search_getaddrinfo+:} false; then : break fi done if ${ac_cv_search_getaddrinfo+:} false; 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" cat >>confdefs.h <<_ACEOF #define HAVE_GETADDRINFO 1 _ACEOF pa_add_getaddrinfo=false; else XTRA=true; if test 2 -eq 3; then case " $LIBOBJS " in *" .$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS .$ac_objext" ;; esac else case " $LIBOBJS " in *" getaddrinfo.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext" ;; esac fi pa_add_getaddrinfo=true; fi if $pa_add_getaddrinfo then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if ${ac_cv_search_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF for ac_lib in '' nsl 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 ${ac_cv_search_gethostbyname+:} false; then : break fi done if ${ac_cv_search_gethostbyname+:} false; then : else ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 $as_echo "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing herror" >&5 $as_echo_n "checking for library containing herror... " >&6; } if ${ac_cv_search_herror+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char herror (); int main () { return herror (); ; return 0; } _ACEOF for ac_lib in '' 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_herror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_herror+:} false; then : break fi done if ${ac_cv_search_herror+:} false; then : else ac_cv_search_herror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_herror" >&5 $as_echo "$ac_cv_search_herror" >&6; } ac_res=$ac_cv_search_herror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "herror not found" "$LINENO" 5 fi else as_fn_error $? "gethostbyname not found" "$LINENO" 5 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing freeaddrinfo" >&5 $as_echo_n "checking for library containing freeaddrinfo... " >&6; } if ${ac_cv_search_freeaddrinfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char freeaddrinfo (); int main () { return freeaddrinfo (); ; return 0; } _ACEOF for ac_lib in '' 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_freeaddrinfo=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_freeaddrinfo+:} false; then : break fi done if ${ac_cv_search_freeaddrinfo+:} false; then : else ac_cv_search_freeaddrinfo=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_freeaddrinfo" >&5 $as_echo "$ac_cv_search_freeaddrinfo" >&6; } ac_res=$ac_cv_search_freeaddrinfo if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "getaddrinfo but not freeaddrinfo found" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gai_strerror" >&5 $as_echo_n "checking for library containing gai_strerror... " >&6; } if ${ac_cv_search_gai_strerror+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gai_strerror (); int main () { return gai_strerror (); ; return 0; } _ACEOF for ac_lib in '' 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_gai_strerror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gai_strerror+:} false; then : break fi done if ${ac_cv_search_gai_strerror+:} false; then : else ac_cv_search_gai_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gai_strerror" >&5 $as_echo "$ac_cv_search_gai_strerror" >&6; } ac_res=$ac_cv_search_gai_strerror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "getaddrinfo but not gai_strerror found" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_ntop" >&5 $as_echo_n "checking for library containing inet_ntop... " >&6; } if ${ac_cv_search_inet_ntop+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_ntop (); int main () { return inet_ntop (); ; return 0; } _ACEOF for ac_lib in '' 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_inet_ntop=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_inet_ntop+:} false; then : break fi done if ${ac_cv_search_inet_ntop+:} false; then : else ac_cv_search_inet_ntop=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_ntop" >&5 $as_echo "$ac_cv_search_inet_ntop" >&6; } ac_res=$ac_cv_search_inet_ntop if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" cat >>confdefs.h <<_ACEOF #define HAVE_INET_NTOP 1 _ACEOF pa_add_inet_ntop=false; else XTRA=true; if test 2 -eq 3; then case " $LIBOBJS " in *" .$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS .$ac_objext" ;; esac else case " $LIBOBJS " in *" inet_ntop.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS inet_ntop.$ac_objext" ;; esac fi pa_add_inet_ntop=true; fi if $pa_add_inet_ntop then { $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 ${ac_cv_search_inet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_ntoa (); int main () { return inet_ntoa (); ; return 0; } _ACEOF for ac_lib in '' 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_inet_ntoa=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_inet_ntoa+:} false; then : break fi done if ${ac_cv_search_inet_ntoa+:} false; 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" else as_fn_error $? "inet_ntoa not found" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_aton" >&5 $as_echo_n "checking for library containing inet_aton... " >&6; } if ${ac_cv_search_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_aton (); int main () { return inet_aton (); ; return 0; } _ACEOF for ac_lib in '' 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_inet_aton=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_inet_aton+:} false; then : break fi done if ${ac_cv_search_inet_aton+:} false; then : else ac_cv_search_inet_aton=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_aton" >&5 $as_echo "$ac_cv_search_inet_aton" >&6; } ac_res=$ac_cv_search_inet_aton if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else as_fn_error $? "inet_aton not found" "$LINENO" 5 fi for ac_func in daemon do : ac_fn_c_check_func "$LINENO" "daemon" "ac_cv_func_daemon" if test "x$ac_cv_func_daemon" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DAEMON 1 _ACEOF else XTRA=true; case " $LIBOBJS " in *" daemon.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS daemon.$ac_objext" ;; esac fi done for ac_func in dup2 do : ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" if test "x$ac_cv_func_dup2" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DUP2 1 _ACEOF else XTRA=true; case " $LIBOBJS " in *" dup2.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS dup2.$ac_objext" ;; esac fi done if $XTRA then XTRALIBS="$OBJROOT/lib/libxtra.a $XTRALIBS" fi common_libs="$LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if netinet/in.h defines IPPORT_TFTP" >&5 $as_echo_n "checking if netinet/in.h defines IPPORT_TFTP... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int main() { int dummy = IPPORT_TFTP; return 0; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : pa_header_define=`echo HAVE_IPPORT_TFTP_DEFINITION | tr 'a-z' 'A-Z'` cat >>confdefs.h <<_ACEOF #define $pa_header_define 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Check whether --with-tcpwrappers was given. if test "${with_tcpwrappers+set}" = set; then : withval=$with_tcpwrappers; if test "$withval" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yp_get_default_domain" >&5 $as_echo_n "checking for library containing yp_get_default_domain... " >&6; } if ${ac_cv_search_yp_get_default_domain+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char yp_get_default_domain (); int main () { return yp_get_default_domain (); ; return 0; } _ACEOF for ac_lib in '' 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_yp_get_default_domain=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_yp_get_default_domain+:} false; then : break fi done if ${ac_cv_search_yp_get_default_domain+:} false; then : else ac_cv_search_yp_get_default_domain=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yp_get_default_domain" >&5 $as_echo "$ac_cv_search_yp_get_default_domain" >&6; } ac_res=$ac_cv_search_yp_get_default_domain 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 main in -lwrap" >&5 $as_echo_n "checking for main in -lwrap... " >&6; } if ${ac_cv_lib_wrap_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lwrap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_wrap_main=yes else ac_cv_lib_wrap_main=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_wrap_main" >&5 $as_echo "$ac_cv_lib_wrap_main" >&6; } if test "x$ac_cv_lib_wrap_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBWRAP 1 _ACEOF LIBS="-lwrap $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tcpwrappers" >&5 $as_echo_n "checking for tcpwrappers... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int allow_severity = 0; int deny_severity = 0; int main () { hosts_ctl("sample_daemon", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_TCPWRAPPERS 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else : fi else if test 1 -ne 0; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yp_get_default_domain" >&5 $as_echo_n "checking for library containing yp_get_default_domain... " >&6; } if ${ac_cv_search_yp_get_default_domain+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char yp_get_default_domain (); int main () { return yp_get_default_domain (); ; return 0; } _ACEOF for ac_lib in '' 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_yp_get_default_domain=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_yp_get_default_domain+:} false; then : break fi done if ${ac_cv_search_yp_get_default_domain+:} false; then : else ac_cv_search_yp_get_default_domain=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yp_get_default_domain" >&5 $as_echo "$ac_cv_search_yp_get_default_domain" >&6; } ac_res=$ac_cv_search_yp_get_default_domain 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 main in -lwrap" >&5 $as_echo_n "checking for main in -lwrap... " >&6; } if ${ac_cv_lib_wrap_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lwrap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_wrap_main=yes else ac_cv_lib_wrap_main=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_wrap_main" >&5 $as_echo "$ac_cv_lib_wrap_main" >&6; } if test "x$ac_cv_lib_wrap_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBWRAP 1 _ACEOF LIBS="-lwrap $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tcpwrappers" >&5 $as_echo_n "checking for tcpwrappers... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int allow_severity = 0; int deny_severity = 0; int main () { hosts_ctl("sample_daemon", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_TCPWRAPPERS 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else : fi fi # Check whether --with-remap was given. if test "${with_remap+set}" = set; then : withval=$with_remap; if test "$withval" != no; then ac_fn_c_check_header_mongrel "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default" if test "x$ac_cv_header_regex_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing regcomp" >&5 $as_echo_n "checking for library containing regcomp... " >&6; } if ${ac_cv_search_regcomp+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char regcomp (); int main () { return regcomp (); ; return 0; } _ACEOF for ac_lib in '' regex rx; 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_regcomp=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_regcomp+:} false; then : break fi done if ${ac_cv_search_regcomp+:} false; then : else ac_cv_search_regcomp=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_regcomp" >&5 $as_echo "$ac_cv_search_regcomp" >&6; } ac_res=$ac_cv_search_regcomp if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define WITH_REGEX 1" >>confdefs.h TFTPDOBJS="remap.${OBJEXT} $TFTPDOBJS" fi fi else : fi else if test 1 -ne 0; then ac_fn_c_check_header_mongrel "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default" if test "x$ac_cv_header_regex_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing regcomp" >&5 $as_echo_n "checking for library containing regcomp... " >&6; } if ${ac_cv_search_regcomp+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char regcomp (); int main () { return regcomp (); ; return 0; } _ACEOF for ac_lib in '' regex rx; 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_regcomp=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_regcomp+:} false; then : break fi done if ${ac_cv_search_regcomp+:} false; then : else ac_cv_search_regcomp=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_regcomp" >&5 $as_echo "$ac_cv_search_regcomp" >&6; } ac_res=$ac_cv_search_regcomp if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define WITH_REGEX 1" >>confdefs.h TFTPDOBJS="remap.${OBJEXT} $TFTPDOBJS" fi fi else : fi fi TFTPD_LIBS="$LIBS $XTRALIBS" LIBS="$common_libs" # Check whether --with-readline was given. if test "${with_readline+set}" = set; then : withval=$with_readline; if test "$withval" != no; then ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_readline_readline_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5 $as_echo_n "checking for library containing tputs... " >&6; } if ${ac_cv_search_tputs+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tputs (); int main () { return tputs (); ; return 0; } _ACEOF for ac_lib in '' termcap terminfo; 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_tputs=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_tputs+:} false; then : break fi done if ${ac_cv_search_tputs+:} false; then : else ac_cv_search_tputs=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tputs" >&5 $as_echo "$ac_cv_search_tputs" >&6; } ac_res=$ac_cv_search_tputs 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 readline" >&5 $as_echo_n "checking for library containing readline... " >&6; } if ${ac_cv_search_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char readline (); int main () { return readline (); ; return 0; } _ACEOF for ac_lib in '' readline history; 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_readline=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_readline+:} false; then : break fi done if ${ac_cv_search_readline+:} false; then : else ac_cv_search_readline=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_readline" >&5 $as_echo "$ac_cv_search_readline" >&6; } ac_res=$ac_cv_search_readline if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define WITH_READLINE 1" >>confdefs.h fi for ac_header in readline/history.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline/history.h" "ac_cv_header_readline_history_h" "$ac_includes_default" if test "x$ac_cv_header_readline_history_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_READLINE_HISTORY_H 1 _ACEOF fi done else ac_fn_c_check_header_mongrel "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_editline_readline_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5 $as_echo_n "checking for library containing tputs... " >&6; } if ${ac_cv_search_tputs+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tputs (); int main () { return tputs (); ; return 0; } _ACEOF for ac_lib in '' termcap terminfo; 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_tputs=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_tputs+:} false; then : break fi done if ${ac_cv_search_tputs+:} false; then : else ac_cv_search_tputs=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tputs" >&5 $as_echo "$ac_cv_search_tputs" >&6; } ac_res=$ac_cv_search_tputs 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 editline" >&5 $as_echo_n "checking for library containing editline... " >&6; } if ${ac_cv_search_editline+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char editline (); int main () { return editline (); ; return 0; } _ACEOF for ac_lib in '' edit; 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_editline=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_editline+:} false; then : break fi done if ${ac_cv_search_editline+:} false; then : else ac_cv_search_editline=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_editline" >&5 $as_echo "$ac_cv_search_editline" >&6; } ac_res=$ac_cv_search_editline if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define WITH_READLINE 1" >>confdefs.h fi fi fi else : fi else if test 1 -ne 0; then ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_readline_readline_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5 $as_echo_n "checking for library containing tputs... " >&6; } if ${ac_cv_search_tputs+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tputs (); int main () { return tputs (); ; return 0; } _ACEOF for ac_lib in '' termcap terminfo; 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_tputs=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_tputs+:} false; then : break fi done if ${ac_cv_search_tputs+:} false; then : else ac_cv_search_tputs=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tputs" >&5 $as_echo "$ac_cv_search_tputs" >&6; } ac_res=$ac_cv_search_tputs 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 readline" >&5 $as_echo_n "checking for library containing readline... " >&6; } if ${ac_cv_search_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char readline (); int main () { return readline (); ; return 0; } _ACEOF for ac_lib in '' readline history; 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_readline=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_readline+:} false; then : break fi done if ${ac_cv_search_readline+:} false; then : else ac_cv_search_readline=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_readline" >&5 $as_echo "$ac_cv_search_readline" >&6; } ac_res=$ac_cv_search_readline if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define WITH_READLINE 1" >>confdefs.h fi for ac_header in readline/history.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline/history.h" "ac_cv_header_readline_history_h" "$ac_includes_default" if test "x$ac_cv_header_readline_history_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_READLINE_HISTORY_H 1 _ACEOF fi done else ac_fn_c_check_header_mongrel "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_editline_readline_h" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5 $as_echo_n "checking for library containing tputs... " >&6; } if ${ac_cv_search_tputs+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tputs (); int main () { return tputs (); ; return 0; } _ACEOF for ac_lib in '' termcap terminfo; 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_tputs=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_tputs+:} false; then : break fi done if ${ac_cv_search_tputs+:} false; then : else ac_cv_search_tputs=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tputs" >&5 $as_echo "$ac_cv_search_tputs" >&6; } ac_res=$ac_cv_search_tputs 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 editline" >&5 $as_echo_n "checking for library containing editline... " >&6; } if ${ac_cv_search_editline+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char editline (); int main () { return editline (); ; return 0; } _ACEOF for ac_lib in '' edit; 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_editline=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_editline+:} false; then : break fi done if ${ac_cv_search_editline+:} false; then : else ac_cv_search_editline=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_editline" >&5 $as_echo "$ac_cv_search_editline" >&6; } ac_res=$ac_cv_search_editline if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define WITH_READLINE 1" >>confdefs.h fi fi fi else : fi fi TFTP_LIBS="$LIBS $XTRALIBS" LIBS="$common_libs" ac_fn_c_check_member "$LINENO" "struct sockaddr_in6" "sin6_addr" "ac_cv_member_struct_sockaddr_in6_sin6_addr" " #include #include #include #include " if test "x$ac_cv_member_struct_sockaddr_in6_sin6_addr" = xyes; then : $as_echo "#define HAVE_STRUCT_SOCKADDR_IN6 1" >>confdefs.h HAVE_INET6=true; else HAVE_INET6=false; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv6 support" >&5 $as_echo_n "checking for IPv6 support... " >&6; } # Check whether --with-ipv6 was given. if test "${with_ipv6+set}" = set; then : withval=$with_ipv6; if test "$withval" != no; then if $HAVE_INET6 then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_IPV6 1" >>confdefs.h ac_fn_c_check_member "$LINENO" "struct in6_pktinfo" "ipi6_addr" "ac_cv_member_struct_in6_pktinfo_ipi6_addr" " #include #include #include #include " if test "x$ac_cv_member_struct_in6_pktinfo_ipi6_addr" = xyes; then : $as_echo "#define HAVE_STRUCT_IN6_PKTINFO 1" >>confdefs.h fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** we do not have required IPv6 structs - IPv6 will be disabled" >&5 $as_echo "$as_me: WARNING: *** we do not have required IPv6 structs - IPv6 will be disabled" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } fi else if test 1 -ne 0; then if $HAVE_INET6 then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_IPV6 1" >>confdefs.h ac_fn_c_check_member "$LINENO" "struct in6_pktinfo" "ipi6_addr" "ac_cv_member_struct_in6_pktinfo_ipi6_addr" " #include #include #include #include " if test "x$ac_cv_member_struct_in6_pktinfo_ipi6_addr" = xyes; then : $as_echo "#define HAVE_STRUCT_IN6_PKTINFO 1" >>confdefs.h fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** we do not have required IPv6 structs - IPv6 will be disabled" >&5 $as_echo "$as_me: WARNING: *** we do not have required IPv6 structs - IPv6 will be disabled" >&2;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { 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' if echo "$INSTALL" | grep '^[^/].*/' > /dev/null 2>&1; then INSTALL='\${SRCROOT}'/"$INSTALL" fi ac_config_headers="$ac_config_headers aconfig.h" ac_config_files="$ac_config_files MCONFIG" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -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 $as_me, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.68, 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' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "aconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS aconfig.h" ;; "MCONFIG") CONFIG_FILES="$CONFIG_FILES MCONFIG" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _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 $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi tftp-hpa-5.2/install-sh0000775000200200020020000001267111671225440013202 0ustar hpahpa#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # 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. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # 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 $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 tftp-hpa-5.2/common/0000775000200200020020000000000011671225440012457 5ustar hpahpatftp-hpa-5.2/common/tftpsubs.c0000664000200200020020000003013211671225440014474 0ustar hpahpa/* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "tftpsubs.h" /* Simple minded read-ahead/write-behind subroutines for tftp user and server. Written originally with multiple buffers in mind, but current implementation has two buffer logic wired in. Todo: add some sort of final error check so when the write-buffer is finally flushed, the caller can detect if the disk filled up (or had an i/o error) and return a nak to the other side. Jim Guyton 10/85 */ #include #define PKTSIZE MAX_SEGSIZE+4 /* should be moved to tftp.h */ int segsize = SEGSIZE; /* Default segsize */ struct bf { int counter; /* size of data in buffer, or flag */ char buf[PKTSIZE]; /* room for data packet */ } bfs[2]; /* Values for bf.counter */ #define BF_ALLOC -3 /* alloc'd but not yet filled */ #define BF_FREE -2 /* free */ /* [-1 .. segsize] = size of data in the data buffer */ static int nextone; /* index of next buffer to use */ static int current; /* index of buffer in use */ /* control flags for crlf conversions */ int newline = 0; /* fillbuf: in middle of newline expansion */ int prevchar = -1; /* putbuf: previous char (cr check) */ static struct tftphdr *rw_init(int); struct tftphdr *w_init() { return rw_init(0); } /* write-behind */ struct tftphdr *r_init() { return rw_init(1); } /* read-ahead */ /* init for either read-ahead or write-behind */ /* x == zero for write-behind, one for read-head */ static struct tftphdr *rw_init(int x) { newline = 0; /* init crlf flag */ prevchar = -1; bfs[0].counter = BF_ALLOC; /* pass out the first buffer */ current = 0; bfs[1].counter = BF_FREE; nextone = x; /* ahead or behind? */ return (struct tftphdr *)bfs[0].buf; } /* Have emptied current buffer by sending to net and getting ack. Free it and return next buffer filled with data. */ int readit(FILE * file, struct tftphdr **dpp, int convert) { struct bf *b; bfs[current].counter = BF_FREE; /* free old one */ current = !current; /* "incr" current */ b = &bfs[current]; /* look at new buffer */ if (b->counter == BF_FREE) /* if it's empty */ read_ahead(file, convert); /* fill it */ /* assert(b->counter != BF_FREE);*//* check */ *dpp = (struct tftphdr *)b->buf; /* set caller's ptr */ return b->counter; } /* * fill the input buffer, doing ascii conversions if requested * conversions are lf -> cr,lf and cr -> cr, nul */ void read_ahead(FILE * file, int convert) { int i; char *p; int c; struct bf *b; struct tftphdr *dp; b = &bfs[nextone]; /* look at "next" buffer */ if (b->counter != BF_FREE) /* nop if not free */ return; nextone = !nextone; /* "incr" next buffer ptr */ dp = (struct tftphdr *)b->buf; if (convert == 0) { b->counter = read(fileno(file), dp->th_data, segsize); return; } p = dp->th_data; for (i = 0; i < segsize; i++) { if (newline) { if (prevchar == '\n') c = '\n'; /* lf to cr,lf */ else c = '\0'; /* cr to cr,nul */ newline = 0; } else { c = getc(file); if (c == EOF) break; if (c == '\n' || c == '\r') { prevchar = c; c = '\r'; newline = 1; } } *p++ = c; } b->counter = (int)(p - dp->th_data); } /* Update count associated with the buffer, get new buffer from the queue. Calls write_behind only if next buffer not available. */ int writeit(FILE * file, struct tftphdr **dpp, int ct, int convert) { bfs[current].counter = ct; /* set size of data to write */ current = !current; /* switch to other buffer */ if (bfs[current].counter != BF_FREE) /* if not free */ (void)write_behind(file, convert); /* flush it */ bfs[current].counter = BF_ALLOC; /* mark as alloc'd */ *dpp = (struct tftphdr *)bfs[current].buf; return ct; /* this is a lie of course */ } /* * Output a buffer to a file, converting from netascii if requested. * CR,NUL -> CR and CR,LF => LF. * Note spec is undefined if we get CR as last byte of file or a * CR followed by anything else. In this case we leave it alone. */ int write_behind(FILE * file, int convert) { char *buf; int count; int ct; char *p; int c; /* current character */ struct bf *b; struct tftphdr *dp; b = &bfs[nextone]; if (b->counter < -1) /* anything to flush? */ return 0; /* just nop if nothing to do */ count = b->counter; /* remember byte count */ b->counter = BF_FREE; /* reset flag */ dp = (struct tftphdr *)b->buf; nextone = !nextone; /* incr for next time */ buf = dp->th_data; if (count <= 0) return -1; /* nak logic? */ if (convert == 0) return write(fileno(file), buf, count); p = buf; ct = count; while (ct--) { /* loop over the buffer */ c = *p++; /* pick up a character */ if (prevchar == '\r') { /* if prev char was cr */ if (c == '\n') /* if have cr,lf then just */ fseek(file, -1, 1); /* smash lf on top of the cr */ else if (c == '\0') /* if have cr,nul then */ goto skipit; /* just skip over the putc */ /* else just fall through and allow it */ } putc(c, file); skipit: prevchar = c; } return count; } /* When an error has occurred, it is possible that the two sides * are out of synch. Ie: that what I think is the other side's * response to packet N is really their response to packet N-1. * * So, to try to prevent that, we flush all the input queued up * for us on the network connection on our host. * * We return the number of packets we flushed (mostly for reporting * when trace is active). */ int synchnet(int f) { /* socket to flush */ int pktcount = 0; char rbuf[PKTSIZE]; union sock_addr from; socklen_t fromlen; fd_set socketset; struct timeval notime; while (1) { notime.tv_sec = notime.tv_usec = 0; FD_ZERO(&socketset); FD_SET(f, &socketset); if (select(f, &socketset, NULL, NULL, ¬ime) <= 0) break; /* Nothing to read */ /* Otherwise drain the packet */ pktcount++; fromlen = sizeof(from); (void)recvfrom(f, rbuf, sizeof(rbuf), 0, &from.sa, &fromlen); } return pktcount; /* Return packets drained */ } int pick_port_bind(int sockfd, union sock_addr *myaddr, unsigned int port_range_from, unsigned int port_range_to) { unsigned int port, firstport; int port_range = 0; if (port_range_from != 0 && port_range_to != 0) { port_range = 1; } firstport = port_range ? port_range_from + rand() % (port_range_to - port_range_from + 1) : 0; port = firstport; do { sa_set_port(myaddr, htons(port)); if (bind(sockfd, &myaddr->sa, SOCKLEN(myaddr)) < 0) { /* Some versions of Linux return EINVAL instead of EADDRINUSE */ if (!(port_range && (errno == EINVAL || errno == EADDRINUSE))) return -1; /* Normally, we shouldn't have to loop, but some situations involving aborted transfers make it possible. */ } else { return 0; } port++; if (port > port_range_to) port = port_range_from; } while (port != firstport); return -1; } int set_sock_addr(char *host,union sock_addr *s, char **name) { struct addrinfo *addrResult; struct addrinfo hints; int err; memset(&hints, 0, sizeof(hints)); hints.ai_family = s->sa.sa_family; hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; err = getaddrinfo(strip_address(host), NULL, &hints, &addrResult); if (err) return err; if (addrResult == NULL) return EAI_NONAME; memcpy(s, addrResult->ai_addr, addrResult->ai_addrlen); if (name) { if (addrResult->ai_canonname) *name = xstrdup(addrResult->ai_canonname); else *name = xstrdup(host); } freeaddrinfo(addrResult); return 0; } #ifdef HAVE_IPV6 int is_numeric_ipv6(const char *p) { /* A numeric IPv6 address consist at least of 2 ':' and * it may have sequences of hex-digits and maybe contain * a '.' from a IPv4 mapped address and maybe is enclosed in [] * we do not check here, if it is a valid IPv6 address * only if is something like a numeric IPv6 address or something else */ int colon = 0; int dot = 0; int bracket = 0; char c; if (!p) return 0; if (*p == '[') { bracket = 1; p++; } while ((c = *p++) && c != ']') { switch (c) { case ':': colon++; break; case '.': dot++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': break; default: return 0; /* Invalid character */ } } if (colon < 2 || colon > 7) return 0; if (dot) { /* An IPv4-mapped address in dot-quad form will have 3 dots */ if (dot != 3) return 0; /* The IPv4-mapped address takes the space of one colon */ if (colon > 6) return 0; } /* If bracketed, must be closed, and vice versa */ if (bracket ^ (c == ']')) return 0; /* Otherwise, assume we're okay */ return 1; } /* strip [] from numeric IPv6 addreses */ char *strip_address(char *addr) { char *p; if (is_numeric_ipv6(addr) && (*addr == '[')) { p = addr + strlen(addr); p--; if (*p == ']') { *p = 0; addr++; } } return addr; } #endif tftp-hpa-5.2/common/Makefile0000664000200200020020000000046511671225440014124 0ustar hpahpaSRCROOT = .. VERSION = $(shell cat ../version) -include ../MCONFIG include ../MRULES OBJS = tftpsubs.$(O) LIB = libcommon.a all: $(LIB) $(LIB): $(OBJS) -rm -f $(LIB) $(AR) $(LIB) $(OBJS) $(RANLIB) $(LIB) $(OBJS): tftpsubs.h install: clean: rm -f *.o *.obj *.exe $(LIB) distclean: clean rm -f *~ tftp-hpa-5.2/common/tftpsubs.h0000664000200200020020000000736511671225440014515 0ustar hpahpa/* * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * Prototypes for read-ahead/write-behind subroutines for tftp user and * server. */ #ifndef TFTPSUBS_H #define TFTPSUBS_H #include "config.h" union sock_addr { struct sockaddr sa; struct sockaddr_in si; #ifdef HAVE_IPV6 struct sockaddr_in6 s6; #endif }; #define SOCKLEN(sock) \ (((union sock_addr*)sock)->sa.sa_family == AF_INET ? \ (sizeof(struct sockaddr_in)) : \ (sizeof(union sock_addr))) #ifdef HAVE_IPV6 #define SOCKPORT(sock) \ (((union sock_addr*)sock)->sa.sa_family == AF_INET ? \ ((union sock_addr*)sock)->si.sin_port : \ ((union sock_addr*)sock)->s6.sin6_port) #else #define SOCKPORT(sock) \ (((union sock_addr*)sock)->si.sin_port) #endif #ifdef HAVE_IPV6 #define SOCKADDR_P(sock) \ (((union sock_addr*)sock)->sa.sa_family == AF_INET ? \ (void *)&((union sock_addr*)sock)->si.sin_addr : \ (void *)&((union sock_addr*)sock)->s6.sin6_addr) #else #define SOCKADDR_P(sock) \ (void *)&((union sock_addr*)sock)->si.sin_addr #endif #ifdef HAVE_IPV6 int is_numeric_ipv6(const char *); char *strip_address(char *); #else #define is_numeric_ipv6(a) 0 #define strip_address(a) (a) #endif static inline int sa_set_port(union sock_addr *s, u_short port) { switch (s->sa.sa_family) { case AF_INET: s->si.sin_port = port; break; #ifdef HAVE_IPV6 case AF_INET6: s->s6.sin6_port = port; break; #endif default: return -1; } return 0; } int set_sock_addr(char *, union sock_addr *, char **); struct tftphdr; struct tftphdr *r_init(void); void read_ahead(FILE *, int); int readit(FILE *, struct tftphdr **, int); int synchnet(int); struct tftphdr *w_init(void); int write_behind(FILE *, int); int writeit(FILE *, struct tftphdr **, int, int); extern int segsize; #define MAX_SEGSIZE 65464 int pick_port_bind(int sockfd, union sock_addr *myaddr, unsigned int from, unsigned int to); #endif tftp-hpa-5.2/.gitignore0000664000200200020020000000022211671225440013153 0ustar hpahpa/MCONFIG /aconfig.h /aconfig.h.in /autom4te.cache /config.log /config.status /configure /version.h /tftp/tftp /tftpd/tftpd *.1 *.8 *.a *.o *~ \#* tftp-hpa-5.2/README.security0000664000200200020020000000503411671225440013717 0ustar hpahpaStarting in version 0.27, tftp-hpa has the option of a "use Unix permissions" mode. In this mode, tftpd can access any file accessible by the tftpd effective user, specified via the -u option. This means that files no longer need to be set to o+r or o+w. If file creation is enabled (via the -c option), the -p option also changes the default umask from 0 (anyone can read or write) to "unchanged" (inherited from the calling process.) The -U option can be used to override the default umask; this is recommended. The sanest setup, from a security standpoint, for tftpd to run in is probably the following: 1. Create a separate "tftpd" user and group only used for tftpd; 2. Have all your boot files in a single directory tree (usually called /tftpboot). 3. Specify "-p -u tftpd -s /tftpboot" on the tftpd command line; if you want clients to be able to create files use "-p -c -U 002 -u tftpd -s /tftpboot" (replace 002 with whatever umask is appropriate for your setup.) ======================================= Starting in version 0.17, tftp-hpa operates in genuine "wait" mode, which means that an in.tftpd process hangs around for some time after the last service request has arrived. This speeds up servicing a subsequent request, which apparently has been a problem in the past, resulting in "request storms" as the client keeps retrying, resulting in multiple connections on the server which the client has already abandoned. This also means that spawning tftp via tcpd is useless (in fact, this indirection seems to be part of the reason for these "request storms.") Instead, tftp-hpa supports calling the tcpwrapper library directly. Thus, if your /etc/inetd.conf looks like this (all on one line): tftp dgram udp wait root /usr/sbin/tcpd /usr/sbin/in.tftpd -s /tftpboot -r blksize ... it's better to change to ... tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot -r blksize You should make sure that you are using "wait" option in tftpd; you also need to have tftpd spawned as root in order for chroot (-s) to work. tftpd automatically drops privilege and changes user ID to "nobody" by default; the appropriate user ID for tftpd can be specified with the -u option (e.g. "-u tftpuser"). If you are running a busy boot server, I would suggest to instead use kernel-based firewalling rules, and to compile tftpd without tcpwrapper support, in order to provide significantly better performance. To do so, specify the --without-tcpwrappers option to configure when compiling; see the INSTALL.tftp file for more information. tftp-hpa-5.2/aclocal.m40000664000200200020020000001714211671225440013034 0ustar hpahpadnl ----------------------------------------------------------------------- dnl dnl Copyright 1999-2008 H. Peter Anvin - All Rights Reserved dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation, Inc., 53 Temple Place Ste 330, dnl Bostom MA 02111-1307, USA; either version 2 of the License, or dnl (at your option) any later version; incorporated herein by reference. dnl dnl ----------------------------------------------------------------------- dnl -------------------------------------------------------------------------- dnl PA_ADD_CFLAGS() dnl dnl Attempt to add the given option to CFLAGS, if it doesn't break compilation dnl -------------------------------------------------------------------------- AC_DEFUN(PA_ADD_CFLAGS, [AC_MSG_CHECKING([if $CC accepts $1]) pa_add_cflags__old_cflags="$CFLAGS" CFLAGS="$CFLAGS $1" AC_TRY_LINK([#include ], [printf("Hello, World!\n");], AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]) CFLAGS="$pa_add_cflags__old_cflags")]) dnl -------------------------------------------------------------------------- dnl PA_SIGSETJMP dnl dnl Do we have sigsetjmp/siglongjmp? (AC_CHECK_FUNCS doesn't seem to work dnl for these particular functions.) dnl -------------------------------------------------------------------------- AC_DEFUN(PA_SIGSETJMP, [AC_MSG_CHECKING([for sigsetjmp]) AC_TRY_LINK([ #ifdef HAVE_SETJMP_H #include #endif], [sigjmp_buf buf; sigsetjmp(buf,1); siglongjmp(buf,2);], AC_MSG_RESULT([yes]) $1, AC_MSG_RESULT([no]) $2)]) dnl -------------------------------------------------------------------------- dnl PA_MSGHDR_MSG_CONTROL dnl dnl Does struct msghdr have the msg_control field? dnl -------------------------------------------------------------------------- AH_TEMPLATE([HAVE_MSGHDR_MSG_CONTROL], [Define if struct msghdr has the msg_control field.]) AC_DEFUN(PA_MSGHDR_MSG_CONTROL, [AC_CHECK_MEMBER(struct msghdr.msg_control, [AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL)], [], [ #include #include #include ])]) dnl ------------------------------------------------------------------------ dnl PA_STRUCT_IN_PKTINFO dnl dnl Look for definition of struct in_pktinfo, which at least has an dnl ipi_addr member. Some versions of glibc lack struct in_pktinfo; dnl if so we need to include the definition ourselves -- but we only dnl want to do that if absolutely necessary! dnl ------------------------------------------------------------------------ AH_TEMPLATE([HAVE_STRUCT_IN_PKTINFO], [Define if struct in_pktinfo is defined.]) AC_DEFUN(PA_STRUCT_IN_PKTINFO, [AC_CHECK_MEMBER(struct in_pktinfo.ipi_addr, [AC_DEFINE(HAVE_STRUCT_IN_PKTINFO)], [], [ #include #include #include #include #include #include ])]) dnl ------------------------------------------------------------------------ dnl PA_STRUCT_SOCKADDR_IN6 dnl dnl Look for definition of struct sockaddr_in6, which at least has an dnl sin6_addr member dnl AH_TEMPLATE([HAVE_STRUCT_SOCKADDR_IN6], [Define if struct sockaddr_in6 is defined.]) AC_DEFUN(PA_STRUCT_SOCKADDR_IN6, [AC_CHECK_MEMBER(struct sockaddr_in6.sin6_addr, [ AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6) HAVE_INET6=true; ], [ HAVE_INET6=false; ], [ #include #include #include #include ])]) dnl ------------------------------------------------------------------------ dnl PA_STRUCT_ADDRINFO dnl dnl Look for definition of struct addrinfo, which at least has an dnl ai_addr member dnl AH_TEMPLATE([HAVE_STRUCT_ADDRINFO], [Define if struct addrinfo is defined.]) AC_DEFUN(PA_STRUCT_ADDRINFO, [AC_CHECK_MEMBER(struct addrinfo.ai_addr, [AC_DEFINE(HAVE_STRUCT_ADDRINFO)], [], [ #include #include #include ])]) dnl ------------------------------------------------------------------------ dnl PA_STRUCT_IN6_PKTINFO dnl dnl Look for definition of struct in6_pktinfo, which at least has an dnl ipi6_addr member dnl AH_TEMPLATE([HAVE_STRUCT_IN6_PKTINFO], [Define if struct in6_pktinfo is defined.]) AC_DEFUN(PA_STRUCT_IN6_PKTINFO, [AC_CHECK_MEMBER(struct in6_pktinfo.ipi6_addr, [AC_DEFINE(HAVE_STRUCT_IN6_PKTINFO)], [], [ #include #include #include #include ])]) dnl -------------------------------------------------------------------------- dnl PA_HAVE_TCPWRAPPERS dnl dnl Do we have the tcpwrappers -lwrap? This can't be done using AC_CHECK_LIBS dnl due to the need to provide "allow_severity" and "deny_severity" variables dnl -------------------------------------------------------------------------- AH_TEMPLATE([HAVE_TCPWRAPPERS], [Define if we have tcpwrappers (-lwrap) and .]) AC_DEFUN(PA_HAVE_TCPWRAPPERS, [AC_CHECK_LIB([wrap], [main]) AC_MSG_CHECKING([for tcpwrappers]) AC_TRY_LINK( [ #include int allow_severity = 0; int deny_severity = 0; ], [ hosts_ctl("sample_daemon", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN); ], [ AC_DEFINE(HAVE_TCPWRAPPERS) AC_MSG_RESULT([yes]) ], [ AC_MSG_RESULT([no]) ])]) dnl ------------------------------------------------------------------------ dnl PA_CHECK_INTTYPES_H_SANE dnl dnl At least some versions of AIX 4 have macros which are dnl completely broken. Try to detect those. dnl -------------------------------------------------------------------------- AH_TEMPLATE([INTTYPES_H_IS_SANE], [Define if the macros in are usable]) AC_DEFUN(PA_CHECK_INTTYPES_H_SANE, [AC_CHECK_HEADERS(inttypes.h, [ AC_MSG_CHECKING([if inttypes.h is sane]) AC_TRY_LINK( [ #include #include ], [uintmax_t max = UINTMAX_C(0); printf("%"PRIuMAX"\n", max);], AC_MSG_RESULT([yes]) AC_DEFINE(INTTYPES_H_IS_SANE), AC_MSG_RESULT([no (AIX, eh?)])) ]) ]) dnl ------------------------------------------------------------------------ dnl PA_WITH_BOOL dnl dnl PA_WITH_BOOL(option, default, help, enable, disable) dnl dnl Provides a more convenient way to specify --with-option and dnl --without-option, with a default. default should be either 0 or 1. dnl ------------------------------------------------------------------------ AC_DEFUN(PA_WITH_BOOL, [AC_ARG_WITH([$1], [$3], if test ["$withval"] != no; then [$4] else [$5] fi, if test [$2] -ne 0; then [$4] else [$5] fi)]) dnl -------------------------------------------------------------------------- dnl PA_HEADER_DEFINES dnl dnl PA_HEADER_DEFINES(header, type, value) dnl -------------------------------------------------------------------------- AC_DEFUN(PA_HEADER_DEFINES, [AC_MSG_CHECKING([if $1 defines $3]) AH_TEMPLATE([HAVE_$3_DEFINITION], [Define if $1 defines $3]) AC_TRY_COMPILE([ #include <$1> ], [ int main() { $2 dummy = $3; return 0; } ], [ pa_header_define=`echo HAVE_$3_DEFINITION | tr '[a-z]' '[A-Z]'` AC_DEFINE_UNQUOTED($pa_header_define) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) ])]) dnl -------------------------------------------------------------------------- dnl PA_SEARCH_LIBS_AND_ADD dnl dnl PA_SEARCH_LIBS_AND_ADD(function, libraries [,function to add]) dnl -------------------------------------------------------------------------- AC_DEFUN(PA_SEARCH_LIBS_AND_ADD, [ AH_TEMPLATE(AS_TR_CPP(HAVE_$1), [Define if $1 function was found]) AC_SEARCH_LIBS($1, $2, [ AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1)) pa_add_$1=false; ], [ XTRA=true; if test $# -eq 3; then AC_LIBOBJ($3) else AC_LIBOBJ($1) fi pa_add_$1=true; ])]) tftp-hpa-5.2/MCONFIG.in0000664000200200020020000000266011671225440012605 0ustar hpahpa## -*- makefile -*- ------------------------------------------------------ ## ## Copyright 2001-2007 H. Peter Anvin - All Rights Reserved ## ## This program is free software available under the same license ## as the "OpenBSD" operating system, distributed at ## http://www.openbsd.org/. ## ## ----------------------------------------------------------------------- ## ## MCONFIG.in ## ## Basic Makefile definitions ## # Source and object root SRCROOT = @SRCROOT@ OBJROOT = @OBJROOT@ # Prefixes prefix = @prefix@ exec_prefix = @exec_prefix@ # Directory for user binaries BINDIR = @bindir@ # Man page tree MANDIR = @mandir@ # System binaries SBINDIR = @sbindir@ # Data root directory datarootdir = @datarootdir@ # Binary suffixes O = @OBJEXT@ X = @EXEEXT@ # Install into alternate root area, e.g. for package generation INSTALLROOT = # Link LN_S = @LN_S@ # Install program INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ # Compiler and compiler flags CC = @CC@ CFLAGS = @CFLAGS@ -I$(SRCROOT) # Link flags LDFLAGS = @LDFLAGS@ # Libraries (client and server) TFTP_LIBS = ../common/libcommon.a @TFTP_LIBS@ TFTPD_LIBS = ../common/libcommon.a @TFTPD_LIBS@ # Additional library we need to build LIBOBJS = @LIBOBJS@ # Additional tftpd objects we need to build TFTPDOBJS = @TFTPDOBJS@ # ar and ranlib (for making libraries) AR = ar cq RANLIB = @RANLIB@ tftp-hpa-5.2/Makefile0000664000200200020020000000350211671225440012627 0ustar hpahpa# You can do "make SUB=blah" to make only a few, or edit here, or both # You can also run make directly in the subdirs you want. SUB = lib common tftp tftpd %.build: MCONFIG aconfig.h version.h $(MAKE) -C $(patsubst %.build, %, $@) %.install: MCONFIG aconfig.h version.h $(MAKE) -C $(patsubst %.install, %, $@) install %.clean: $(MAKE) -C $(patsubst %.clean, %, $@) clean %.distclean: $(MAKE) -C $(patsubst %.distclean, %, $@) distclean all: MCONFIG $(patsubst %, %.build, $(SUB)) tftp.build: lib.build common.build tftpd.build: lib.build common.build install: MCONFIG $(patsubst %, %.install, $(SUB)) clean: localclean $(patsubst %, %.clean, $(SUB)) localclean: rm -f version.h distclean: localdistclean $(patsubst %, %.distclean, $(SUB)) localdistclean: localclean rm -f MCONFIG config.status config.log aconfig.h *~ \#* rm -rf *.cache find . -type f \( -name \*.orig -o -name \*.rej \) | xargs rm -f spotless: distclean rm -f configure aconfig.h.in tftp.spec autoconf: configure aconfig.h.in config: MCONFIG aconfig.h release: $(MAKE) autoconf $(MAKE) tftp.spec $(MAKE) distclean MCONFIG: configure MCONFIG.in aconfig.h.in if test -x config.status; then \ ./config.status --recheck && ./config.status ; \ else \ ./configure ; \ fi aconfig.h: MCONFIG : Generated by side effect # Adding "configure" to the dependencies serializes this with running # autoconf, because there are apparently race conditions between # autoconf and autoheader. aconfig.h.in: configure.in configure aclocal.m4 rm -f aconfig.h.in aconfig.h autoheader configure: configure.in aclocal.m4 rm -rf MCONFIG configure config.log aconfig.h *.cache autoconf version.h: version echo \#define VERSION \"tftp-hpa `cat version`\" > version.h tftp.spec: tftp.spec.in version sed -e "s/@@VERSION@@/`cat version`/g" < $< > $@ || rm -f $@ tftp-hpa-5.2/CHANGES0000664000200200020020000002431511671225440012167 0ustar hpahpaChanges in 5.2: Fix breakage on newer Linux when a single interface has multiple IP addresses. Changes in 5.1: Add -P option to write a PID file. Patch by Ferenc Wagner. Bounce the syslog socket in standalone mode, in case the syslog daemon has been restarted. Patch by Ferenc Wagner. Build fixes. Fix handling of block number wraparound after a successful options negotiation. Fix a buffer overflow in option parsing. Changes in 5.0: Try to on platforms with getaddrinfo() without AI_ADDRCONFIG or AI_CANONNAME. Implement the "rollover" option, for clients which want block number to rollover to anything other than zero. Correctly disable PMTU in standalone mode. Patch by Florian Lohoff. Changes in 0.49: Add IPv6 support. Patch by Karsten Keil. Support systems with editline instead of readline. Support long options in the server. Changes in 0.48: Unbreak -l -s in the server, which was broken in 0.47. Changes in 0.47: Add -L option to the server to run standalone without detaching from the shell. Parallel make fix. Changes in 0.46: Minor portability improvements. Changes in 0.45: Add -l (literal) option to the client, to override the special treatment of the colon (:) character as a hostname separator. Changes in 0.44: Allow the client to specify a range of local port numbers, just like the server can. Fix sending SIGHUP to update the regular expression table. Changes in 0.43: Fix double-free error on ^c in client. Try to deal with clients that send TFTP requests to broadcasts (apparently some recent Sun boxes do this instead of using the address told by DHCP. Bad Sun! Bad Sun!) Portability fixes. Changes in 0.42: Try to disable path MTU discovery for TFTP connections (it's useless anyway.) Add a hack to allow the admin to specify a range of local port numbers to use. Fix local IP number handling on systems which present IP_RECVDSTADDR in recvmsg(). Changes in 0.41: Fix bug by which patterns of the form \U\1 weren't converted correctly. Changes in 0.40.1: Solaris build fix. Changes in 0.40: Fix bug which would cause "r" remapping rules to be incorrectly rejected. Changes in 0.39: Support Perl-style \U...\E and \L...\E, as well as allow matching rules to be inverted (execute if rule *doesn't* match.) Fix a timeout bug. Add an RPM spec file. Changes in 0.38: Portability fixes. Changes in 0.37: Fix a pathology where a client sending ACKs for the wrong packet can prevent proper retransmission. Changes in 0.36: Portability fixes. Changes in 0.35: Add an option to control the maximum value of blksize negotiated. Removed workaround for obsolete Cygwin problem. Don't use getopt() -- the -c option doesn't work correctly since it depends on the ordering of arguments and options. It is now possible to do: tftp -m binary hostname -c get filename This was previous possible by doing: tftp -m binary -c get hostname:filename ... but it seemed that was counterintuitive to people. Somewhat improved configure scripts. Changes in 0.34: Additional Solaris gcc compiler bug workarounds; these actually make the code somewhat cleaner. Changes in 0.33: Even better error messages. Work around a suspect Solaris gcc bug. Configuration fix: readline needs termcap. Support running the tftp client from the command line. For example: tftp -m binary -c get hostname:file Changes in 0.32: Better error messages; including the capability to send a custom error message to the client when hitting an "a" rule in a remapping table. Changes in 0.31: Put in a check to make sure xinetd (in particular) doesn't pass us an IPv6 socket. Fix some problems related to timeout negotiation. Allow the user to set the default timeout speed. Changes in 0.30: (Hopefully) better timeout algorithm. Add a "utimeout" option; like "timeout" but in microseconds. Change the log level of client-side errors to LOG_WARNING. autoconf portability improvements. Minor bugfixes. Changes in 0.29: Posixly correctness. Now compiles and runs on Win32 systems using Cygwin (http://www.cygwin.com/). (). Fixed a bug which could cause a standalone server to exit with a "recvfrom: Interrupted system call" log message if signals arrive at a particularly inopportune moment. Fix a macro substitution bug (thanks to Richard Nyberg.) Changes in 0.28: Fix stupid one-liner bug which broke standalone mode (-l). Changes in 0.27: Make the Digital Unix 4.0F platform work again. Thanks to Alan Sundell for helping out with this platform! Make the AIX 4.3 platform work again. Thanks to Josef Siemes for helping out with this platform! Allow replacement patterns to include the IP address of the requesting host (\i). Allow relying on Unix permissions rather than o+r magic if the -p option is specified. As part of this, set all groups if initgroups() is specified on the platform. Clean up race conditions inherited from the BSD source base. Changes in 0.26: Fix the configuration process so tftpd doesn't end up depending on readline, which apparently could happen on some platforms before. Make parallel builds (make -j) work correctly. Improve parsing of the "connect" command in the tftp client. Add a -V option to both tftp and tftpd to print the version number on stdout and immediately exit. Add a -v option to tftp to start out in verbose mode. Rewrite the man pages using standard "man" troff macros. Enable the (limited) use of readline on systems which don't have readline/history.h. Support compiling under MacOS X with fink (see ). Thanks for Justin Hallett and Eric Eslinger for their help in getting this working! Changes in 0.25: Fixed Sorcerer's Apprentice bug in both the client and the server. These bugs were inherited from the original BSD code. Changes in 0.24: Fix bugs in both client and server dealing with block number wraparound, usually manifesting themselves as failure to handle files over 32 MB in size. Officially make the client a part of the tftp-hpa project. Changes in 0.23: Correct memory overwrite bug in the tftp client when compiled with readline. Changes in 0.22: Even more portability improvements: FreeBSD and Tru64/Digital Unix. Fix tsize option on systems on which off_t is "long long". Support large files on systems which need _LARGE_FILE_BITS or similar. Some source cleanups; change to autoconf 2.52. Add support for readline command-line editing in tftp. Changes in 0.21: Support running in standalone mode, without inetd. Even more portability improvements. Now known to compile and run on Linux, Solaris 5, 5.1, 6, 7 and 8, and AIX. Reports of success or failure on other modern systems always appreciated. Clean and modernize some really ugly old code. Fix a potential illegal memory access when running in "totally insecure mode" - no -s, no directories listed. Changes in 0.20: Portability improvements. Now known to compile and run on Solaris 8. Changes in 0.19: Fork before performing tcpwrappers check. Don't rely on nonstandard bsd_signal() function, instead require that the platform has sigaction(). This is 2001, after all. This may resolve some potential portability problems. Log a message if memory allocation fails, instead of dying silently. Clean up the main dispatch loop. Use for exit codes, if it exists. Add support for debugging remapping rulefiles; if logging with -vvv tftpd will log all rules actions. Correct the error code issued by an "abort" rule. Changes in 0.18: Support (almost) arbitrary filename remappings via regular expression-based rulesets. Added -v option for more verbose logging. Changes in 0.17: Add support for tcpwrapper checking (/etc/hosts.allow; /etc/hosts.deny) in tftpd. Compile correctly on glibc 2.1.2. Add -u option to specify the user id to run as (default "nobody".) Operate in "daemon mode" as long as we keep getting requests. This should speed up handling large amounts of requests at once, as can happen when a client starts up, and avoids inetd misconfiguration problems. Changes in 0.16: Correct massive lossage from 0.15: apparently 0.15 was based on an out-of-date CVS repository, somehow. Fix for ACKs in TFTP PUT; patch by Roger Venning. Changes in 0.15: If the operating system allows, try to obtain the local address used for the request packet, and reply using the same local IP address. Some embedded TFTP clients are (probably incorrectly) picky about this. Changes in 0.14: Hacks to signal handling to avoid "zombie servers." Changes in 0.13: Added the non-standard option "blksize2". The "blksize" option is limited in its usability, since TFTP is designed to be implemented in a ROM, and ROM code might find it painful to deal with packets that don't meet certain alignment restrictions. The "blksize2" option tells the server that the block size must be a power of 2 to be usable to the client. The server SHALL respond with a block size that is a power of two, up to a maximum of 32768, or reject the option. Furthermore, the server SHALL grant a block size that is no smaller than 512 bytes unless the client explicitly requested a smaller block size. If the client request both options, the server MAY accept one or the other, but not both. At some point I will probably write up an IETF draft for this option. General information on the tftp-hpa series: The core software was taken from OpenBSD (CVS source as of 1999-09-21). I believe this was the most secure source base available at the time I obtained this code, and it included support for the -s and -c options. The un-BSD-ized Makefiles and a lot of the configure macros were taken from netkit-tftp-0.10 by David Holland; I also followed this example and modernized the code style throughout. Patches by Markus Gutschke and Gero Kuhlmann were the basis for the option negotiation as well as the "blksize" and "tsize" option support, although I made a fair amount of mostly stylistic changes to their code. Adding the -r option (disable a specific option), the "timeout" option, converting to using autoconf for setup, and any additions listed in the Changes list above, has all been my own code, as are any bugs introduced in the merge. tftp-hpa-5.2/version0000664000200200020020000000000411671225440012571 0ustar hpahpa5.2 tftp-hpa-5.2/configure.in0000664000200200020020000001556011671225440013507 0ustar hpahpadnl dnl autoconf input file to generate MCONFIG dnl AC_PREREQ(2.61) AC_INIT(MCONFIG.in) AC_PREFIX_DEFAULT(/usr) AC_USE_SYSTEM_EXTENSIONS AC_ISC_POSIX AC_PROG_CC AC_C_CONST AC_C_INLINE PA_ADD_CFLAGS(-W) PA_ADD_CFLAGS(-Wall) PA_ADD_CFLAGS(-Wpointer-arith) PA_ADD_CFLAGS(-Wbad-function-cast) PA_ADD_CFLAGS(-Wcast-equal) PA_ADD_CFLAGS(-Wstrict-prototypes) PA_ADD_CFLAGS(-Wmissing-prototypes) PA_ADD_CFLAGS(-Wmissing-declarations) PA_ADD_CFLAGS(-Wnested-externs) PA_ADD_CFLAGS(-Winline) PA_ADD_CFLAGS(-Wwrite-strings) PA_ADD_CFLAGS(-Wundef) PA_ADD_CFLAGS(-Wshadow) PA_ADD_CFLAGS(-Wsign-compare) PA_ADD_CFLAGS(-pipe) PA_ADD_CFLAGS(-fno-strict-aliasing) AC_HEADER_STDC AC_CHECK_HEADERS(inttypes.h) AC_CHECK_HEADERS(stdint.h) PA_CHECK_INTTYPES_H_SANE AC_CHECK_HEADERS(fcntl.h) AC_CHECK_HEADERS(grp.h) AC_CHECK_HEADERS(libgen.h) AC_CHECK_HEADERS(memory.h) AC_CHECK_HEADERS(setjmp.h) AC_CHECK_HEADERS(stddef.h) AC_CHECK_HEADERS(stdlib.h) AC_CHECK_HEADERS(string.h) AC_CHECK_HEADERS(strings.h) AC_CHECK_HEADERS(sysexits.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(sys/file.h) AC_CHECK_HEADERS(sys/filio.h) AC_CHECK_HEADERS(sys/stat.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/types.h) AC_CHECK_HEADERS(arpa/inet.h) AC_CHECK_HEADERS(netdb.h) AC_HEADER_TIME dnl This is needed on some versions of FreeBSD... AC_CHECK_HEADERS(machine/param.h) AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(winsock2.h) AC_CHECK_HEADERS(winsock.h) AC_SYS_LARGEFILE AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_MODE_T AC_TYPE_SIZE_T AC_CHECK_TYPES(intmax_t) AC_CHECK_TYPES(long long) AC_CHECK_TYPES(uint16_t) AC_CHECK_TYPES(uint32_t) AC_CHECK_TYPES(u_short) AC_CHECK_TYPES(u_long) dnl dnl isn't among the list of standard headers that autoconf checks, dnl but POSIX requires for socklen_t to be defined. dnl AC_CHECK_TYPES(socklen_t,,, [ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif ]) AC_SEARCH_LIBS(socket, [socket ws2_32 wsock32], , [AC_MSG_ERROR(socket library not found)]) AC_CHECK_FUNCS(fcntl) AC_CHECK_FUNCS(setsid) AC_CHECK_FUNCS(recvmsg) AC_CHECK_FUNCS(ftruncate) AC_CHECK_FUNCS(setreuid) AC_CHECK_FUNCS(setregid) AC_CHECK_FUNCS(initgroups) AC_CHECK_FUNCS(setgroups) dnl Solaris 8 has [u]intmax_t but not strtoumax(). How utterly braindamaged. AC_CHECK_FUNCS(strtoumax) AC_CHECK_FUNCS(strtoull) PA_MSGHDR_MSG_CONTROL PA_STRUCT_IN_PKTINFO PA_STRUCT_ADDRINFO PA_HEADER_DEFINES(fcntl.h, int, O_NONBLOCK) PA_HEADER_DEFINES(fcntl.h, int, O_BINARY) PA_HEADER_DEFINES(fcntl.h, int, O_TEXT) PA_HEADER_DEFINES(fcntl.h, int, F_SETLK) PA_HEADER_DEFINES(sys/file.h, int, LOCK_SH) PA_HEADER_DEFINES(sys/file.h, int, LOCK_EX) AH_TEMPLATE([HAVE_SIGSETJMP], [Define if we have sigsetjmp, siglongjmp and sigjmp_buf.]) PA_SIGSETJMP([AC_DEFINE(HAVE_SIGSETJMP)]) dnl dnl Get common paths dnl SRCROOT=`cd $srcdir && pwd` OBJROOT=`pwd` XTRA=false PA_SEARCH_LIBS_AND_ADD(xmalloc, iberty) PA_SEARCH_LIBS_AND_ADD(xstrdup, iberty) PA_SEARCH_LIBS_AND_ADD(bsd_signal, bsd, bsdsignal) PA_SEARCH_LIBS_AND_ADD(getopt_long, getopt, getopt_long) PA_SEARCH_LIBS_AND_ADD(getaddrinfo, [nsl resolv]) if $pa_add_getaddrinfo then AC_SEARCH_LIBS(gethostbyname, [nsl resolv], [AC_SEARCH_LIBS(herror, [nsl resolv], , [AC_MSG_ERROR(herror not found)])], [AC_MSG_ERROR(gethostbyname not found)]) else AC_SEARCH_LIBS(freeaddrinfo, [nsl resolv], , [AC_MSG_ERROR(getaddrinfo but not freeaddrinfo found)]) AC_SEARCH_LIBS(gai_strerror, [nsl resolv], , [AC_MSG_ERROR(getaddrinfo but not gai_strerror found)]) fi PA_SEARCH_LIBS_AND_ADD(inet_ntop, [nsl resolv]) if $pa_add_inet_ntop then AC_SEARCH_LIBS(inet_ntoa, [nsl resolv], , [AC_MSG_ERROR(inet_ntoa not found)]) fi AC_SEARCH_LIBS(inet_aton, [nsl resolv], ,[AC_MSG_ERROR(inet_aton not found)]) AC_CHECK_FUNCS(daemon, , [XTRA=true; AC_LIBOBJ(daemon)]) AC_CHECK_FUNCS(dup2, , [XTRA=true; AC_LIBOBJ(dup2)]) if $XTRA then XTRALIBS="$OBJROOT/lib/libxtra.a $XTRALIBS" fi dnl dnl These libraries apply to the server only dnl common_libs="$LIBS" PA_HEADER_DEFINES(netinet/in.h, int, IPPORT_TFTP) PA_WITH_BOOL(tcpwrappers, 1, [ --without-tcpwrappers disable tcpwrapper permissions checking], [ AC_SEARCH_LIBS(yp_get_default_domain, [nsl resolv]) PA_HAVE_TCPWRAPPERS ],:) AH_TEMPLATE([WITH_REGEX], [Define if we are compiling with regex filename remapping.]) PA_WITH_BOOL(remap, 1, [ --without-remap disable regex-based filename remapping], [ AC_CHECK_HEADER(regex.h, [ AC_SEARCH_LIBS(regcomp, [regex rx], [ AC_DEFINE(WITH_REGEX) TFTPDOBJS="remap.${OBJEXT} $TFTPDOBJS" ]) ]) ],:) TFTPD_LIBS="$LIBS $XTRALIBS" LIBS="$common_libs" dnl dnl These libraries apply to the client only dnl AH_TEMPLATE([WITH_READLINE], [Define if we are compiling with readline/editline command-line editing.]) PA_WITH_BOOL(readline, 1, [ --without-readline disable the use of readline command-line editing], [ AC_CHECK_HEADER(readline/readline.h, [ dnl readline may need libtermcap or somesuch... AC_SEARCH_LIBS(tputs, [termcap terminfo]) AC_SEARCH_LIBS(readline, [readline history], [AC_DEFINE(WITH_READLINE)]) AC_CHECK_HEADERS(readline/history.h) ], [AC_CHECK_HEADER(editline/readline.h, [ dnl editline may need libtermcap or somesuch... AC_SEARCH_LIBS(tputs, [termcap terminfo]) AC_SEARCH_LIBS(editline, [edit], [AC_DEFINE(WITH_READLINE)]) ])]) ],:) TFTP_LIBS="$LIBS $XTRALIBS" LIBS="$common_libs" dnl dnl Check for IPV6 and disable-ipv6 dnl PA_STRUCT_SOCKADDR_IN6 AC_MSG_CHECKING([for IPv6 support]) PA_WITH_BOOL(ipv6, 1, [ --without-ipv6 disable the support for IPv6], [ if $HAVE_INET6 then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 support is enabled.]) PA_STRUCT_IN6_PKTINFO else AC_MSG_RESULT(no) AC_MSG_WARN([*** we do not have required IPv6 structs - IPv6 will be disabled]) fi ], [AC_MSG_RESULT(disabled)]) AC_SUBST(SRCROOT) AC_SUBST(OBJROOT) AC_SUBST(TFTP_LIBS) AC_SUBST(TFTPD_LIBS) AC_SUBST(TFTPDOBJS) AC_PROG_LN_S AC_PROG_RANLIB dnl dnl Make sure the install program has an absolute path if it dnl has a path at all. autoconf doesn't do this "in order dnl to not pollute the cache." Sigh. dnl Note: the $ needs to be double-quoted for reasons unknown. dnl AC_PROG_INSTALL [if echo "$INSTALL" | grep '^[^/].*/' > /dev/null 2>&1; then INSTALL='\${SRCROOT}'/"$INSTALL" fi] AC_CONFIG_HEADERS(aconfig.h) AC_OUTPUT(MCONFIG) tftp-hpa-5.2/INSTALL0000664000200200020020000002212411671225440012221 0ustar hpahpaBasic Installation ================== These are generic installation instructions. See the file INSTALL.tftp for specific install instructions for this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for variables by setting them in the environment. You can do that on the command line like this: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Environment Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it cannot guess the host type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the host platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. In this case, you should also specify the build platform with `--build=TYPE', because, in this case, it may not be possible to guess the build platform (it sometimes involves compiling and running simple test programs, and this can't be done if the compiler is a cross compiler). Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Environment Variables ===================== Variables not defined in a site shell script can be set in the environment passed to configure. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. tftp-hpa-5.2/lib/0000775000200200020020000000000011671225440011735 5ustar hpahpatftp-hpa-5.2/lib/getopt_long.c0000664000200200020020000000624511671225440014431 0ustar hpahpa/* * getopt_long.c * * getopt_long(), or at least a common subset thereof: * * - Option reordering is not supported * - -W foo is not supported * - First optstring character "-" not supported. */ #include "config.h" char *optarg; int optind, opterr, optopt; static struct getopt_private_state { const char *optptr; const char *last_optstring; char *const *last_argv; } pvt; static inline const char *option_matches(const char *arg_str, const char *opt_name) { while (*arg_str != '\0' && *arg_str != '=') { if (*arg_str++ != *opt_name++) return NULL; } if (*opt_name) return NULL; return arg_str; } int getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longindex) { const char *carg; const char *osptr; int opt; /* getopt() relies on a number of different global state variables, which can make this really confusing if there is more than one use of getopt() in the same program. This attempts to detect that situation by detecting if the "optstring" or "argv" argument have changed since last time we were called; if so, reinitialize the query state. */ if (optstring != pvt.last_optstring || argv != pvt.last_argv || optind < 1 || optind > argc) { /* optind doesn't match the current query */ pvt.last_optstring = optstring; pvt.last_argv = argv; optind = 1; pvt.optptr = NULL; } carg = argv[optind]; /* First, eliminate all non-option cases */ if (!carg || carg[0] != '-' || !carg[1]) return -1; if (carg[1] == '-') { const struct option *lo; const char *opt_end = NULL; optind++; /* Either it's a long option, or it's -- */ if (!carg[2]) { /* It's -- */ return -1; } for (lo = longopts; lo->name; lo++) { if ((opt_end = option_matches(carg+2, lo->name))) break; } if (!opt_end) return '?'; if (longindex) *longindex = lo-longopts; if (*opt_end == '=') { if (lo->has_arg) optarg = (char *)opt_end+1; else return '?'; } else if (lo->has_arg == 1) { if (!(optarg = argv[optind])) return '?'; optind++; } if (lo->flag) { *lo->flag = lo->val; return 0; } else { return lo->val; } } if ((uintptr_t) (pvt.optptr - carg) > (uintptr_t) strlen(carg)) { /* Someone frobbed optind, change to new opt. */ pvt.optptr = carg + 1; } opt = *pvt.optptr++; if (opt != ':' && (osptr = strchr(optstring, opt))) { if (osptr[1] == ':') { if (*pvt.optptr) { /* Argument-taking option with attached argument */ optarg = (char *)pvt.optptr; optind++; } else { /* Argument-taking option with non-attached argument */ if (argv[optind + 1]) { optarg = (char *)argv[optind+1]; optind += 2; } else { /* Missing argument */ optind++; return (optstring[0] == ':') ? ':' : '?'; } } return opt; } else { /* Non-argument-taking option */ /* pvt.optptr will remember the exact position to resume at */ if (!*pvt.optptr) optind++; return opt; } } else { /* Unknown option */ optopt = opt; if (!*pvt.optptr) optind++; return '?'; } } tftp-hpa-5.2/lib/getaddrinfo.c0000664000200200020020000000536511671225440014400 0ustar hpahpa/* * getaddrinfo.c * * Simple version of getaddrinfo() * */ #include "config.h" extern int errno; extern int h_errno; void freeaddrinfo(struct addrinfo *res) { if (!res) return; if (res->ai_next) freeaddrinfo(res->ai_next); if (res->ai_addr) free(res->ai_addr); if (res->ai_canonname) free(res->ai_canonname); free(res); } int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) { struct hostent *host; struct sockaddr *sa; int err, size = 0; if ((!node) || (!res)) { errno = EINVAL; return EAI_SYSTEM; } *res = NULL; /* we do not support service in this version */ if (service) { errno = EINVAL; return EAI_SYSTEM; } host = gethostbyname(node); if (!host) return EAI_NONAME; if (hints) { if (hints->ai_family != AF_UNSPEC) { if (hints->ai_family != host->h_addrtype) return EAI_ADDRFAMILY; } } *res = malloc(sizeof(struct addrinfo)); if (!*res) { return EAI_MEMORY; } memset(*res, 0, sizeof(struct addrinfo)); (*res)->ai_family = host->h_addrtype; if (host->h_length) { if (host->h_addrtype == AF_INET) size = sizeof(struct sockaddr_in); #ifdef HAVE_IPV6 else if (host->h_addrtype == AF_INET6) size = sizeof(struct sockaddr_in6); #endif else { free(*res); *res = NULL; return EAI_ADDRFAMILY; } sa = malloc(size); if (!sa) { free(*res); *res = NULL; return EAI_MEMORY; } memset(sa, 0, size); (*res)->ai_addr = sa; (*res)->ai_addrlen = size; sa->sa_family = host->h_addrtype; if (host->h_addrtype == AF_INET) memcpy(&((struct sockaddr_in *)sa)->sin_addr, host->h_addr, host->h_length); #ifdef HAVE_IPV6 else memcpy(&((struct sockaddr_in6 *)sa)->sin6_addr, host->h_addr, host->h_length); #endif } if (host->h_name) (*res)->ai_canonname = strdup(host->h_name); /* we only handle the first address entry and do not build a list now */ return 0; } const char *gai_strerror(int errcode) { const char *s = NULL; switch(errcode) { case 0: s = "no error"; break; case EAI_MEMORY: s = "no memory"; break; case EAI_SYSTEM: s = strerror(errno); break; case EAI_NONAME: s = hstrerror(h_errno); break; case EAI_ADDRFAMILY: s = "address does not match address family"; break; default: s = "unknown error code"; break; } return s; } tftp-hpa-5.2/lib/inet_ntop.c0000664000200200020020000000201311671225440014074 0ustar hpahpa/* * inet_ntop.c * * Simple version of inet_ntop() * */ #include "config.h" extern int errno; const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) { char *p; switch(af) { case AF_INET: p = inet_ntoa(*((struct in_addr *)src)); if (p) { if (cnt <= strlen(p)) { errno = ENOSPC; dst = NULL; } else strcpy(dst, p); } else dst = NULL; break; #ifdef HAVE_IPV6 case AF_INET6: if (cnt < 40) { errno = ENOSPC; dst = NULL; } else { struct in6_addr *a = src; int i; p = (char *)dst; /* we do not compress :0: to :: */ for (i = 0; i < 8; i++) p += sprintf(p, "%x:", ntohs(a->s6_addr16[i])); p--; *p = 0; } break; #endif default: errno = EAFNOSUPPORT; dst = NULL; } return dst; } tftp-hpa-5.2/lib/Makefile0000664000200200020020000000051311671225440013374 0ustar hpahpa# # Extra functions which may not be available everywhere # SRCROOT = .. -include ../MCONFIG include ../MRULES ifeq ($(LIBOBJS),) all: else all: libxtra.a endif install: clean: -rm -f *.a *.o *.obj *.exe distclean: clean -rm -f *~ libxtra.a: $(LIBOBJS) -rm -f libxtra.a $(AR) libxtra.a $(LIBOBJS) $(RANLIB) libxtra.a tftp-hpa-5.2/lib/xstrdup.c0000664000200200020020000000037311671225440013615 0ustar hpahpa/* * xstrdup.c * * Simple error-checking version of strdup() * */ #include "config.h" char *xstrdup(const char *s) { char *p = strdup(s); if (!p) { fprintf(stderr, "Out of memory!\n"); exit(128); } return p; } tftp-hpa-5.2/lib/xmalloc.c0000664000200200020020000000037411671225440013544 0ustar hpahpa/* * xmalloc.c * * Simple error-checking version of malloc() * */ #include "config.h" void *xmalloc(size_t size) { void *p = malloc(size); if (!p) { fprintf(stderr, "Out of memory!\n"); exit(128); } return p; } tftp-hpa-5.2/lib/getopt.h0000664000200200020020000000060111671225440013405 0ustar hpahpa#ifndef LIB_GETOPT_H #define LIB_GETOPT_H extern char *optarg; extern int optind, opterr, optopt; struct option { const char *name; int has_arg; int *flag; int val; }; enum { no_argument = 0, required_argument = 1, optional_argument = 2, }; int getopt_long(int, char *const *, const char *, const struct option *, int *); #endif /* LIB_GETOPT_H */ tftp-hpa-5.2/lib/bsdsignal.c0000664000200200020020000000104211671225440014044 0ustar hpahpa/* * bsdsignal.c * * Use sigaction() to simulate BSD signal() */ #include "config.h" void (*bsd_signal(int signum, void (*handler) (int))) (int) { struct sigaction action, oldaction; memset(&action, 0, sizeof action); action.sa_handler = handler; sigemptyset(&action.sa_mask); sigaddset(&action.sa_mask, signum); action.sa_flags = SA_RESTART; if (sigaction(signum, &action, &oldaction) == -1) { #ifdef SIG_ERR return SIG_ERR; #else return NULL; #endif } return oldaction.sa_handler; } tftp-hpa-5.2/lib/dup2.c0000664000200200020020000000044711671225440012760 0ustar hpahpa/* * dup2.c * * Ersatz dup2() for really ancient systems */ #include "config.h" int dup2(int oldfd, int newfd) { int rv, nfd; close(newfd); nfd = rv = dup(oldfd); if (rv >= 0 && rv != newfd) { rv = dup2(oldfd, newfd); close(nfd); } return rv; } tftp-hpa-5.2/lib/daemon.c0000664000200200020020000000111211671225440013337 0ustar hpahpa/* * daemon.c - "daemonize" a process */ #include "config.h" int daemon(int nochdir, int noclose) { int nullfd; pid_t f; if (!nochdir) { if (chdir("/")) return -1; } if (!noclose) { if ((nullfd = open("/dev/null", O_RDWR)) < 0 || dup2(nullfd, 0) < 0 || dup2(nullfd, 1) < 0 || dup2(nullfd, 2) < 0) return -1; close(nullfd); } f = fork(); if (f < 0) return -1; else if (f > 0) _exit(0); #ifdef HAVE_SETSID return setsid(); #else return 0; #endif } tftp-hpa-5.2/tftpd/0000775000200200020020000000000011671225440012310 5ustar hpahpatftp-hpa-5.2/tftpd/misc.c0000664000200200020020000000255411671225440013415 0ustar hpahpa/* ----------------------------------------------------------------------- * * * Copyright 2001-2007 H. Peter Anvin - All Rights Reserved * * This program is free software available under the same license * as the "OpenBSD" operating system, distributed at * http://www.openbsd.org/. * * ----------------------------------------------------------------------- */ /* * misc.c * * Minor help routines. */ #include "config.h" /* Must be included first! */ #include #include "tftpd.h" /* * Set the signal handler and flags. Basically a user-friendly * wrapper around sigaction(). */ void set_signal(int signum, void (*handler) (int), int flags) { struct sigaction sa; memset(&sa, 0, sizeof sa); sa.sa_handler = handler; sigemptyset(&sa.sa_mask); sa.sa_flags = flags; if (sigaction(signum, &sa, NULL)) { syslog(LOG_ERR, "sigaction: %m"); exit(EX_OSERR); } } /* * malloc() that syslogs an error message and bails if it fails. */ void *tfmalloc(size_t size) { void *p = malloc(size); if (!p) { syslog(LOG_ERR, "malloc: %m"); exit(EX_OSERR); } return p; } /* * strdup() that does the equivalent */ char *tfstrdup(const char *str) { char *p = strdup(str); if (!p) { syslog(LOG_ERR, "strdup: %m"); exit(EX_OSERR); } return p; } tftp-hpa-5.2/tftpd/recvfrom.h0000664000200200020020000000115011671225440014301 0ustar hpahpa/* ----------------------------------------------------------------------- * * * Copyright 2001-2006 H. Peter Anvin - All Rights Reserved * * This program is free software available under the same license * as the "OpenBSD" operating system, distributed at * http://www.openbsd.org/. * * ----------------------------------------------------------------------- */ /* * recvfrom.h * * Header for recvfrom substitute * */ #include "config.h" int myrecvfrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, socklen_t *fromlen, union sock_addr *myaddr); tftp-hpa-5.2/tftpd/sample.rules0000664000200200020020000000231111671225440014642 0ustar hpahpa# # Sample rule file for the -m (remapping option) # # This file has three fields: operation, regex, remapping # # The operation is a combination of the following letters: # # r - rewrite the matched string with the remapping pattern # i - case-insensitive matching # g - repeat until no match (used with "r") # e - exit (with success) if we match this pattern, do not process # subsequent rules # s - start over from the first rule if we match this pattern # a - abort (refuse the request) if we match this rule # G - this rule applies to TFTP GET requests only # P - this rule applies to TFTP PUT requests only # # The regex is a regular expression in the style of egrep(1). # # The remapping is a pattern, all characters are verbatim except \ # \0 copies the full string that matched the regex # \1..\9 copies the 9 first (..) expressions in the regex # \\ is an escaped \ # # "#" begins a comment, unless \-escaped # ri ^[a-z]: # Remove "drive letters" rg \\ / # Convert backslashes to slashes rg \# @ # Convert hash marks to @ signs rg /../ /..no../ # Convert /../ to /..no../ e ^ok/ # These are always ok r ^[^/] /tftpboot/\0 # Convert non-absolute files a \.pvt$ # Reject requests for private files tftp-hpa-5.2/tftpd/remap.h0000664000200200020020000000243511671225440013571 0ustar hpahpa/* ----------------------------------------------------------------------- * * * Copyright 2001-2007 H. Peter Anvin - All Rights Reserved * * This program is free software available under the same license * as the "OpenBSD" operating system, distributed at * http://www.openbsd.org/. * * ----------------------------------------------------------------------- */ /* * remap.h * * Prototypes for regular-expression based filename remapping. */ #ifndef TFTPD_REMAP_H #define TFTPD_REMAP_H /* Opaque type */ struct rule; #ifdef WITH_REGEX /* This is called when we encounter a substitution like \i. The macro character is passed as the first argument; the output buffer, if any, is passed as the second argument. The function should return the number of characters output, or -1 on failure. */ typedef int (*match_pattern_callback) (char, char *); /* Read a rule file */ struct rule *parserulefile(FILE *); /* Destroy a rule file data structure */ void freerules(struct rule *); /* Execute a rule set on a string; returns a malloc'd new string. */ char *rewrite_string(const char *, const struct rule *, char, match_pattern_callback, const char **); #endif /* WITH_REGEX */ #endif /* TFTPD_REMAP_H */ tftp-hpa-5.2/tftpd/recvfrom.c0000664000200200020020000001673311671225440014311 0ustar hpahpa/* ----------------------------------------------------------------------- * * * Copyright 2001-2006 H. Peter Anvin - All Rights Reserved * * This program is free software available under the same license * as the "OpenBSD" operating system, distributed at * http://www.openbsd.org/. * * ----------------------------------------------------------------------- */ /* * recvfrom.c * * Emulate recvfrom() using recvmsg(), but try to capture the local address * since some TFTP clients consider it an error to get the reply from another * IP address than the request was sent to. * */ #include "config.h" /* Must be included first! */ #include "common/tftpsubs.h" #include "recvfrom.h" #ifdef HAVE_MACHINE_PARAM_H #include /* Needed on some versions of FreeBSD */ #endif #if defined(HAVE_RECVMSG) && defined(HAVE_MSGHDR_MSG_CONTROL) #include #ifdef IP_PKTINFO # ifndef HAVE_STRUCT_IN_PKTINFO # ifdef __linux__ /* Assume this version of glibc simply lacks the definition */ struct in_pktinfo { int ipi_ifindex; struct in_addr ipi_spec_dst; struct in_addr ipi_addr; }; # else # undef IP_PKTINFO /* No definition, no way to get it */ # endif # endif #endif #ifndef CMSG_LEN # define CMSG_LEN(size) (sizeof(struct cmsghdr) + (size)) #endif #ifndef CMSG_SPACE # define CMSG_SPACE(size) (sizeof(struct cmsghdr) + (size)) #endif /* * Check to see if this is a valid local address, meaning that we can * legally bind to it. */ static int address_is_local(const union sock_addr *addr) { union sock_addr sa1, sa2; int sockfd = -1; int e; int rv = 0; socklen_t addrlen; memcpy(&sa1, addr, sizeof sa1); /* Multicast or universal broadcast address? */ if (sa1.sa.sa_family == AF_INET) { if (ntohl(sa1.si.sin_addr.s_addr) >= (224UL << 24)) return 0; sa1.si.sin_port = 0; /* Any port */ } #ifdef HAVE_IPV6 else if (sa1.sa.sa_family == AF_INET6) { if (IN6_IS_ADDR_MULTICAST(&sa1.s6.sin6_addr)) return 0; sa1.s6.sin6_port = 0; /* Any port */ } #endif else return 0; sockfd = socket(sa1.sa.sa_family, SOCK_DGRAM, 0); if (sockfd < 0) goto err; if (bind(sockfd, &sa1.sa, SOCKLEN(&sa1))) goto err; addrlen = SOCKLEN(addr); if (getsockname(sockfd, (struct sockaddr *)&sa2, &addrlen)) goto err; if (sa1.sa.sa_family != sa2.sa.sa_family) goto err; if (sa2.sa.sa_family == AF_INET) rv = sa1.si.sin_addr.s_addr == sa2.si.sin_addr.s_addr; #ifdef HAVE_IPV6 else if (sa2.sa.sa_family == AF_INET6) rv = IN6_ARE_ADDR_EQUAL(&sa1.s6.sin6_addr, &sa2.s6.sin6_addr); #endif else rv = 0; err: e = errno; if (sockfd >= 0) close(sockfd); errno = e; return rv; } int myrecvfrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, socklen_t * fromlen, union sock_addr *myaddr) { struct msghdr msg; struct iovec iov; int n; struct cmsghdr *cmptr; union { struct cmsghdr cm; #ifdef IP_PKTINFO char control[CMSG_SPACE(sizeof(struct in_addr)) + CMSG_SPACE(sizeof(struct in_pktinfo))]; #else char control[CMSG_SPACE(sizeof(struct in_addr))]; #endif #ifdef HAVE_IPV6 #ifdef HAVE_STRUCT_IN6_PKTINFO char control6[CMSG_SPACE(sizeof(struct in6_addr)) + CMSG_SPACE(sizeof(struct in6_pktinfo))]; #else char control6[CMSG_SPACE(sizeof(struct in6_addr))]; #endif #endif } control_un; int on = 1; #ifdef IP_PKTINFO struct in_pktinfo pktinfo; #endif #ifdef HAVE_STRUCT_IN6_PKTINFO struct in6_pktinfo pktinfo6; #endif /* Try to enable getting the return address */ #ifdef IP_RECVDSTADDR if (from->sa_family == AF_INET) setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on)); #endif #ifdef IP_PKTINFO if (from->sa_family == AF_INET) setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on)); #endif #ifdef HAVE_IPV6 #ifdef IPV6_RECVPKTINFO if (from->sa_family == AF_INET6) setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)); #endif #endif bzero(&msg, sizeof msg); /* Clear possible system-dependent fields */ msg.msg_control = control_un.control; msg.msg_controllen = sizeof(control_un); msg.msg_flags = 0; msg.msg_name = from; msg.msg_namelen = *fromlen; iov.iov_base = buf; iov.iov_len = len; msg.msg_iov = &iov; msg.msg_iovlen = 1; if ((n = recvmsg(s, &msg, flags)) < 0) return n; /* Error */ *fromlen = msg.msg_namelen; if (myaddr) { bzero(myaddr, sizeof(*myaddr)); myaddr->sa.sa_family = from->sa_family; if (msg.msg_controllen < sizeof(struct cmsghdr) || (msg.msg_flags & MSG_CTRUNC)) return n; /* No information available */ for (cmptr = CMSG_FIRSTHDR(&msg); cmptr != NULL; cmptr = CMSG_NXTHDR(&msg, cmptr)) { if (from->sa_family == AF_INET) { myaddr->sa.sa_family = AF_INET; #ifdef IP_RECVDSTADDR if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_RECVDSTADDR) { memcpy(&myaddr->si.sin_addr, CMSG_DATA(cmptr), sizeof(struct in_addr)); } #endif #ifdef IP_PKTINFO if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_PKTINFO) { memcpy(&pktinfo, CMSG_DATA(cmptr), sizeof(struct in_pktinfo)); memcpy(&myaddr->si.sin_addr, &pktinfo.ipi_addr, sizeof(struct in_addr)); } #endif } #ifdef HAVE_IPV6 else if (from->sa_family == AF_INET6) { myaddr->sa.sa_family = AF_INET6; #ifdef IP6_RECVDSTADDR if (cmptr->cmsg_level == IPPROTO_IPV6 && cmptr->cmsg_type == IPV6_RECVDSTADDR ) memcpy(&myaddr->s6.sin6_addr, CMSG_DATA(cmptr), sizeof(struct in6_addr)); #endif #ifdef HAVE_STRUCT_IN6_PKTINFO if (cmptr->cmsg_level == IPPROTO_IPV6 && (cmptr->cmsg_type == IPV6_RECVPKTINFO || cmptr->cmsg_type == IPV6_PKTINFO)) { memcpy(&pktinfo6, CMSG_DATA(cmptr), sizeof(struct in6_pktinfo)); memcpy(&myaddr->s6.sin6_addr, &pktinfo6.ipi6_addr, sizeof(struct in6_addr)); } #endif } #endif } /* If the address is not a valid local address, * then bind to any address... */ if (address_is_local(myaddr) != 1) { if (myaddr->sa.sa_family == AF_INET) ((struct sockaddr_in *)myaddr)->sin_addr.s_addr = INADDR_ANY; #ifdef HAVE_IPV6 else if (myaddr->sa.sa_family == AF_INET6) memset(&myaddr->s6.sin6_addr, 0, sizeof(struct in6_addr)); #endif } } return n; } #else /* pointless... */ int myrecvfrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, socklen_t * fromlen, union sock_addr *myaddr) { /* There is no way we can get the local address, fudge it */ bzero(myaddr, sizeof(*myaddr)); myaddr->sa.sa_family = from->sa_family; sa_set_port(myaddr, htons(IPPORT_TFTP)); return recvfrom(s, buf, len, flags, from, fromlen); } #endif tftp-hpa-5.2/tftpd/remap.c0000664000200200020020000003015311671225440013562 0ustar hpahpa/* ----------------------------------------------------------------------- * * * Copyright 2001-2007 H. Peter Anvin - All Rights Reserved * * This program is free software available under the same license * as the "OpenBSD" operating system, distributed at * http://www.openbsd.org/. * * ----------------------------------------------------------------------- */ /* * remap.c * * Perform regular-expression based filename remapping. */ #include "config.h" /* Must be included first! */ #include #include #include #include "tftpd.h" #include "remap.h" #define DEADMAN_MAX_STEPS 1024 /* Timeout after this many steps */ #define MAXLINE 16384 /* Truncate a line at this many bytes */ #define RULE_REWRITE 0x01 /* This is a rewrite rule */ #define RULE_GLOBAL 0x02 /* Global rule (repeat until no match) */ #define RULE_EXIT 0x04 /* Exit after matching this rule */ #define RULE_RESTART 0x08 /* Restart at the top after matching this rule */ #define RULE_ABORT 0x10 /* Terminate processing with an error */ #define RULE_INVERSE 0x20 /* Execute if regex *doesn't* match */ struct rule { struct rule *next; int nrule; int rule_flags; char rule_mode; regex_t rx; const char *pattern; }; static int xform_null(int c) { return c; } static int xform_toupper(int c) { return toupper(c); } static int xform_tolower(int c) { return tolower(c); } /* Do \-substitution. Call with string == NULL to get length only. */ static int genmatchstring(char *string, const char *pattern, const char *input, const regmatch_t * pmatch, match_pattern_callback macrosub) { int (*xform) (int) = xform_null; int len = 0; int n, mlen, sublen; int endbytes; /* Get section before match; note pmatch[0] is the whole match */ endbytes = strlen(input) - pmatch[0].rm_eo; len = pmatch[0].rm_so + endbytes; if (string) { memcpy(string, input, pmatch[0].rm_so); string += pmatch[0].rm_so; } /* Transform matched section */ while (*pattern) { mlen = 0; if (*pattern == '\\' && pattern[1] != '\0') { char macro = pattern[1]; switch (macro) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = pattern[1] - '0'; if (pmatch[n].rm_so != -1) { mlen = pmatch[n].rm_eo - pmatch[n].rm_so; len += mlen; if (string) { const char *p = input + pmatch[n].rm_so; while (mlen--) *string++ = xform(*p++); } } break; case 'L': xform = xform_tolower; break; case 'U': xform = xform_toupper; break; case 'E': xform = xform_null; break; default: if (macrosub && (sublen = macrosub(macro, string)) >= 0) { while (sublen--) { len++; if (string) { *string = xform(*string); string++; } } } else { len++; if (string) *string++ = xform(pattern[1]); } } pattern += 2; } else { len++; if (string) *string++ = xform(*pattern); pattern++; } } /* Copy section after match */ if (string) { memcpy(string, input + pmatch[0].rm_eo, endbytes); string[endbytes] = '\0'; } return len; } /* * Extract a string terminated by non-escaped whitespace; ignoring * leading whitespace. Consider an unescaped # to be a comment marker, * functionally \n. */ static int readescstring(char *buf, char **str) { char *p = *str; int wasbs = 0, len = 0; while (*p && isspace(*p)) p++; if (!*p) { *buf = '\0'; *str = p; return 0; } while (*p) { if (!wasbs && (isspace(*p) || *p == '#')) { *buf = '\0'; *str = p; return len; } /* Important: two backslashes leave us in the !wasbs state! */ wasbs = !wasbs && (*p == '\\'); *buf++ = *p++; len++; } *buf = '\0'; *str = p; return len; } /* Parse a line into a set of instructions */ static int parseline(char *line, struct rule *r, int lineno) { char buffer[MAXLINE]; char *p; int rv; int rxflags = REG_EXTENDED; static int nrule; memset(r, 0, sizeof *r); r->nrule = nrule; if (!readescstring(buffer, &line)) return 0; /* No rule found */ for (p = buffer; *p; p++) { switch (*p) { case 'r': r->rule_flags |= RULE_REWRITE; break; case 'g': r->rule_flags |= RULE_GLOBAL; break; case 'e': r->rule_flags |= RULE_EXIT; break; case 's': r->rule_flags |= RULE_RESTART; break; case 'a': r->rule_flags |= RULE_ABORT; break; case 'i': rxflags |= REG_ICASE; break; case '~': r->rule_flags |= RULE_INVERSE; break; case 'G': case 'P': r->rule_mode = *p; break; default: syslog(LOG_ERR, "Remap command \"%s\" on line %d contains invalid char \"%c\"", buffer, lineno, *p); return -1; /* Error */ break; } } /* RULE_GLOBAL only applies when RULE_REWRITE specified */ if (!(r->rule_flags & RULE_REWRITE)) r->rule_flags &= ~RULE_GLOBAL; if ((r->rule_flags & (RULE_INVERSE | RULE_REWRITE)) == (RULE_INVERSE | RULE_REWRITE)) { syslog(LOG_ERR, "r rules cannot be inverted, line %d: %s\n", lineno, line); return -1; /* Error */ } /* Read and compile the regex */ if (!readescstring(buffer, &line)) { syslog(LOG_ERR, "No regex on remap line %d: %s\n", lineno, line); return -1; /* Error */ } if ((rv = regcomp(&r->rx, buffer, rxflags)) != 0) { char errbuf[BUFSIZ]; regerror(rv, &r->rx, errbuf, BUFSIZ); syslog(LOG_ERR, "Bad regex in remap line %d: %s\n", lineno, errbuf); return -1; /* Error */ } /* Read the rewrite pattern, if any */ if (readescstring(buffer, &line)) { r->pattern = tfstrdup(buffer); } else { r->pattern = ""; } nrule++; return 1; /* Rule found */ } /* Read a rule file */ struct rule *parserulefile(FILE * f) { char line[MAXLINE]; struct rule *first_rule = NULL; struct rule **last_rule = &first_rule; struct rule *this_rule = tfmalloc(sizeof(struct rule)); int rv; int lineno = 0; int err = 0; while (lineno++, fgets(line, MAXLINE, f)) { rv = parseline(line, this_rule, lineno); if (rv < 0) err = 1; if (rv > 0) { *last_rule = this_rule; last_rule = &this_rule->next; this_rule = tfmalloc(sizeof(struct rule)); } } free(this_rule); /* Last one is always unused */ if (err) { /* Bail on error, we have already logged an error message */ exit(EX_CONFIG); } return first_rule; } /* Destroy a rule file data structure */ void freerules(struct rule *r) { struct rule *next; while (r) { next = r->next; regfree(&r->rx); /* "" patterns aren't allocated by malloc() */ if (r->pattern && *r->pattern) free((void *)r->pattern); free(r); r = next; } } /* Execute a rule set on a string; returns a malloc'd new string. */ char *rewrite_string(const char *input, const struct rule *rules, char mode, match_pattern_callback macrosub, const char **errmsg) { char *current = tfstrdup(input); char *newstr; const struct rule *ruleptr = rules; regmatch_t pmatch[10]; int len; int was_match = 0; int deadman = DEADMAN_MAX_STEPS; /* Default error */ *errmsg = "Remap table failure"; if (verbosity >= 3) { syslog(LOG_INFO, "remap: input: %s", current); } for (ruleptr = rules; ruleptr; ruleptr = ruleptr->next) { if (ruleptr->rule_mode && ruleptr->rule_mode != mode) continue; /* Rule not applicable, try next */ if (!deadman--) { syslog(LOG_WARNING, "remap: Breaking loop, input = %s, last = %s", input, current); free(current); return NULL; /* Did not terminate! */ } do { if (regexec(&ruleptr->rx, current, 10, pmatch, 0) == (ruleptr->rule_flags & RULE_INVERSE ? REG_NOMATCH : 0)) { /* Match on this rule */ was_match = 1; if (ruleptr->rule_flags & RULE_INVERSE) { /* No actual match, so clear out the pmatch array */ int i; for (i = 0; i < 10; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1; } if (ruleptr->rule_flags & RULE_ABORT) { if (verbosity >= 3) { syslog(LOG_INFO, "remap: rule %d: abort: %s", ruleptr->nrule, current); } if (ruleptr->pattern[0]) { /* Custom error message */ len = genmatchstring(NULL, ruleptr->pattern, current, pmatch, macrosub); newstr = tfmalloc(len + 1); genmatchstring(newstr, ruleptr->pattern, current, pmatch, macrosub); *errmsg = newstr; } else { *errmsg = NULL; } free(current); return (NULL); } if (ruleptr->rule_flags & RULE_REWRITE) { len = genmatchstring(NULL, ruleptr->pattern, current, pmatch, macrosub); newstr = tfmalloc(len + 1); genmatchstring(newstr, ruleptr->pattern, current, pmatch, macrosub); free(current); current = newstr; if (verbosity >= 3) { syslog(LOG_INFO, "remap: rule %d: rewrite: %s", ruleptr->nrule, current); } } } else { break; /* No match, terminate unconditionally */ } /* If the rule is global, keep going until no match */ } while (ruleptr->rule_flags & RULE_GLOBAL); if (was_match) { was_match = 0; if (ruleptr->rule_flags & RULE_EXIT) { if (verbosity >= 3) { syslog(LOG_INFO, "remap: rule %d: exit", ruleptr->nrule); } return current; /* Exit here, we're done */ } else if (ruleptr->rule_flags & RULE_RESTART) { ruleptr = rules; /* Start from the top */ if (verbosity >= 3) { syslog(LOG_INFO, "remap: rule %d: restart", ruleptr->nrule); } } } } if (verbosity >= 3) { syslog(LOG_INFO, "remap: done"); } return current; } tftp-hpa-5.2/tftpd/tftpd.c0000664000200200020020000014555411671225440013613 0ustar hpahpa/* * Copyright (c) 1983 Regents of the University of California. * Copyright (c) 1999-2009 H. Peter Anvin * Copyright (c) 2011 Intel Corporation; author: H. Peter Anvin * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "config.h" /* Must be included first */ #include "tftpd.h" /* * Trivial file transfer protocol server. * * This version includes many modifications by Jim Guyton */ #include #include #include #include #include #include #include "common/tftpsubs.h" #include "recvfrom.h" #include "remap.h" #ifdef HAVE_SYS_FILIO_H #include /* Necessary for FIONBIO on Solaris */ #endif #ifdef HAVE_TCPWRAPPERS #include int deny_severity = LOG_WARNING; int allow_severity = -1; /* Don't log at all */ static struct request_info wrap_request; #endif #ifdef HAVE_IPV6 static int ai_fam = AF_UNSPEC; #else static int ai_fam = AF_INET; #endif #define TIMEOUT 1000000 /* Default timeout (us) */ #define TRIES 6 /* Number of attempts to send each packet */ #define TIMEOUT_LIMIT ((1 << TRIES)-1) const char *__progname; static int peer; static unsigned long timeout = TIMEOUT; /* Current timeout value */ static unsigned long rexmtval = TIMEOUT; /* Basic timeout value */ static unsigned long maxtimeout = TIMEOUT_LIMIT * TIMEOUT; static int timeout_quit = 0; static sigjmp_buf timeoutbuf; static uint16_t rollover_val = 0; #define PKTSIZE MAX_SEGSIZE+4 static char buf[PKTSIZE]; static char ackbuf[PKTSIZE]; static unsigned int max_blksize = MAX_SEGSIZE; static char tmpbuf[INET6_ADDRSTRLEN], *tmp_p; static union sock_addr from; static socklen_t fromlen; static off_t tsize; static int tsize_ok; static int ndirs; static const char **dirs; static int secure = 0; int cancreate = 0; int unixperms = 0; int portrange = 0; unsigned int portrange_from, portrange_to; int verbosity = 0; struct formats; #ifdef WITH_REGEX static struct rule *rewrite_rules = NULL; #endif int tftp(struct tftphdr *, int); static void nak(int, const char *); static void timer(int); static void do_opt(const char *, const char *, char **); static int set_blksize(uintmax_t *); static int set_blksize2(uintmax_t *); static int set_tsize(uintmax_t *); static int set_timeout(uintmax_t *); static int set_utimeout(uintmax_t *); static int set_rollover(uintmax_t *); struct options { const char *o_opt; int (*o_fnc)(uintmax_t *); } options[] = { {"blksize", set_blksize}, {"blksize2", set_blksize2}, {"tsize", set_tsize}, {"timeout", set_timeout}, {"utimeout", set_utimeout}, {"rollover", set_rollover}, {NULL, NULL} }; /* Simple handler for SIGHUP */ static volatile sig_atomic_t caught_sighup = 0; static void handle_sighup(int sig) { (void)sig; /* Suppress unused warning */ caught_sighup = 1; } /* Handle exit requests by SIGTERM and SIGINT */ static volatile sig_atomic_t exit_signal = 0; static void handle_exit(int sig) { exit_signal = sig; } /* Handle timeout signal or timeout event */ void timer(int sig) { (void)sig; /* Suppress unused warning */ timeout <<= 1; if (timeout >= maxtimeout || timeout_quit) exit(0); siglongjmp(timeoutbuf, 1); } #ifdef WITH_REGEX static struct rule *read_remap_rules(const char *file) { FILE *f; struct rule *rulep; f = fopen(file, "rt"); if (!f) { syslog(LOG_ERR, "Cannot open map file: %s: %m", file); exit(EX_NOINPUT); } rulep = parserulefile(f); fclose(f); return rulep; } #endif /* * Rules for locking files; return 0 on success, -1 on failure */ static int lock_file(int fd, int lock_write) { #if defined(HAVE_FCNTL) && defined(HAVE_F_SETLK_DEFINITION) struct flock fl; fl.l_type = lock_write ? F_WRLCK : F_RDLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; /* Whole file */ return fcntl(fd, F_SETLK, &fl); #elif defined(HAVE_LOCK_SH_DEFINITION) return flock(fd, lock_write ? LOCK_EX|LOCK_NB : LOCK_SH|LOCK_NB); #else return 0; /* Hope & pray... */ #endif } static void set_socket_nonblock(int fd, int flag) { int err; int flags; #if defined(HAVE_FCNTL) && defined(HAVE_O_NONBLOCK_DEFINITION) /* Posixly correct */ err = ((flags = fcntl(fd, F_GETFL, 0)) < 0) || (fcntl (fd, F_SETFL, flag ? flags | O_NONBLOCK : flags & ~O_NONBLOCK) < 0); #else flags = flag ? 1 : 0; err = (ioctl(fd, FIONBIO, &flags) < 0); #endif if (err) { syslog(LOG_ERR, "Cannot set nonblock flag on socket: %m"); exit(EX_OSERR); } } static void pmtu_discovery_off(int fd) { #if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT) int pmtu = IP_PMTUDISC_DONT; setsockopt(fd, IPPROTO_IP, IP_MTU_DISCOVER, &pmtu, sizeof(pmtu)); #endif } /* * Receive packet with synchronous timeout; timeout is adjusted * to account for time spent waiting. */ static int recv_time(int s, void *rbuf, int len, unsigned int flags, unsigned long *timeout_us_p) { fd_set fdset; struct timeval tmv, t0, t1; int rv, err; unsigned long timeout_us = *timeout_us_p; unsigned long timeout_left, dt; gettimeofday(&t0, NULL); timeout_left = timeout_us; for (;;) { FD_ZERO(&fdset); FD_SET(s, &fdset); do { tmv.tv_sec = timeout_left / 1000000; tmv.tv_usec = timeout_left % 1000000; rv = select(s + 1, &fdset, NULL, NULL, &tmv); err = errno; gettimeofday(&t1, NULL); dt = (t1.tv_sec - t0.tv_sec) * 1000000 + (t1.tv_usec - t0.tv_usec); *timeout_us_p = timeout_left = (dt >= timeout_us) ? 1 : (timeout_us - dt); } while (rv == -1 && err == EINTR); if (rv == 0) { timer(0); /* Should not return */ return -1; } set_socket_nonblock(s, 1); rv = recv(s, rbuf, len, flags); err = errno; set_socket_nonblock(s, 0); if (rv < 0) { if (E_WOULD_BLOCK(err) || err == EINTR) { continue; /* Once again, with feeling... */ } else { errno = err; return rv; } } else { return rv; } } } static int split_port(char **ap, char **pp) { char *a, *p; int ret = AF_UNSPEC; a = *ap; #ifdef HAVE_IPV6 if (is_numeric_ipv6(a)) { if (*a++ != '[') return -1; *ap = a; p = strrchr(a, ']'); if (!p) return -1; *p++ = 0; a = p; ret = AF_INET6; p = strrchr(a, ':'); if (p) *p++ = 0; } else #endif { struct in_addr in; p = strrchr(a, ':'); if (p) *p++ = 0; if (inet_aton(a, &in)) ret = AF_INET; } *pp = p; return ret; } enum long_only_options { OPT_VERBOSITY = 256, }; static struct option long_options[] = { { "ipv4", 0, NULL, '4' }, { "ipv6", 0, NULL, '6' }, { "create", 0, NULL, 'c' }, { "secure", 0, NULL, 's' }, { "permissive", 0, NULL, 'p' }, { "verbose", 0, NULL, 'v' }, { "verbosity", 1, NULL, OPT_VERBOSITY }, { "version", 0, NULL, 'V' }, { "listen", 0, NULL, 'l' }, { "foreground", 0, NULL, 'L' }, { "address", 1, NULL, 'a' }, { "blocksize", 1, NULL, 'B' }, { "user", 1, NULL, 'u' }, { "umask", 1, NULL, 'U' }, { "refuse", 1, NULL, 'r' }, { "timeout", 1, NULL, 't' }, { "retransmit", 1, NULL, 'T' }, { "port-range", 1, NULL, 'R' }, { "map-file", 1, NULL, 'm' }, { "pidfile", 1, NULL, 'P' }, { NULL, 0, NULL, 0 } }; static const char short_options[] = "46cspvVlLa:B:u:U:r:t:T:R:m:P:"; int main(int argc, char **argv) { struct tftphdr *tp; struct passwd *pw; struct options *opt; union sock_addr myaddr; struct sockaddr_in bindaddr4; #ifdef HAVE_IPV6 struct sockaddr_in6 bindaddr6; int force_ipv6 = 0; #endif int n; int fd = -1; int fd4 = -1; int fd6 = -1; int fdmax = 0; int standalone = 0; /* Standalone (listen) mode */ int nodaemon = 0; /* Do not detach process */ char *address = NULL; /* Address to listen to */ pid_t pid; mode_t my_umask = 0; int spec_umask = 0; int c; int setrv; int waittime = 900; /* Default time to wait for a connect */ const char *user = "nobody"; /* Default user */ char *p, *ep; #ifdef WITH_REGEX char *rewrite_file = NULL; #endif const char *pidfile = NULL; u_short tp_opcode; /* basename() is way too much of a pain from a portability standpoint */ p = strrchr(argv[0], '/'); __progname = (p && p[1]) ? p + 1 : argv[0]; openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON); srand(time(NULL) ^ getpid()); while ((c = getopt_long(argc, argv, short_options, long_options, NULL)) != -1) switch (c) { case '4': ai_fam = AF_INET; break; #ifdef HAVE_IPV6 case '6': ai_fam = AF_INET6; force_ipv6 = 1; break; #endif case 'c': cancreate = 1; break; case 's': secure = 1; break; case 'p': unixperms = 1; break; case 'l': standalone = 1; break; case 'L': standalone = 1; nodaemon = 1; break; case 'a': address = optarg; break; case 't': waittime = atoi(optarg); break; case 'B': { char *vp; max_blksize = (unsigned int)strtoul(optarg, &vp, 10); if (max_blksize < 512 || max_blksize > MAX_SEGSIZE || *vp) { syslog(LOG_ERR, "Bad maximum blocksize value (range 512-%d): %s", MAX_SEGSIZE, optarg); exit(EX_USAGE); } } break; case 'T': { char *vp; unsigned long tov = strtoul(optarg, &vp, 10); if (tov < 10000UL || tov > 255000000UL || *vp) { syslog(LOG_ERR, "Bad timeout value: %s", optarg); exit(EX_USAGE); } rexmtval = timeout = tov; maxtimeout = rexmtval * TIMEOUT_LIMIT; } break; case 'R': { if (sscanf(optarg, "%u:%u", &portrange_from, &portrange_to) != 2 || portrange_from > portrange_to || portrange_to >= 65535) { syslog(LOG_ERR, "Bad port range: %s", optarg); exit(EX_USAGE); } portrange = 1; } break; case 'u': user = optarg; break; case 'U': my_umask = strtoul(optarg, &ep, 8); if (*ep) { syslog(LOG_ERR, "Invalid umask: %s", optarg); exit(EX_USAGE); } spec_umask = 1; break; case 'r': for (opt = options; opt->o_opt; opt++) { if (!strcasecmp(optarg, opt->o_opt)) { opt->o_opt = ""; /* Don't support this option */ break; } } if (!opt->o_opt) { syslog(LOG_ERR, "Unknown option: %s", optarg); exit(EX_USAGE); } break; #ifdef WITH_REGEX case 'm': if (rewrite_file) { syslog(LOG_ERR, "Multiple -m options"); exit(EX_USAGE); } rewrite_file = optarg; break; #endif case 'v': verbosity++; break; case OPT_VERBOSITY: verbosity = atoi(optarg); break; case 'V': /* Print configuration to stdout and exit */ printf("%s\n", TFTPD_CONFIG_STR); exit(0); break; case 'P': pidfile = optarg; break; default: syslog(LOG_ERR, "Unknown option: '%c'", optopt); break; } dirs = xmalloc((argc - optind + 1) * sizeof(char *)); for (ndirs = 0; optind != argc; optind++) dirs[ndirs++] = argv[optind]; dirs[ndirs] = NULL; if (secure) { if (ndirs == 0) { syslog(LOG_ERR, "no -s directory"); exit(EX_USAGE); } if (ndirs > 1) { syslog(LOG_ERR, "too many -s directories"); exit(EX_USAGE); } if (chdir(dirs[0])) { syslog(LOG_ERR, "%s: %m", dirs[0]); exit(EX_NOINPUT); } } pw = getpwnam(user); if (!pw) { syslog(LOG_ERR, "no user %s: %m", user); exit(EX_NOUSER); } #ifdef WITH_REGEX if (rewrite_file) rewrite_rules = read_remap_rules(rewrite_file); #endif if (pidfile && !standalone) { syslog(LOG_WARNING, "not in standalone mode, ignoring pid file"); pidfile = NULL; } /* If we're running standalone, set up the input port */ if (standalone) { FILE *pf; #ifdef HAVE_IPV6 if (ai_fam != AF_INET6) { #endif fd4 = socket(AF_INET, SOCK_DGRAM, 0); if (fd4 < 0) { syslog(LOG_ERR, "cannot open IPv4 socket: %m"); exit(EX_OSERR); } #ifndef __CYGWIN__ set_socket_nonblock(fd4, 1); #endif memset(&bindaddr4, 0, sizeof bindaddr4); bindaddr4.sin_family = AF_INET; bindaddr4.sin_addr.s_addr = INADDR_ANY; bindaddr4.sin_port = htons(IPPORT_TFTP); #ifdef HAVE_IPV6 } if (ai_fam != AF_INET) { fd6 = socket(AF_INET6, SOCK_DGRAM, 0); if (fd6 < 0) { if (fd4 < 0) { syslog(LOG_ERR, "cannot open IPv6 socket: %m"); exit(EX_OSERR); } else { syslog(LOG_ERR, "cannot open IPv6 socket, disable IPv6: %m"); } } #ifndef __CYGWIN__ set_socket_nonblock(fd6, 1); #endif memset(&bindaddr6, 0, sizeof bindaddr6); bindaddr6.sin6_family = AF_INET6; bindaddr6.sin6_port = htons(IPPORT_TFTP); } #endif if (address) { char *portptr = NULL, *eportptr; int err; struct servent *servent; unsigned long port; address = tfstrdup(address); err = split_port(&address, &portptr); switch (err) { case AF_INET: #ifdef HAVE_IPV6 if (fd6 >= 0) { close(fd6); fd6 = -1; if (ai_fam == AF_INET6) { syslog(LOG_ERR, "Address %s is not in address family AF_INET6", address); exit(EX_USAGE); } ai_fam = AF_INET; } break; case AF_INET6: if (fd4 >= 0) { close(fd4); fd4 = -1; if (ai_fam == AF_INET) { syslog(LOG_ERR, "Address %s is not in address family AF_INET", address); exit(EX_USAGE); } ai_fam = AF_INET6; } break; #endif case AF_UNSPEC: break; default: syslog(LOG_ERR, "Numeric IPv6 addresses need to be enclosed in []"); exit(EX_USAGE); } if (!portptr) portptr = (char *)"tftp"; if (*address) { if (fd4 >= 0) { bindaddr4.sin_family = AF_INET; err = set_sock_addr(address, (union sock_addr *)&bindaddr4, NULL); if (err) { syslog(LOG_ERR, "cannot resolve local IPv4 bind address: %s, %s", address, gai_strerror(err)); exit(EX_NOINPUT); } } #ifdef HAVE_IPV6 if (fd6 >= 0) { bindaddr6.sin6_family = AF_INET6; err = set_sock_addr(address, (union sock_addr *)&bindaddr6, NULL); if (err) { if (fd4 >= 0) { syslog(LOG_ERR, "cannot resolve local IPv6 bind address: %s" "(%s); using IPv4 only", address, gai_strerror(err)); close(fd6); fd6 = -1; } else { syslog(LOG_ERR, "cannot resolve local IPv6 bind address: %s" "(%s)", address, gai_strerror(err)); exit(EX_NOINPUT); } } } #endif } else { /* Default to using INADDR_ANY */ } if (portptr && *portptr) { servent = getservbyname(portptr, "udp"); if (servent) { if (fd4 >= 0) bindaddr4.sin_port = servent->s_port; #ifdef HAVE_IPV6 if (fd6 >= 0) bindaddr6.sin6_port = servent->s_port; #endif } else if ((port = strtoul(portptr, &eportptr, 0)) && !*eportptr) { if (fd4 >= 0) bindaddr4.sin_port = htons(port); #ifdef HAVE_IPV6 if (fd6 >= 0) bindaddr6.sin6_port = htons(port); #endif } else if (!strcmp(portptr, "tftp")) { /* It's TFTP, we're OK */ } else { syslog(LOG_ERR, "cannot resolve local bind port: %s", portptr); exit(EX_NOINPUT); } } } if (fd4 >= 0) { if (bind(fd4, (struct sockaddr *)&bindaddr4, sizeof(bindaddr4)) < 0) { syslog(LOG_ERR, "cannot bind to local IPv4 socket: %m"); exit(EX_OSERR); } } #ifdef HAVE_IPV6 if (fd6 >= 0) { #if defined(IPV6_V6ONLY) int on = 1; if (fd4 >= 0 || force_ipv6) if (setsockopt(fd6, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&on, sizeof(on))) syslog(LOG_ERR, "cannot setsockopt IPV6_V6ONLY %m"); #endif if (bind(fd6, (struct sockaddr *)&bindaddr6, sizeof(bindaddr6)) < 0) { if (fd4 >= 0) { syslog(LOG_ERR, "cannot bind to local IPv6 socket," "IPv6 disabled: %m"); close(fd6); fd6 = -1; } else { syslog(LOG_ERR, "cannot bind to local IPv6 socket: %m"); exit(EX_OSERR); } } } #endif /* Daemonize this process */ /* Note: when running in secure mode (-s), we must not chdir, since we are already in the proper directory. */ if (!nodaemon && daemon(secure, 0) < 0) { syslog(LOG_ERR, "cannot daemonize: %m"); exit(EX_OSERR); } set_signal(SIGTERM, handle_exit, 0); set_signal(SIGINT, handle_exit, 0); if (pidfile) { pf = fopen (pidfile, "w"); if (!pf) { syslog(LOG_ERR, "cannot open pid file '%s' for writing: %m", pidfile); pidfile = NULL; } else { if (fprintf(pf, "%d\n", getpid()) < 0) syslog(LOG_ERR, "error writing pid file '%s': %m", pidfile); if (fclose(pf)) syslog(LOG_ERR, "error closing pid file '%s': %m", pidfile); } } if (fd6 > fd4) fdmax = fd6; else fdmax = fd4; } else { /* 0 is our socket descriptor */ close(1); close(2); fd = 0; fdmax = 0; /* Note: on Cygwin, select() on a nonblocking socket becomes a nonblocking select. */ #ifndef __CYGWIN__ set_socket_nonblock(fd, 1); #endif } /* Disable path MTU discovery */ pmtu_discovery_off(fd); /* This means we don't want to wait() for children */ #ifdef SA_NOCLDWAIT set_signal(SIGCHLD, SIG_IGN, SA_NOCLDSTOP | SA_NOCLDWAIT); #else set_signal(SIGCHLD, SIG_IGN, SA_NOCLDSTOP); #endif /* Take SIGHUP and use it to set a variable. This is polled synchronously to make sure we don't lose packets as a result. */ set_signal(SIGHUP, handle_sighup, 0); if (spec_umask || !unixperms) umask(my_umask); while (1) { fd_set readset; struct timeval tv_waittime; int rv; if (exit_signal) { /* happens in standalone mode only */ if (pidfile && unlink(pidfile)) { syslog(LOG_WARNING, "error removing pid file '%s': %m", pidfile); exit(EX_OSERR); } else { exit(0); } } if (caught_sighup) { caught_sighup = 0; if (standalone) { #ifdef WITH_REGEX if (rewrite_file) { freerules(rewrite_rules); rewrite_rules = read_remap_rules(rewrite_file); } #endif } else { /* Return to inetd for respawn */ exit(0); } } FD_ZERO(&readset); if (standalone) { if (fd4 >= 0) { FD_SET(fd4, &readset); #ifdef __CYGWIN__ /* On Cygwin, select() on a nonblocking socket returns immediately, with a rv of 0! */ set_socket_nonblock(fd4, 0); #endif } if (fd6 >= 0) { FD_SET(fd6, &readset); #ifdef __CYGWIN__ /* On Cygwin, select() on a nonblocking socket returns immediately, with a rv of 0! */ set_socket_nonblock(fd6, 0); #endif } } else { /* fd always 0 */ fd = 0; #ifdef __CYGWIN__ /* On Cygwin, select() on a nonblocking socket returns immediately, with a rv of 0! */ set_socket_nonblock(fd, 0); #endif FD_SET(fd, &readset); } tv_waittime.tv_sec = waittime; tv_waittime.tv_usec = 0; /* Never time out if we're in standalone mode */ rv = select(fdmax + 1, &readset, NULL, NULL, standalone ? NULL : &tv_waittime); if (rv == -1 && errno == EINTR) continue; /* Signal caught, reloop */ if (rv == -1) { syslog(LOG_ERR, "select loop: %m"); exit(EX_IOERR); } else if (rv == 0) { exit(0); /* Timeout, return to inetd */ } if (standalone) { if ((fd4 >= 0) && FD_ISSET(fd4, &readset)) fd = fd4; else if ((fd6 >= 0) && FD_ISSET(fd6, &readset)) fd = fd6; else /* not in set ??? */ continue; } #ifdef __CYGWIN__ /* On Cygwin, select() on a nonblocking socket returns immediately, with a rv of 0! */ set_socket_nonblock(fd, 0); #endif fromlen = sizeof(from); n = myrecvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr *)&from, &fromlen, &myaddr); if (n < 0) { if (E_WOULD_BLOCK(errno) || errno == EINTR) { continue; /* Again, from the top */ } else { syslog(LOG_ERR, "recvfrom: %m"); exit(EX_IOERR); } } #ifdef HAVE_IPV6 if ((from.sa.sa_family != AF_INET) && (from.sa.sa_family != AF_INET6)) { syslog(LOG_ERR, "received address was not AF_INET/AF_INET6," " please check your inetd config"); #else if (from.sa.sa_family != AF_INET) { syslog(LOG_ERR, "received address was not AF_INET," " please check your inetd config"); #endif exit(EX_PROTOCOL); } if (standalone) { if ((from.sa.sa_family == AF_INET) && (myaddr.si.sin_addr.s_addr == INADDR_ANY)) { /* myrecvfrom() didn't capture the source address; but we might have bound to a specific address, if so we should use it */ memcpy(SOCKADDR_P(&myaddr), &bindaddr4.sin_addr, sizeof(bindaddr4.sin_addr)); #ifdef HAVE_IPV6 } else if ((from.sa.sa_family == AF_INET6) && IN6_IS_ADDR_UNSPECIFIED((struct in6_addr *) SOCKADDR_P(&myaddr))) { memcpy(SOCKADDR_P(&myaddr), &bindaddr6.sin6_addr, sizeof(bindaddr6.sin6_addr)); #endif } } /* * Now that we have read the request packet from the UDP * socket, we fork and go back to listening to the socket. */ pid = fork(); if (pid < 0) { syslog(LOG_ERR, "fork: %m"); exit(EX_OSERR); /* Return to inetd, just in case */ } else if (pid == 0) break; /* Child exit, parent loop */ } /* Child process: handle the actual request here */ /* Ignore SIGHUP */ set_signal(SIGHUP, SIG_IGN, 0); /* Make sure the log socket is still connected. This has to be done before the chroot, while /dev/log is still accessible. When not running standalone, there is little chance that the syslog daemon gets restarted by the time we get here. */ if (secure && standalone) { closelog(); openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON); } #ifdef HAVE_TCPWRAPPERS /* Verify if this was a legal request for us. This has to be done before the chroot, while /etc is still accessible. */ request_init(&wrap_request, RQ_DAEMON, __progname, RQ_FILE, fd, RQ_CLIENT_SIN, &from, RQ_SERVER_SIN, &myaddr, 0); sock_methods(&wrap_request); tmp_p = (char *)inet_ntop(myaddr.sa.sa_family, SOCKADDR_P(&myaddr), tmpbuf, INET6_ADDRSTRLEN); if (!tmp_p) { tmp_p = tmpbuf; strcpy(tmpbuf, "???"); } if (hosts_access(&wrap_request) == 0) { if (deny_severity != -1) syslog(deny_severity, "connection refused from %s", tmp_p); exit(EX_NOPERM); /* Access denied */ } else if (allow_severity != -1) { syslog(allow_severity, "connect from %s", tmp_p); } #endif /* Close file descriptors we don't need */ close(fd); /* Get a socket. This has to be done before the chroot(), since some systems require access to /dev to create a socket. */ peer = socket(myaddr.sa.sa_family, SOCK_DGRAM, 0); if (peer < 0) { syslog(LOG_ERR, "socket: %m"); exit(EX_IOERR); } /* Set up the supplementary group access list if possible */ /* /etc/group still need to be accessible at this point */ #ifdef HAVE_INITGROUPS setrv = initgroups(user, pw->pw_gid); if (setrv) { syslog(LOG_ERR, "cannot set groups for user %s", user); exit(EX_OSERR); } #else #ifdef HAVE_SETGROUPS if (setgroups(0, NULL)) { syslog(LOG_ERR, "cannot clear group list"); } #endif #endif /* Chroot and drop privileges */ if (secure) { if (chroot(".")) { syslog(LOG_ERR, "chroot: %m"); exit(EX_OSERR); } #ifdef __CYGWIN__ chdir("/"); /* Cygwin chroot() bug workaround */ #endif } #ifdef HAVE_SETREGID setrv = setregid(pw->pw_gid, pw->pw_gid); #else setrv = setegid(pw->pw_gid) || setgid(pw->pw_gid); #endif #ifdef HAVE_SETREUID setrv = setrv || setreuid(pw->pw_uid, pw->pw_uid); #else /* Important: setuid() must come first */ setrv = setrv || setuid(pw->pw_uid) || (geteuid() != pw->pw_uid && seteuid(pw->pw_uid)); #endif if (setrv) { syslog(LOG_ERR, "cannot drop privileges: %m"); exit(EX_OSERR); } /* Process the request... */ if (pick_port_bind(peer, &myaddr, portrange_from, portrange_to) < 0) { syslog(LOG_ERR, "bind: %m"); exit(EX_IOERR); } if (connect(peer, &from.sa, SOCKLEN(&from)) < 0) { syslog(LOG_ERR, "connect: %m"); exit(EX_IOERR); } /* Disable path MTU discovery */ pmtu_discovery_off(peer); tp = (struct tftphdr *)buf; tp_opcode = ntohs(tp->th_opcode); if (tp_opcode == RRQ || tp_opcode == WRQ) tftp(tp, n); exit(0); } static char *rewrite_access(char *, int, const char **); static int validate_access(char *, int, const struct formats *, const char **); static void tftp_sendfile(const struct formats *, struct tftphdr *, int); static void tftp_recvfile(const struct formats *, struct tftphdr *, int); struct formats { const char *f_mode; char *(*f_rewrite) (char *, int, const char **); int (*f_validate) (char *, int, const struct formats *, const char **); void (*f_send) (const struct formats *, struct tftphdr *, int); void (*f_recv) (const struct formats *, struct tftphdr *, int); int f_convert; }; static const struct formats formats[] = { { "netascii", rewrite_access, validate_access, tftp_sendfile, tftp_recvfile, 1}, { "octet", rewrite_access, validate_access, tftp_sendfile, tftp_recvfile, 0}, { NULL, NULL, NULL, NULL, NULL, 0} }; /* * Handle initial connection protocol. */ int tftp(struct tftphdr *tp, int size) { char *cp, *end; int argn, ecode; const struct formats *pf = NULL; char *origfilename; char *filename, *mode = NULL; const char *errmsgptr; u_short tp_opcode = ntohs(tp->th_opcode); char *val = NULL, *opt = NULL; char *ap = ackbuf + 2; ((struct tftphdr *)ackbuf)->th_opcode = htons(OACK); origfilename = cp = (char *)&(tp->th_stuff); argn = 0; end = (char *)tp + size; while (cp < end && *cp) { do { cp++; } while (cp < end && *cp); if (*cp) { nak(EBADOP, "Request not null-terminated"); exit(0); } argn++; if (argn == 1) { mode = ++cp; } else if (argn == 2) { for (cp = mode; *cp; cp++) *cp = tolower(*cp); for (pf = formats; pf->f_mode; pf++) { if (!strcmp(pf->f_mode, mode)) break; } if (!pf->f_mode) { nak(EBADOP, "Unknown mode"); exit(0); } if (!(filename = (*pf->f_rewrite) (origfilename, tp_opcode, &errmsgptr))) { nak(EACCESS, errmsgptr); /* File denied by mapping rule */ exit(0); } if (verbosity >= 1) { tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from), tmpbuf, INET6_ADDRSTRLEN); if (!tmp_p) { tmp_p = tmpbuf; strcpy(tmpbuf, "???"); } if (filename == origfilename || !strcmp(filename, origfilename)) syslog(LOG_NOTICE, "%s from %s filename %s\n", tp_opcode == WRQ ? "WRQ" : "RRQ", tmp_p, filename); else syslog(LOG_NOTICE, "%s from %s filename %s remapped to %s\n", tp_opcode == WRQ ? "WRQ" : "RRQ", tmp_p, origfilename, filename); } ecode = (*pf->f_validate) (filename, tp_opcode, pf, &errmsgptr); if (ecode) { nak(ecode, errmsgptr); exit(0); } opt = ++cp; } else if (argn & 1) { val = ++cp; } else { do_opt(opt, val, &ap); opt = ++cp; } } if (!pf) { nak(EBADOP, "Missing mode"); exit(0); } if (ap != (ackbuf + 2)) { if (tp_opcode == WRQ) (*pf->f_recv) (pf, (struct tftphdr *)ackbuf, ap - ackbuf); else (*pf->f_send) (pf, (struct tftphdr *)ackbuf, ap - ackbuf); } else { if (tp_opcode == WRQ) (*pf->f_recv) (pf, NULL, 0); else (*pf->f_send) (pf, NULL, 0); } exit(0); /* Request completed */ } static int blksize_set; /* * Set a non-standard block size (c.f. RFC2348) */ static int set_blksize(uintmax_t *vp) { uintmax_t sz = *vp; if (blksize_set) return 0; if (sz < 8) return 0; else if (sz > max_blksize) sz = max_blksize; *vp = segsize = sz; blksize_set = 1; return 1; } /* * Set a power-of-two block size (nonstandard) */ static int set_blksize2(uintmax_t *vp) { uintmax_t sz = *vp; if (blksize_set) return 0; if (sz < 8) return (0); else if (sz > max_blksize) sz = max_blksize; else /* Convert to a power of two */ if (sz & (sz - 1)) { unsigned int sz1 = 1; /* Not a power of two - need to convert */ while (sz >>= 1) sz1 <<= 1; sz = sz1; } *vp = segsize = sz; blksize_set = 1; return 1; } /* * Set the block number rollover value */ static int set_rollover(uintmax_t *vp) { uintmax_t ro = *vp; if (ro > 65535) return 0; rollover_val = (uint16_t)ro; return 1; } /* * Return a file size (c.f. RFC2349) * For netascii mode, we don't know the size ahead of time; * so reject the option. */ static int set_tsize(uintmax_t *vp) { uintmax_t sz = *vp; if (!tsize_ok) return 0; if (sz == 0) sz = tsize; *vp = sz; return 1; } /* * Set the timeout (c.f. RFC2349). This is supposed * to be the (default) retransmission timeout, but being an * integer in seconds it seems a bit limited. */ static int set_timeout(uintmax_t *vp) { uintmax_t to = *vp; if (to < 1 || to > 255) return 0; rexmtval = timeout = to * 1000000UL; maxtimeout = rexmtval * TIMEOUT_LIMIT; return 1; } /* Similar, but in microseconds. We allow down to 10 ms. */ static int set_utimeout(uintmax_t *vp) { uintmax_t to = *vp; if (to < 10000UL || to > 255000000UL) return 0; rexmtval = timeout = to; maxtimeout = rexmtval * TIMEOUT_LIMIT; return 1; } /* * Conservative calculation for the size of a buffer which can hold an * arbitrary integer */ #define OPTBUFSIZE (sizeof(uintmax_t) * CHAR_BIT / 3 + 3) /* * Parse RFC2347 style options; we limit the arguments to positive * integers which matches all our current options. */ static void do_opt(const char *opt, const char *val, char **ap) { struct options *po; char retbuf[OPTBUFSIZE]; char *p = *ap; size_t optlen, retlen; char *vend; uintmax_t v; /* Global option-parsing variables initialization */ blksize_set = 0; if (!*opt || !*val) return; errno = 0; v = strtoumax(val, &vend, 10); if (*vend || errno == ERANGE) return; for (po = options; po->o_opt; po++) if (!strcasecmp(po->o_opt, opt)) { if (po->o_fnc(&v)) { optlen = strlen(opt); retlen = sprintf(retbuf, "%"PRIuMAX, v); if (p + optlen + retlen + 2 >= ackbuf + sizeof(ackbuf)) { nak(EOPTNEG, "Insufficient space for options"); exit(0); } memcpy(p, opt, optlen+1); p += optlen+1; memcpy(p, retbuf, retlen+1); p += retlen+1; } else { nak(EOPTNEG, "Unsupported option(s) requested"); exit(0); } break; } *ap = p; } #ifdef WITH_REGEX /* * This is called by the remap engine when it encounters macros such * as \i. It should write the output in "output" if non-NULL, and * return the length of the output (generated or not). * * Return -1 on failure. */ static int rewrite_macros(char macro, char *output) { char *p, tb[INET6_ADDRSTRLEN]; int l=0; switch (macro) { case 'i': p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from), tb, INET6_ADDRSTRLEN); if (output && p) strcpy(output, p); if (!p) return 0; else return strlen(p); case 'x': if (output) { if (from.sa.sa_family == AF_INET) { sprintf(output, "%08lX", (unsigned long)ntohl(from.si.sin_addr.s_addr)); l = 8; #ifdef HAVE_IPV6 } else { unsigned char *c = (unsigned char *)SOCKADDR_P(&from); p = tb; for (l = 0; l < 16; l++) { sprintf(p, "%02X", *c); c++; p += 2; } strcpy(output, tb); l = strlen(tb); #endif } } return l; default: return -1; } } /* * Modify the filename, if applicable. If it returns NULL, deny the access. */ static char *rewrite_access(char *filename, int mode, const char **msg) { if (rewrite_rules) { char *newname = rewrite_string(filename, rewrite_rules, mode != RRQ ? 'P' : 'G', rewrite_macros, msg); filename = newname; } return filename; } #else static char *rewrite_access(char *filename, int mode, const char **msg) { (void)mode; /* Avoid warning */ (void)msg; return filename; } #endif static FILE *file; /* * Validate file access. Since we * have no uid or gid, for now require * file to exist and be publicly * readable/writable, unless -p specified. * If we were invoked with arguments * from inetd then the file must also be * in one of the given directory prefixes. * Note also, full path name must be * given as we have no login directory. */ static int validate_access(char *filename, int mode, const struct formats *pf, const char **errmsg) { struct stat stbuf; int i, len; int fd, wmode, rmode; char *cp; const char **dirp; char stdio_mode[3]; tsize_ok = 0; *errmsg = NULL; if (!secure) { if (*filename != '/') { *errmsg = "Only absolute filenames allowed"; return (EACCESS); } /* * prevent tricksters from getting around the directory * restrictions */ len = strlen(filename); for (i = 1; i < len - 3; i++) { cp = filename + i; if (*cp == '.' && memcmp(cp - 1, "/../", 4) == 0) { *errmsg = "Reverse path not allowed"; return (EACCESS); } } for (dirp = dirs; *dirp; dirp++) if (strncmp(filename, *dirp, strlen(*dirp)) == 0) break; if (*dirp == 0 && dirp != dirs) { *errmsg = "Forbidden directory"; return (EACCESS); } } /* * We use different a different permissions scheme if `cancreate' is * set. */ wmode = O_WRONLY | (cancreate ? O_CREAT : 0) | (pf->f_convert ? O_TEXT : O_BINARY); rmode = O_RDONLY | (pf->f_convert ? O_TEXT : O_BINARY); #ifndef HAVE_FTRUNCATE wmode |= O_TRUNC; /* This really sucks on a dupe */ #endif fd = open(filename, mode == RRQ ? rmode : wmode, 0666); if (fd < 0) { switch (errno) { case ENOENT: case ENOTDIR: return ENOTFOUND; case ENOSPC: return ENOSPACE; case EEXIST: return EEXISTS; default: return errno + 100; } } if (fstat(fd, &stbuf) < 0) exit(EX_OSERR); /* This shouldn't happen */ /* A duplicate RRQ or (worse!) WRQ packet could really cause havoc... */ if (lock_file(fd, mode != RRQ)) exit(0); if (mode == RRQ) { if (!unixperms && (stbuf.st_mode & (S_IREAD >> 6)) == 0) { *errmsg = "File must have global read permissions"; return (EACCESS); } tsize = stbuf.st_size; /* We don't know the tsize if conversion is needed */ tsize_ok = !pf->f_convert; } else { if (!unixperms) { if ((stbuf.st_mode & (S_IWRITE >> 6)) == 0) { *errmsg = "File must have global write permissions"; return (EACCESS); } } #ifdef HAVE_FTRUNCATE /* We didn't get to truncate the file at open() time */ if (ftruncate(fd, (off_t) 0)) { *errmsg = "Cannot reset file size"; return (EACCESS); } #endif tsize = 0; tsize_ok = 1; } stdio_mode[0] = (mode == RRQ) ? 'r' : 'w'; stdio_mode[1] = (pf->f_convert) ? 't' : 'b'; stdio_mode[2] = '\0'; file = fdopen(fd, stdio_mode); if (file == NULL) exit(EX_OSERR); /* Internal error */ return (0); } /* * Send the requested file. */ static void tftp_sendfile(const struct formats *pf, struct tftphdr *oap, int oacklen) { struct tftphdr *dp; struct tftphdr *ap; /* ack packet */ static u_short block = 1; /* Static to avoid longjmp funnies */ u_short ap_opcode, ap_block; unsigned long r_timeout; int size, n; if (oap) { timeout = rexmtval; (void)sigsetjmp(timeoutbuf, 1); oack: r_timeout = timeout; if (send(peer, oap, oacklen, 0) != oacklen) { syslog(LOG_WARNING, "tftpd: oack: %m\n"); goto abort; } for (;;) { n = recv_time(peer, ackbuf, sizeof(ackbuf), 0, &r_timeout); if (n < 0) { syslog(LOG_WARNING, "tftpd: read: %m\n"); goto abort; } ap = (struct tftphdr *)ackbuf; ap_opcode = ntohs((u_short) ap->th_opcode); ap_block = ntohs((u_short) ap->th_block); if (ap_opcode == ERROR) { syslog(LOG_WARNING, "tftp: client does not accept options\n"); goto abort; } if (ap_opcode == ACK) { if (ap_block == 0) break; /* Resynchronize with the other side */ (void)synchnet(peer); goto oack; } } } dp = r_init(); do { size = readit(file, &dp, pf->f_convert); if (size < 0) { nak(errno + 100, NULL); goto abort; } dp->th_opcode = htons((u_short) DATA); dp->th_block = htons((u_short) block); timeout = rexmtval; (void)sigsetjmp(timeoutbuf, 1); r_timeout = timeout; if (send(peer, dp, size + 4, 0) != size + 4) { syslog(LOG_WARNING, "tftpd: write: %m"); goto abort; } read_ahead(file, pf->f_convert); for (;;) { n = recv_time(peer, ackbuf, sizeof(ackbuf), 0, &r_timeout); if (n < 0) { syslog(LOG_WARNING, "tftpd: read(ack): %m"); goto abort; } ap = (struct tftphdr *)ackbuf; ap_opcode = ntohs((u_short) ap->th_opcode); ap_block = ntohs((u_short) ap->th_block); if (ap_opcode == ERROR) goto abort; if (ap_opcode == ACK) { if (ap_block == block) { break; } /* Re-synchronize with the other side */ (void)synchnet(peer); /* * RFC1129/RFC1350: We MUST NOT re-send the DATA * packet in response to an invalid ACK. Doing so * would cause the Sorcerer's Apprentice bug. */ } } if (!++block) block = rollover_val; } while (size == segsize); abort: (void)fclose(file); } /* * Receive a file. */ static void tftp_recvfile(const struct formats *pf, struct tftphdr *oap, int oacklen) { struct tftphdr *dp; int n, size; /* These are "static" to avoid longjmp funnies */ static struct tftphdr *ap; /* ack buffer */ static u_short block = 0; static int acksize; u_short dp_opcode, dp_block; unsigned long r_timeout; dp = w_init(); do { timeout = rexmtval; if (!block && oap) { ap = (struct tftphdr *)ackbuf; acksize = oacklen; } else { ap = (struct tftphdr *)ackbuf; ap->th_opcode = htons((u_short) ACK); ap->th_block = htons((u_short) block); acksize = 4; /* If we're sending a regular ACK, that means we have successfully * sent the OACK. Clear oap so that we won't try to send another * OACK when the block number wraps back to 0. */ oap = NULL; } if (!++block) block = rollover_val; (void)sigsetjmp(timeoutbuf, 1); send_ack: r_timeout = timeout; if (send(peer, ackbuf, acksize, 0) != acksize) { syslog(LOG_WARNING, "tftpd: write(ack): %m"); goto abort; } write_behind(file, pf->f_convert); for (;;) { n = recv_time(peer, dp, PKTSIZE, 0, &r_timeout); if (n < 0) { /* really? */ syslog(LOG_WARNING, "tftpd: read: %m"); goto abort; } dp_opcode = ntohs((u_short) dp->th_opcode); dp_block = ntohs((u_short) dp->th_block); if (dp_opcode == ERROR) goto abort; if (dp_opcode == DATA) { if (dp_block == block) { break; /* normal */ } /* Re-synchronize with the other side */ (void)synchnet(peer); if (dp_block == (block - 1)) goto send_ack; /* rexmit */ } } /* size = write(file, dp->th_data, n - 4); */ size = writeit(file, &dp, n - 4, pf->f_convert); if (size != (n - 4)) { /* ahem */ if (size < 0) nak(errno + 100, NULL); else nak(ENOSPACE, NULL); goto abort; } } while (size == segsize); write_behind(file, pf->f_convert); (void)fclose(file); /* close data file */ ap->th_opcode = htons((u_short) ACK); /* send the "final" ack */ ap->th_block = htons((u_short) (block)); (void)send(peer, ackbuf, 4, 0); timeout_quit = 1; /* just quit on timeout */ n = recv_time(peer, buf, sizeof(buf), 0, &timeout); /* normally times out and quits */ timeout_quit = 0; if (n >= 4 && /* if read some data */ dp_opcode == DATA && /* and got a data block */ block == dp_block) { /* then my last ack was lost */ (void)send(peer, ackbuf, 4, 0); /* resend final ack */ } abort: return; } static const char *const errmsgs[] = { "Undefined error code", /* 0 - EUNDEF */ "File not found", /* 1 - ENOTFOUND */ "Access denied", /* 2 - EACCESS */ "Disk full or allocation exceeded", /* 3 - ENOSPACE */ "Illegal TFTP operation", /* 4 - EBADOP */ "Unknown transfer ID", /* 5 - EBADID */ "File already exists", /* 6 - EEXISTS */ "No such user", /* 7 - ENOUSER */ "Failure to negotiate RFC2347 options" /* 8 - EOPTNEG */ }; #define ERR_CNT (sizeof(errmsgs)/sizeof(const char *)) /* * Send a nak packet (error message). * Error code passed in is one of the * standard TFTP codes, or a UNIX errno * offset by 100. */ static void nak(int error, const char *msg) { struct tftphdr *tp; int length; tp = (struct tftphdr *)buf; tp->th_opcode = htons((u_short) ERROR); if (error >= 100) { /* This is a Unix errno+100 */ if (!msg) msg = strerror(error - 100); error = EUNDEF; } else { if ((unsigned)error >= ERR_CNT) error = EUNDEF; if (!msg) msg = errmsgs[error]; } tp->th_code = htons((u_short) error); length = strlen(msg) + 1; memcpy(tp->th_msg, msg, length); length += 4; /* Add space for header */ if (verbosity >= 2) { tmp_p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from), tmpbuf, INET6_ADDRSTRLEN); if (!tmp_p) { tmp_p = tmpbuf; strcpy(tmpbuf, "???"); } syslog(LOG_INFO, "sending NAK (%d, %s) to %s", error, tp->th_msg, tmp_p); } if (send(peer, buf, length, 0) != length) syslog(LOG_WARNING, "nak: %m"); } tftp-hpa-5.2/tftpd/Makefile0000664000200200020020000000130411671225440013746 0ustar hpahpaSRCROOT = .. VERSION = $(shell cat ../version) -include ../MCONFIG include ../MRULES OBJS = tftpd.$(O) recvfrom.$(O) misc.$(O) $(TFTPDOBJS) all: tftpd$(X) tftpd.8 tftpd$(X): $(OBJS) $(CC) $(LDFLAGS) $^ $(TFTPD_LIBS) -o $@ $(OBJS): ../common/tftpsubs.h tftpd.8: tftpd.8.in ../version sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@ install: all mkdir -p $(INSTALLROOT)$(SBINDIR) $(INSTALLROOT)$(MANDIR)/man8 $(INSTALL_PROGRAM) tftpd$(X) $(INSTALLROOT)$(SBINDIR)/in.tftpd $(INSTALL_DATA) tftpd.8 $(INSTALLROOT)$(MANDIR)/man8/in.tftpd.8 cd $(INSTALLROOT)$(MANDIR)/man8 && $(LN_S) -f in.tftpd.8 tftpd.8 clean: rm -f *.o *.obj *.exe tftpd tftpsubs.c tftpsubs.h tftpd.8 distclean: clean rm -f *~ tftp-hpa-5.2/tftpd/tftpd.h0000664000200200020020000000120011671225440013573 0ustar hpahpa/* ----------------------------------------------------------------------- * * * Copyright 2001 H. Peter Anvin - All Rights Reserved * * This program is free software available under the same license * as the "OpenBSD" operating system, distributed at * http://www.openbsd.org/. * * ----------------------------------------------------------------------- */ /* * tftpd.h * * Prototypes for various functions that are part of the tftpd server. */ #ifndef TFTPD_TFTPD_H #define TFTPD_TFTPD_H void set_signal(int, void (*)(int), int); void *tfmalloc(size_t); char *tfstrdup(const char *); extern int verbosity; #endif tftp-hpa-5.2/tftpd/tftpd.8.in0000664000200200020020000003223611671225440014135 0ustar hpahpa.\" -*- nroff -*- --------------------------------------------------------- * .\" .\" Copyright (c) 1990, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" Copyright 2001-2009 H. Peter Anvin - All Rights Reserved .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\"----------------------------------------------------------------------- */ .TH TFTPD 8 "14 September 2009" "tftp-hpa @@VERSION@@" "System Manager's Manual" .SH NAME .B tftpd \- Trivial File Transfer Protocol server .SH SYNOPSIS .B in.tftpd .RI [ options... ] .I directory... .SH DESCRIPTION .B tftpd is a server for the Trivial File Transfer Protocol. The TFTP protocol is extensively used to support remote booting of diskless devices. The server is normally started by .BR inetd , but can also run standalone. .PP .SH OPTIONS .TP \fB\-\-ipv4\fP, \fB\-4\fP Connect with IPv4 only, even if IPv6 support was compiled in. .TP \fB\-\-ipv6\fP, \fB\-6\fP Connect with IPv6 only, if compiled in. .TP \fB\-l\fP, \fB\-\-listen\fP Run the server in standalone (listen) mode, rather than run from .BR inetd . In listen mode, the .B \-\-timeout option is ignored, and the .B \-\-address option can be used to specify a specific local address or port to listen to. .TP \fB\-\-foreground\fP, \fB\-L\fP Similar to .B \-\-listen but do not detach from the foreground process. Implies .BR \-\-listen . .TP \fB\-\-address\fP \fI[address][:port]\fP, \fB\-a\fP \fI[address][:port]\fP Specify a specific .I address and .I port to listen to when called with the .B \-\-listen or .B \-\-foreground option. The default is to listen to the .I tftp port specified in .I /etc/services on all local addresses. .B Please note: Numeric IPv6 adresses must be enclosed in square brackets to avoid ambiguity with the optional port information. .TP \fB\-\-create\fP, \fB\-c\fP Allow new files to be created. By default, .B tftpd will only allow upload of files that already exist. Files are created with default permissions allowing anyone to read or write them, unless the .B \-\-permissive or .B \-\-umask options are specified. .TP \fB\-\-secure\fP, \fB\-s\fP Change root directory on startup. This means the remote host does not need to pass along the directory as part of the transfer, and may add security. When .B \-\-secure is specified, exactly one .I directory should be specified on the command line. The use of this option is recommended for security as well as compatibility with some boot ROMs which cannot be easily made to include a directory name in its request. .TP \fB\-\-user\fP \fIusername\fP, \fB\-u\fP \fIusername\fP Specify the username which .B tftpd will run as; the default is "nobody". The user ID, group ID, and (if possible on the platform) the supplementary group IDs will be set to the ones specified in the system permission database for this username. .TP \fB\-\-umask\fP \fIumask\fP, \fB\-U\fP \fIumask\fP Sets the \fIumask\fP for newly created files to the specified value. The default is zero (anyone can read or write) if the .B \-\-permissive option is not specified, or inherited from the invoking process if .B \-\-permissive is specified. .TP \fB\-\-permissive\fP, \fB\-p\fP Perform no additional permissions checks above the normal system-provided access controls for the user specified via the .B \-\-user option. .TP \fB\-\-pidfile\fP \fIpidfile\fP, \fB\-P\fP \fIpidfile\fP When run in standalone mode, write the process ID of the listening server into \fIpidfile\fP. On normal termination (SIGTERM or SIGINT) the pid file is automatically removed. .TP \fB\-\-timeout\fP \fItimeout\fP, \fB\-t\fP \fItimeout\fP When run from .B inetd this specifies how long, in seconds, to wait for a second connection before terminating the server. .B inetd will then respawn the server when another request comes in. The default is 900 (15 minutes.) .TP \fB\-\-retransmit\fP \fItimeout, \fP\fB\-T\fP \fItimeout\fP Determine the default timeout, in microseconds, before the first packet is retransmitted. This can be modified by the client if the .B timeout or .B utimeout option is negotiated. The default is 1000000 (1 second.) .TP \fB\-\-mapfile\fP \fIremap-file\fP, \fB\-m\fP \fIremap-file\fP Specify the use of filename remapping. The .I remap-file is a file containing the remapping rules. See the section on filename remapping below. This option may not be compiled in, see the output of .B "in.tftpd \-V" to verify whether or not it is available. .TP \fB\-\-verbose\fP, \fB\-v\fP Increase the logging verbosity of .BR tftpd . This flag can be specified multiple times for even higher verbosity. .TP \fB\-\-verbosity\fP \fIvalue\fP Set the verbosity value to \fIvalue\fP. .TP \fB\-\-refuse\fP \fItftp-option\fP, \fB\-r\fP \fItftp-option\fP Indicate that a specific RFC 2347 TFTP option should never be accepted. .TP \fB\-\-blocksize\fP \fImax-block-size\fP, \fB\-B\fP \fImax-block-size\fP Specifies the maximum permitted block size. The permitted range for this parameter is from 512 to 65464. Some embedded clients request large block sizes and yet do not handle fragmented packets correctly; for these clients, it is recommended to set this value to the smallest MTU on your network minus 32 bytes (20 bytes for IP, 8 for UDP, and 4 for TFTP; less if you use IP options on your network.) For example, on a standard Ethernet (MTU 1500) a value of 1468 is reasonable. .TP \fB\-\-port-range\fP \fIport:port\fP, \fB\-R\fP \fIport:port\fP Force the server port number (the Transaction ID) to be in the specified range of port numbers. .TP \fB\-\-version\fP, \fB\-V\fP Print the version number and configuration to standard output, then exit gracefully. .SH "RFC 2347 OPTION NEGOTIATION" This version of .B tftpd supports RFC 2347 option negotation. Currently implemented options are: .TP \fBblksize\fP (RFC 2348) Set the transfer block size to anything less than or equal to the specified option. This version of .B tftpd can support any block size up to the theoretical maximum of 65464 bytes. .TP \fBblksize2\fP (nonstandard) Set the transfer block size to anything less than or equal to the specified option, but restrict the possible responses to powers of 2. The maximum is 32768 bytes (the largest power of 2 less than or equal to 65464.) .TP \fBtsize\fP (RFC 2349) Report the size of the file that is about to be transferred. This version of .B tftpd only supports the .B tsize option for binary (octet) mode transfers. .TP \fBtimeout\fP (RFC 2349) Set the time before the server retransmits a packet, in seconds. .TP \fButimeout\fP (nonstandard) Set the time before the server retransmits a packet, in microseconds. .TP \fBrollover\fP (nonstandard) Set the block number to resume at after a block number rollover. The default and recommended value is zero. .PP The .B \-\-refuse option can be used to disable specific options; this may be necessary to work around bugs in specific TFTP client implementations. For example, some TFTP clients have been found to request the .B blksize option, but crash with an error if they actually get the option accepted by the server. .SH "FILENAME REMAPPING" The .B \-\-mapfile option specifies a file which contains filename remapping rules. Each non-comment line (comments begin with hash marks, .BR # ) contains an .IR operation , specified below; a .IR regex , a regular expression in the style of .BR egrep ; and optionally a .IR "replacement pattern" . The operation indicated by .I operation is performed if the .I regex matches all or part of the filename. Rules are processed from the top down, and by default, all rules are processed even if there is a match. .PP The .I operation can be any combination of the following letters: .TP .B r Replace the substring matched by .I regex by the .IR "replacement pattern" . The replacement pattern may contain escape sequences; see below. .TP .B g Repeat this rule until it no longer matches. This is always used with .BR r . .TP .B i Match the .I regex case-insensitively. By default it is case sensitive. .TP .B e If this rule matches, end rule processing after executing the rule. .TP .B s If this rule matches, start rule processing over from the very first rule after executing this rule. .TP .B a If this rule matches, refuse the request and send an access denied error to the client. .TP .B G This rule applies to GET (RRQ) requests only. .TP .B P This rule applies to PUT (WRQ) requests only. .TP .B ~ Inverse the sense of this rule, i.e. execute the .I operation only if the .I regex .I doesn't match. Cannot used together with .BR r . .PP The following escape sequences are recognized as part of the .IR "replacement pattern" : .TP \fB\\0\fP The entire string matched by the .IR regex . .TP \fB\\1\fP to \fB\\9\fP The strings matched by each of the first nine parenthesized subexpressions, \\( ... \\), of the .I regex pattern. .TP \fB\\i\fP The IP address of the requesting host, in dotted-quad notation (e.g. 192.0.2.169). .TP \fB\\x\fP The IP address of the requesting host, in hexadecimal notation (e.g. C00002A9). .TP \fB\\\\\fP Literal backslash. .TP \fB\\\fP\fIwhitespace\fP Literal whitespace. .TP \fB\\#\fP Literal hash mark. .TP \fB\\U\fP Turns all subsequent letters to upper case. .TP \fB\\L\fP Turns all subsequent letters to lower case. .TP \fB\\E\fP Cancels the effect of \fB\\U\fP or \fB\\L\fP. .PP If the mapping file is changed, you need to send .B SIGHUP to any outstanding .B tftpd process. .SH "SECURITY" The use of TFTP services does not require an account or password on the server system. Due to the lack of authentication information, .B tftpd will allow only publicly readable files (o+r) to be accessed, unless the .B \-\-permissive option is specified. Files may be written only if they already exist and are publicly writable, unless the .B \-\-create option is specified. Note that this extends the concept of ``public'' to include all users on all hosts that can be reached through the network; this may not be appropriate on all systems, and its implications should be considered before enabling TFTP service. Typically, some kind of firewall or packet-filter solution should be employed. If appropriately compiled (see the output of .BR "in.tftpd \-\-version" ) .B tftpd will query the .BR hosts_access (5) database for access control information. This may be slow; sites requiring maximum performance may want to compile without this option and rely on firewalling or kernel-based packet filters instead. .PP The server should be set to run as the user with the lowest possible privilege; please see the .B \-\-user flag. It is probably a good idea to set up a specific user account for .BR tftpd , rather than letting it run as "nobody", to guard against privilege leaks between applications. .PP Access to files can, and should, be restricted by invoking .B tftpd with a list of directories by including pathnames as server program arguments on the command line. In this case access is restricted to files whole names are prefixed by one of the given directories. If possible, it is recommended that the .B \-\-secure flag is used to set up a chroot() environment for the server to run in once a connection has been set up. .PP Finally, the filename remapping .RB ( \-\-mapfile flag) support can be used to provide a limited amount of additional access control. .SH "CONFORMING TO" RFC 1123, .IR "Requirements for Internet Hosts \- Application and Support" . .br RFC 1350, .IR "The TFTP Protocol (revision 2)" . .br RFC 2347, .IR "TFTP Option Extension" . .br RFC 2348, .IR "TFTP Blocksize Option" . .br RFC 2349, .IR "TFTP Timeout Interval and Transfer Size Options" . .SH "AUTHOR" This version of .B tftpd is maintained by H. Peter Anvin . It was derived from, but has substantially diverged from, an OpenBSD source base, with added patches by Markus Gutschke and Gero Kulhman. .SH "SEE ALSO" .BR tftp (1), .BR egrep (1), .BR umask (2), .BR hosts_access (5), .BR regex (7), .BR inetd (8). tftp-hpa-5.2/INSTALL.tftp0000664000200200020020000000241411671225440013175 0ustar hpahpaSpecific installation instructions ================================== In addition to what is described in the INSTALL file, the following specifics apply to the tftp-hpa package: The tftp-hpa package supports the following options to ./configure: --without-tcpwrappers Disables the use of the tcp wrapper library. This is recommended, for performance reasons, on high-use sites. Kernel-based firewalling is, in general, a better alternative. --without-remap Disables the use of regular-expression-based filename remapping (the -m option to tftpd). --without-readline Disables the use of the readline command-line editing library in the tftp client. The default prefix for the tftp-hpa package is /usr, with the tftp client installing as /usr/bin/tftp and the tftpd server installing as /usr/sbin/in.tftpd on most systems. This can be overridden by setting --bindir and --sbindir. "make install" supports specifying an INSTALLROOT, which points to what will be the root of the filesystem at runtime; this is typically used when preparing packages for package-management systems. You almost certainly will need GNU make to build tftp-hpa. If you don't already have it, you can find GNU make at: ftp://ftp.gnu.org/pub/make/ or ftp://mirrors.kernel.org/gnu/make/ tftp-hpa-5.2/tftp.spec0000664000200200020020000001511011671225441013017 0ustar hpahpaSummary: The client for the Trivial File Transfer Protocol (TFTP). Name: tftp Version: 5.2 Release: 1 License: BSD Group: Applications/Internet Source0: http://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.gz BuildRequires: tcp_wrappers-devel BuildRoot: %{_tmppath}/%{name}-root %description The Trivial File Transfer Protocol (TFTP) is normally used only for booting diskless workstations. The tftp package provides the user interface for TFTP, which allows users to transfer files to and from a remote machine. This program and TFTP provide very little security, and should not be enabled unless it is expressly needed. %package server Group: System Environment/Daemons Summary: The server for the Trivial File Transfer Protocol (TFTP). Requires: xinetd %description server The Trivial File Transfer Protocol (TFTP) is normally used only for booting diskless workstations. The tftp-server package provides the server for TFTP, which allows users to transfer files to and from a remote machine. TFTP provides very little security, and should not be enabled unless it is expressly needed. The TFTP server is run from /etc/xinetd.d/tftp, and is disabled by default on Red Hat Linux systems. %prep %setup -q -n tftp-hpa-%{version} %build %configure make %{?_smp_mflags} %install rm -rf ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}%{_bindir} mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,8} mkdir -p ${RPM_BUILD_ROOT}%{_sbindir} make INSTALLROOT=${RPM_BUILD_ROOT} \ SBINDIR=%{_sbindir} MANDIR=%{_mandir} \ install install -m755 -d ${RPM_BUILD_ROOT}%{_sysconfdir}/xinetd.d/ ${RPM_BUILD_ROOT}/tftpboot install -m644 tftp-xinetd ${RPM_BUILD_ROOT}%{_sysconfdir}/xinetd.d/tftp %post server /sbin/service xinetd reload > /dev/null 2>&1 || : %postun server if [ $1 = 0 ]; then /sbin/service xinetd reload > /dev/null 2>&1 || : fi %clean rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,root) %{_bindir}/tftp %{_mandir}/man1/* %files server %defattr(-,root,root) %config(noreplace) %{_sysconfdir}/xinetd.d/tftp %dir /tftpboot %{_sbindir}/in.tftpd %{_mandir}/man8/* %changelog * Tue Sep 14 2004 H. Peter Anvin - removed completely broken "Malta" patch. - integrated into build machinery so rpm -ta works. * Fri Feb 13 2004 Elliot Lee - rebuilt * Wed Jun 04 2003 Elliot Lee - rebuilt * Fri Apr 11 2003 Elliot Lee - 0.33 - Add /tftpboot directory (#88204) * Mon Feb 24 2003 Elliot Lee - rebuilt * Sun Feb 23 2003 Tim Powers - add BuildPreReq on tcp_wrappers * Wed Jan 22 2003 Tim Powers - rebuilt * Mon Nov 11 2002 Elliot Lee 0.32-1 - Update to 0.32 * Wed Oct 23 2002 Elliot Lee 0.30-1 - Fix #55789 - Update to 0.30 * Thu Jun 27 2002 Elliot Lee - Try applying HJ's patch from #65476 * Fri Jun 21 2002 Tim Powers - automated rebuild * Mon Jun 17 2002 Elliot Lee - Update to 0.29 * Thu May 23 2002 Tim Powers - automated rebuild * Wed Jan 09 2002 Tim Powers - automated rebuild * Tue Dec 18 2001 Elliot Lee 0.17-15 - Add patch4: netkit-tftp-0.17-defaultport.patch for bug #57562 - Update to tftp-hpa-0.28 (bug #56131) - Remove include/arpa/tftp.h to fix #57259 - Add resource limits in tftp-xinetd (#56722) * Sun Jun 24 2001 Elliot Lee - Bump release + rebuild. * Tue Jun 12 2001 Helge Deller (0.17-13) - updated tftp-hpa source to tftp-hpa-0.17 - tweaked specfile with different defines for tftp-netkit and tftp-hpa version - use hpa's tftpd.8 man page instead of the netkits one * Mon May 07 2001 Helge Deller - rebuilt in 7.1.x * Wed Apr 18 2001 Helge Deller - fix tftp client's put problems (#29529) - update to tftp-hpa-0.16 * Wed Apr 4 2001 Jakub Jelinek - don't let configure to guess compiler, it can pick up egcs * Thu Feb 08 2001 Helge Deller - changed "wait" in xinetd file to "yes" (hpa-tftpd forks and exits) (#26467) - fixed hpa-tftpd to handle files greater than 32MB (#23725) - added "-l" flag to hpa-tftpd for file-logging (#26467) - added description for "-l" to the man-page * Thu Feb 08 2001 Helge Deller - updated tftp client to 0.17 stable (#19640), - drop dependency on xinetd for tftp client (#25051), * Wed Jan 17 2001 Jeff Johnson - xinetd shouldn't wait on tftp (which forks) (#23923). * Sat Jan 6 2001 Jeff Johnson - fix to permit tftp put's (#18128). - startup as root with chroot to /tftpboot with early reversion to nobody is preferable to starting as nobody w/o ability to chroot. - %%post is needed by server, not client. Add %%postun for erasure as well. * Wed Aug 23 2000 Nalin Dahyabhai - default to being disabled * Thu Aug 17 2000 Jeff Johnson - correct group. * Tue Jul 25 2000 Nalin Dahyabhai - change user from root to nobody * Sat Jul 22 2000 Jeff Johnson - update to tftp-hpa-0.14 (#14003). - add server_args (#14003). - remove -D_BSD_SOURCE (#14003). * Fri Jul 21 2000 Nalin Dahyabhai - cook up an xinetd config file for tftpd * Wed Jul 12 2000 Prospector - automatic rebuild * Sun Jun 18 2000 Jeff Johnson - FHS packaging. - update to 0.17. * Fri May 5 2000 Matt Wilson - use _BSD_SOURCE for hpa's tftpd so we get BSD signal semantics. * Fri Feb 11 2000 Bill Nottingham - fix description * Wed Feb 9 2000 Jeff Johnson - compress man pages (again). * Wed Feb 02 2000 Cristian Gafton - man pages are compressed - fix description and summary * Tue Jan 4 2000 Bill Nottingham - split client and server * Tue Dec 21 1999 Jeff Johnson - update to 0.16. * Sat Aug 28 1999 Jeff Johnson - update to 0.15. * Wed Apr 7 1999 Jeff Johnson - tftpd should truncate file when overwriting (#412) * Sun Mar 21 1999 Cristian Gafton - auto rebuild in the new build environment (release 22) * Mon Mar 15 1999 Jeff Johnson - compile for 6.0. * Fri Aug 7 1998 Jeff Johnson - build root * Mon Apr 27 1998 Prospector System - translations modified for de, fr, tr * Mon Sep 22 1997 Erik Troan - added check for getpwnam() failure * Tue Jul 15 1997 Erik Troan - initial build tftp-hpa-5.2/MRULES0000664000200200020020000000045711671225440012127 0ustar hpahpa# Standard compilation rules (don't use make builtins) .SUFFIXES: .c .cc .o .s .S .i .c.o: $(CC) $(CFLAGS) -c $< .c.s: $(CC) $(CFLAGS) -S -o $@ $< .c.i: $(CC) $(CFLAGS) -E -o $@ $< .cc.o: $(CXX) $(CXXFLAGS) -c $< .cc.s: $(CXX) $(CXXFLAGS) -S -o $@ $< .cc.i: $(CXX) $(CXXFLAGS) -E -o $@ $< tftp-hpa-5.2/config.h0000664000200200020020000001757011671225440012617 0ustar hpahpa/* -*- c -*- ------------------------------------------------------------- * * * Copyright 2001-2006 H. Peter Anvin - All Rights Reserved * * This program is free software available under the same license * as the "OpenBSD" operating system, distributed at * http://www.openbsd.org/. * * ----------------------------------------------------------------------- */ /* * config.h * * Sets up a common baseline environment, based on "autoconf" findings... */ #ifndef CONFIG_H #define CONFIG_H 1 /* Must be included before we include any system headers! */ #include "aconfig.h" /* autogenerated configuration header */ /* Standard includes */ #include #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef STDC_HEADERS #include #include #else #ifdef HAVE_STDLIB_H #include #endif #endif #ifdef HAVE_MEMORY_H #ifndef STDC_HEADERS #include #endif #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_INTTYPES_H #ifdef INTTYPES_H_IS_SANE #include #endif #else #ifdef HAVE_STDINT_H #include #endif #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SETJMP_H #include #endif #ifdef TIME_WITH_SYS_TIME #include #include #else #if HAVE_SYS_TIME_H #include #else #include #endif #endif #ifdef HAVE_GRP_H #include #endif #ifdef HAVE_FCNTL_H #include #endif #include #include #ifdef HAVE_SYS_SOCKET_H #include #else #ifdef HAVE_WINSOCK2_H #include #else #ifdef HAVE_WINSOCK_H #include #endif #endif #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_GETOPT_LONG #include #else #include "lib/getopt.h" #endif /* Test for EAGAIN/EWOULDBLOCK */ #ifdef EAGAIN #if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN) #define E_WOULD_BLOCK(x) ((x) == EAGAIN || (x) == EWOULDBLOCK) #else #define E_WOULD_BLOCK(x) ((x) == EAGAIN) #endif #else #define E_WOULD_BLOCK(x) ((x) == EWOULDBLOCK) #endif /* Some broken systems care about text versus binary, but real Unix systems don't... */ #ifndef HAVE_O_TEXT_DEFINITION #define O_TEXT 0 #endif #ifndef HAVE_O_BINARY_DEFINITION #define O_BINARY 0 #endif /* If we don't have intmax_t, try creating it */ #ifndef HAVE_INTMAX_T #ifdef HAVE_LONG_LONG typedef long long intmax_t; typedef unsigned long long uintmax_t; #define PRIdMAX "lld" #define PRIuMAX "llu" #define PRIxMAX "llx" #define INTMAX_C(x) (x##LL) #define UINTMAX_C(x) (x##ULL) #else typedef long intmax_t; typedef unsigned long uintmax_t; #define PRIdMAX "ld" #define PRIuMAX "lu" #define PRIxMAX "lx" #define INTMAX_C(x) (x##L) #define UINTMAX_C(x) (x##UL) #endif #endif /* On some version of AIX, is buggy to the point of unusability. We have to use macros here, not typedefs, to override. */ #ifdef HAVE_INTTYPES_H #ifndef INTTYPES_H_IS_SANE #undef PRIdMAX #undef PRIuMAX #undef PRIxMAX #undef INTMAX_C #undef UINTMAX_C #undef HAVE_STRTOUMAX #ifdef HAVE_LONG_LONG #define intmax_t long long #define uintmax_t unsigned long long #define PRIdMAX "Ld" #define PRIuMAX "Lu" #define PRIxMAX "Lx" #define INTMAX_C(x) (x##LL) #define UINTMAX_C(x) (x##ULL) #else #define intmax_t long #define uintmax_t unsigned long #define PRIdMAX "ld" #define PRIuMAX "lu" #define PRIxMAX "lx" #define INTMAX_C(x) (x##L) #define UINTMAX_C(x) (x##UL) #endif #endif #endif /* Even if intmax_t is defined, we may need this (Solaris 8 braindamage) */ #ifndef HAVE_STRTOUMAX #if defined(HAVE_LONG_LONG) && defined(HAVE_STRTOULL) #define strtoumax(p,e,b) ((uintmax_t)strtoull(p,e,b)) #else #define strtoumax(p,e,b) ((uintmax_t)strtoul(p,e,b)) #endif #endif /* A lot of this is old BSD code. Some newer systems don't approve. */ /* The type used by htons(), ntohs() */ #ifndef HAVE_U_SHORT #ifdef HAVE_UINT16_T typedef uint16_t u_short; #else typedef unsigned short u_short; #endif #endif /* The type used to htonl(), ntohl() */ #ifndef HAVE_U_LONG #ifdef HAVE_UINT32_T typedef uint32_t u_long; #else typedef unsigned long u_long; #endif #endif /* socklen_t */ #ifndef HAVE_SOCKLEN_T typedef int socklen_t; #endif /* sysexits.h */ #ifdef HAVE_SYSEXITS_H #include #else #define EX_USAGE 64 /* command line usage error */ #define EX_DATAERR 65 /* data format error */ #define EX_NOINPUT 66 /* cannot open input */ #define EX_NOUSER 67 /* addressee unknown */ #define EX_NOHOST 68 /* host name unknown */ #define EX_UNAVAILABLE 69 /* service unavailable */ #define EX_SOFTWARE 70 /* internal software error */ #define EX_OSERR 71 /* system error (e.g., can't fork) */ #define EX_OSFILE 72 /* critical OS file missing */ #define EX_CANTCREAT 73 /* can't create (user) output file */ #define EX_IOERR 74 /* input/output error */ #define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ #define EX_PROTOCOL 76 /* remote error in protocol */ #define EX_NOPERM 77 /* permission denied */ #define EX_CONFIG 78 /* configuration error */ #endif /* If we don't have sigsetjmp() et all, setjmp() will have to do */ #ifndef HAVE_SIGSETJMP #define sigsetjmp(x,y) setjmp(x) #define siglongjmp(x,y) longjmp(x,y) #define sigjmp_buf jmp_buf #endif /* How do we annotate unused data items? */ #ifndef UNUSED #ifdef __GNUC__ #define UNUSED __attribute__((unused)) #else #define UNUSED #endif #endif /* netinet/in.h, and possible missing pieces */ #include #ifndef HAVE_IPPORT_TFTP_DEFINITION #ifndef IPPORT_TFTP #define IPPORT_TFTP 69 #endif #endif /* arpa/{inet,tftp}.h, and possible missing pieces */ #ifdef HAVE_ARPA_INET_H #include #endif /* If we don't have arpa/tftp.h we have problems... */ #include #ifndef OACK #define OACK 6 #endif #ifndef EOPTNEG #define EOPTNEG 8 #endif /* Prototypes for libxtra functions */ void *xmalloc(size_t); char *xstrdup(const char *); #ifndef HAVE_BSD_SIGNAL void (*bsd_signal(int, void (*)(int))) (int); #endif #ifndef HAVE_DUP2 int dup2(int, int); #endif #ifndef HAVE_DAEMON int daemon(int, int); #endif #ifndef HAVE_GETADDRINFO #ifndef HAVE_STRUCT_ADDRINFO struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; struct sockaddr *ai_addr; char *ai_canonname; struct addrinfo *ai_next; }; #endif int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **); void freeaddrinfo(struct addrinfo *); const char *gai_strerror(int); #ifndef EAI_NONAME #define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ #endif #ifndef EAI_ADDRFAMILY #define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ #endif #ifndef EAI_MEMORY #define EAI_MEMORY -10 /* Memory allocation failure. */ #endif #ifndef EAI_SYSTEM #define EAI_SYSTEM -11 /* System error returned in `errno'. */ #endif #endif #ifndef AI_CANONNAME #define AI_CANONNAME 0 #endif #ifndef AI_ADDRCONFIG #define AI_ADDRCONFIG 0 #endif #ifndef INET6_ADDRSTRLEN #define INET6_ADDRSTRLEN 46 #endif #ifndef HAVE_INET_NTOP const char *inet_ntop(int, const void *, char *, socklen_t); #endif /* tftp-hpa version and configuration strings */ #include "version.h" #ifdef WITH_READLINE #define WITH_READLINE_STR ", with readline" #else #define WITH_READLINE_STR ", without readline" #endif #ifdef WITH_REGEX #define WITH_REGEX_STR ", with remap" #else #define WITH_REGEX_STR ", without remap" #endif #ifdef HAVE_LIBWRAP #define HAVE_LIBWRAP_STR ", with tcpwrappers" #else #define HAVE_LIBWRAP_STR ", without tcpwrappers" #endif #define TFTP_CONFIG_STR VERSION WITH_READLINE_STR #define TFTPD_CONFIG_STR VERSION WITH_REGEX_STR HAVE_LIBWRAP_STR #endif tftp-hpa-5.2/tftp.spec.in0000664000200200020020000001512011671225440013424 0ustar hpahpaSummary: The client for the Trivial File Transfer Protocol (TFTP). Name: tftp Version: @@VERSION@@ Release: 1 License: BSD Group: Applications/Internet Source0: http://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.gz BuildRequires: tcp_wrappers-devel BuildRoot: %{_tmppath}/%{name}-root %description The Trivial File Transfer Protocol (TFTP) is normally used only for booting diskless workstations. The tftp package provides the user interface for TFTP, which allows users to transfer files to and from a remote machine. This program and TFTP provide very little security, and should not be enabled unless it is expressly needed. %package server Group: System Environment/Daemons Summary: The server for the Trivial File Transfer Protocol (TFTP). Requires: xinetd %description server The Trivial File Transfer Protocol (TFTP) is normally used only for booting diskless workstations. The tftp-server package provides the server for TFTP, which allows users to transfer files to and from a remote machine. TFTP provides very little security, and should not be enabled unless it is expressly needed. The TFTP server is run from /etc/xinetd.d/tftp, and is disabled by default on Red Hat Linux systems. %prep %setup -q -n tftp-hpa-%{version} %build %configure make %{?_smp_mflags} %install rm -rf ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}%{_bindir} mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,8} mkdir -p ${RPM_BUILD_ROOT}%{_sbindir} make INSTALLROOT=${RPM_BUILD_ROOT} \ SBINDIR=%{_sbindir} MANDIR=%{_mandir} \ install install -m755 -d ${RPM_BUILD_ROOT}%{_sysconfdir}/xinetd.d/ ${RPM_BUILD_ROOT}/tftpboot install -m644 tftp-xinetd ${RPM_BUILD_ROOT}%{_sysconfdir}/xinetd.d/tftp %post server /sbin/service xinetd reload > /dev/null 2>&1 || : %postun server if [ $1 = 0 ]; then /sbin/service xinetd reload > /dev/null 2>&1 || : fi %clean rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,root) %{_bindir}/tftp %{_mandir}/man1/* %files server %defattr(-,root,root) %config(noreplace) %{_sysconfdir}/xinetd.d/tftp %dir /tftpboot %{_sbindir}/in.tftpd %{_mandir}/man8/* %changelog * Tue Sep 14 2004 H. Peter Anvin - removed completely broken "Malta" patch. - integrated into build machinery so rpm -ta works. * Fri Feb 13 2004 Elliot Lee - rebuilt * Wed Jun 04 2003 Elliot Lee - rebuilt * Fri Apr 11 2003 Elliot Lee - 0.33 - Add /tftpboot directory (#88204) * Mon Feb 24 2003 Elliot Lee - rebuilt * Sun Feb 23 2003 Tim Powers - add BuildPreReq on tcp_wrappers * Wed Jan 22 2003 Tim Powers - rebuilt * Mon Nov 11 2002 Elliot Lee 0.32-1 - Update to 0.32 * Wed Oct 23 2002 Elliot Lee 0.30-1 - Fix #55789 - Update to 0.30 * Thu Jun 27 2002 Elliot Lee - Try applying HJ's patch from #65476 * Fri Jun 21 2002 Tim Powers - automated rebuild * Mon Jun 17 2002 Elliot Lee - Update to 0.29 * Thu May 23 2002 Tim Powers - automated rebuild * Wed Jan 09 2002 Tim Powers - automated rebuild * Tue Dec 18 2001 Elliot Lee 0.17-15 - Add patch4: netkit-tftp-0.17-defaultport.patch for bug #57562 - Update to tftp-hpa-0.28 (bug #56131) - Remove include/arpa/tftp.h to fix #57259 - Add resource limits in tftp-xinetd (#56722) * Sun Jun 24 2001 Elliot Lee - Bump release + rebuild. * Tue Jun 12 2001 Helge Deller (0.17-13) - updated tftp-hpa source to tftp-hpa-0.17 - tweaked specfile with different defines for tftp-netkit and tftp-hpa version - use hpa's tftpd.8 man page instead of the netkits one * Mon May 07 2001 Helge Deller - rebuilt in 7.1.x * Wed Apr 18 2001 Helge Deller - fix tftp client's put problems (#29529) - update to tftp-hpa-0.16 * Wed Apr 4 2001 Jakub Jelinek - don't let configure to guess compiler, it can pick up egcs * Thu Feb 08 2001 Helge Deller - changed "wait" in xinetd file to "yes" (hpa-tftpd forks and exits) (#26467) - fixed hpa-tftpd to handle files greater than 32MB (#23725) - added "-l" flag to hpa-tftpd for file-logging (#26467) - added description for "-l" to the man-page * Thu Feb 08 2001 Helge Deller - updated tftp client to 0.17 stable (#19640), - drop dependency on xinetd for tftp client (#25051), * Wed Jan 17 2001 Jeff Johnson - xinetd shouldn't wait on tftp (which forks) (#23923). * Sat Jan 6 2001 Jeff Johnson - fix to permit tftp put's (#18128). - startup as root with chroot to /tftpboot with early reversion to nobody is preferable to starting as nobody w/o ability to chroot. - %%post is needed by server, not client. Add %%postun for erasure as well. * Wed Aug 23 2000 Nalin Dahyabhai - default to being disabled * Thu Aug 17 2000 Jeff Johnson - correct group. * Tue Jul 25 2000 Nalin Dahyabhai - change user from root to nobody * Sat Jul 22 2000 Jeff Johnson - update to tftp-hpa-0.14 (#14003). - add server_args (#14003). - remove -D_BSD_SOURCE (#14003). * Fri Jul 21 2000 Nalin Dahyabhai - cook up an xinetd config file for tftpd * Wed Jul 12 2000 Prospector - automatic rebuild * Sun Jun 18 2000 Jeff Johnson - FHS packaging. - update to 0.17. * Fri May 5 2000 Matt Wilson - use _BSD_SOURCE for hpa's tftpd so we get BSD signal semantics. * Fri Feb 11 2000 Bill Nottingham - fix description * Wed Feb 9 2000 Jeff Johnson - compress man pages (again). * Wed Feb 02 2000 Cristian Gafton - man pages are compressed - fix description and summary * Tue Jan 4 2000 Bill Nottingham - split client and server * Tue Dec 21 1999 Jeff Johnson - update to 0.16. * Sat Aug 28 1999 Jeff Johnson - update to 0.15. * Wed Apr 7 1999 Jeff Johnson - tftpd should truncate file when overwriting (#412) * Sun Mar 21 1999 Cristian Gafton - auto rebuild in the new build environment (release 22) * Mon Mar 15 1999 Jeff Johnson - compile for 6.0. * Fri Aug 7 1998 Jeff Johnson - build root * Mon Apr 27 1998 Prospector System - translations modified for de, fr, tr * Mon Sep 22 1997 Erik Troan - added check for getpwnam() failure * Tue Jul 15 1997 Erik Troan - initial build tftp-hpa-5.2/tftp-xinetd0000664000200200020020000000077611671225440013372 0ustar hpahpa# default: off # description: The tftp server serves files using the trivial file transfer \ # protocol. The tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /tftpboot disable = yes per_source = 11 cps = 100 2 flags = IPv4 }