pxe-1.4.2/0040755000175000017500000000000010055064214011177 5ustar timhuserspxe-1.4.2/Makefile0100644000175000017500000000002210040451112012615 0ustar timhusersall: ./configure pxe-1.4.2/sock.cc0100644000175000017500000004223710055063512012452 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * sock.c - socket IO class defs * ******************************************************************************/ #include "sock.h" #include #ifndef _SOCKLEN_T typedef unsigned int socklen_t; #endif // _SOCKLEN_T /****************************************************************************** * Constructor * ******************************************************************************/ Sock::Sock(LogFile *_log, const char *interface, uint16_t port) { iflist_t *start, *ptr, *prev, distinct; int listlen = 0; this->log = _log; listen_multi = 0; multi_sockfd = -1; sockfds = NULL; ifnum = 0; memset(&default_addr, 0, sizeof(default_addr)); // prepare if(port == 0) port = DEF_PORT; default_addr.sin_port = htons(port); start = GetIfList(); ptr = start; // see if the specified interface is available while(ptr != NULL) { listlen++; if(NULL != interface) if(strcmp(interface, ptr->if_name) == 0) break; ptr = ptr->next; } // if available, only bind to that if (ptr != NULL) { std::cout << "Only binding to interface " << ptr->if_name << "\n"; distinct.if_name = ptr->if_name; memcpy(&(distinct.if_addr), &(ptr->if_addr), sizeof(distinct.if_addr)); default_addr.sin_addr.s_addr = distinct.if_addr.s_addr; distinct.next = NULL; Open(&distinct, 1, port); } else // else all interfaces { std::cout << "Binding to all interfaces\n"; default_addr.sin_addr.s_addr = INADDR_BROADCAST; Open(start, listlen, port); } prev = ptr = start; while(ptr != NULL) { ptr = ptr->next; delete[] prev->if_name; delete prev; prev = ptr; } } /****************************************************************************** * GetIfList - get a list of all interfaces in the machine * ******************************************************************************/ #ifndef HAVE_GETIFADDRS iflist_t * Sock::GetIfList() { int tmp_sockfd; struct ifconf ifc; struct sockaddr_in tmp_addr; iflist_t *start, *ptr; int pos, len, lastlen; tmp_sockfd = socket(AF_INET, SOCK_DGRAM, 0); if(tmp_sockfd == -1) throw new SysException(errno, "Sock::Sock:socket()"); lastlen=0; len=1024; while(1) { ifc.ifc_len = len; ifc.ifc_req = new(struct ifreq[len]); if(ioctl(tmp_sockfd, SIOCGIFCONF, &ifc) < 0) throw new SysException(errno, "Sock::Sock:ioctl()"); if(ifc.ifc_len <= len) break; lastlen = ifc.ifc_len; len += 10; delete[] ifc.ifc_req; } close(tmp_sockfd); // allocate the first in the linked list start = new iflist_t; start->next = NULL; ptr = start; /* go throught the struct and pick out the info */ pos=0; while(1) { ptr->if_name = new char[strlen(ifc.ifc_req[pos].ifr_name)+1]; strcpy(ptr->if_name, ifc.ifc_req[pos].ifr_name); std::cout << "Found interface " << ifc.ifc_req[pos].ifr_name << "\n"; // tidy this up, too many ops memcpy(&tmp_addr, &(ifc.ifc_req[pos].ifr_addr), sizeof(tmp_addr)); memcpy(&(ptr->if_addr), &(tmp_addr.sin_addr), sizeof(ptr->if_addr)); // do we leave now? pos++; if(((pos)*sizeof(struct ifreq)) >= (unsigned)ifc.ifc_len) break; // allocate the new item ptr->next = new iflist_t; ptr = ptr->next; ptr->next = NULL; } delete[] ifc.ifc_req; return(start); } #else iflist_t * Sock::GetIfList() { struct ifaddrs *ifap, *ifptr; struct sockaddr_in tmp_addr; iflist_t *start, *ptr, *prevptr; // get an interface list if(-1 == getifaddrs(&ifap)) { log->Event(LEVEL_INFO, "Sock::GetIfList", 1, "Unable to get interface list"); return(NULL); } // allocate the first in the linked list start = ptr = prevptr = NULL; // go through the list ifptr = ifap; for(ifptr = ifap; ifptr; ifptr = ifptr->ifa_next) { if(!(ifptr->ifa_addr) || AF_INET != ifptr->ifa_addr->sa_family) continue; ptr = new iflist_t; ptr->next = NULL; if(NULL == start) start = prevptr = ptr; else { prevptr->next = ptr; prevptr = ptr; } ptr->if_name = new char[strlen(ifptr->ifa_name)+1]; strcpy(ptr->if_name, ifptr->ifa_name); std::cout << "Found interface " << ifptr->ifa_name << "\n"; // tidy this up, too many ops memcpy(&tmp_addr, ifptr->ifa_addr, sizeof(tmp_addr)); memcpy(&(ptr->if_addr), &(tmp_addr.sin_addr), sizeof(ptr->if_addr)); ptr->next = NULL; } // free the interface list freeifaddrs(ifap); return(start); } #endif // HAVE_GETIFADDRS /****************************************************************************** * Destructor * ******************************************************************************/ Sock::~Sock() { Close(); delete[] sockfds; delete[] bind_addrs; ifnum = 0; } /****************************************************************************** * Destructor * ******************************************************************************/ void Sock::SetDefAddr(uint32_t addr) { if((addr != 0) && (default_addr.sin_addr.s_addr != 0)) default_addr.sin_addr.s_addr = htonl(addr); } /****************************************************************************** * Open - open a socket bound to and addr and ready to listen on another * ******************************************************************************/ int Sock::Open(iflist_t *local_addrs, int listlen, const uint16_t port) { int tmp; struct servent *bootpc_port; iflist_t *lptr; int pos; /* initalise vars */ lptr = local_addrs; listen_multi = 0; listen_broad = 0; ifnum = listlen; /* sockfds */ sockfds = new int[ifnum]; bind_addrs = new struct sockaddr_in[ifnum]; /* get the port */ listenport = htons(port); bootpc_port = getservbyname(BOOTPC_NAME, "udp"); if(bootpc_port == NULL) throw new SysException(errno, "Sock::Open:getservbyname()"); clientport = bootpc_port->s_port; for(pos=0; lptr != NULL; pos++) { /* fill the structs */ bzero(&bind_addrs[pos], sizeof(bind_addrs[pos])); bind_addrs[pos].sin_family = AF_INET; bind_addrs[pos].sin_port = listenport; memcpy(&(bind_addrs[pos].sin_addr), &(lptr->if_addr), sizeof(bind_addrs[pos].sin_addr)); std::cout << "Binding to: " << inet_ntoa(bind_addrs[pos].sin_addr) << "\n"; /* create a socket */ sockfds[pos] = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); if(sockfds[pos] == -1) throw new SysException(errno, "Sock::Open:socket()"); /* allow socket re-use */ tmp = 1; if(setsockopt(sockfds[pos], SOL_SOCKET, SO_REUSEADDR, (const char*)&tmp, sizeof(tmp)) == -1) throw new SysException(errno, "Sock::Open:setsockopt(REUSE)"); /* bind the socket to a specific local interface */ if(bind(sockfds[pos], (struct sockaddr*)&bind_addrs[pos], sizeof(bind_addrs[pos])) != 0) throw new SysException(errno, "Sock::Open:bind()"); /* report that we have bound the interface */ char *tmpbuf = new char[16]; sprintf(tmpbuf, "%d", port); log->Event(LEVEL_INFO, "Sock::Open", 4, "Bound to address:", inet_ntoa(lptr->if_addr), "Port:", tmpbuf); delete[] tmpbuf; /* move forward a position */ lptr = lptr->next; } /* return */ return(0); } /****************************************************************************** * JoinMulticast - join a multicast group * ******************************************************************************/ int Sock::JoinMulticast(uint32_t multi_addr) { unsigned char tchar; struct ip_mreq mreq; struct sockaddr_in local; if(listen_multi == 1) return(0); // already listening /* passed a null addr */ if(multi_addr == 0) throw new SysException(0, "Sock::JoinMulticast", "No address specified"); /* is the address actually a multicast address */ if(!IN_MULTICAST(multi_addr)) throw new SysException(0, "Sock::JoinMulticast", "Address specified is not a multicast address"); /* fill the struct */ listenport = htons(4011); memset(&multicast, 0, sizeof(multicast)); multicast.sin_family = AF_INET; multicast.sin_port = listenport; // already in net order multicast.sin_addr.s_addr = htonl(multi_addr); /* local */ memset(&local, 0, sizeof(local)); local.sin_family = AF_INET; local.sin_port = listenport; // already in net order local.sin_addr.s_addr = htonl(INADDR_ANY); /* create a socket */ multi_sockfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); if(multi_sockfd == -1) throw new SysException(errno, "Sock::JoinMulticast:socket()"); /* allow socket re-use */ int tmp = 1; if(setsockopt(multi_sockfd, SOL_SOCKET, SO_REUSEADDR, (const char*)&tmp, sizeof(tmp)) == -1) throw new SysException(errno, "Sock::JoinMulticast:setsockopt(REUSE)"); /* bind to the multicast address */ if(bind(multi_sockfd, (struct sockaddr*)&local, sizeof(local)) != 0) throw new SysException(errno, "Sock::JoinMulticast:bind()"); /* setup the multicast struct */ mreq.imr_interface.s_addr = local.sin_addr.s_addr; mreq.imr_multiaddr.s_addr = multicast.sin_addr.s_addr; /* join a multicast group */ if(setsockopt(multi_sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char*)&mreq, sizeof(mreq)) == -1) throw new SysException(errno, "Sock::JoinMulticast:setsockopt(ADD)"); /* Dont go outside the local net */ tchar = 1; if(setsockopt(multi_sockfd, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&tchar, sizeof(tchar)) == -1) throw new SysException(errno, "Sock::JoinMulticast:setsockopt(TTL)"); /* Dont receive sent packets */ tchar = 0; if(setsockopt(multi_sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, (const char *)&tchar, sizeof(tchar)) == -1) throw new SysException(errno, "Sock::JoinMulticast:setsockopt(LOOP)"); log->Event(LEVEL_INFO, "Sock::JoinMulticast", 1, "Joined multicast group", inet_ntoa(mreq.imr_multiaddr)); // we are now listening listen_multi = 1; return(0); } /****************************************************************************** * LeaveMulticast - leave a multicast group * ******************************************************************************/ int Sock::LeaveMulticast() { struct ip_mreq mreq; /* setup the multicast struct */ mreq.imr_interface.s_addr = htonl(INADDR_ANY); mreq.imr_multiaddr.s_addr = multicast.sin_addr.s_addr; /* leave a sock group */ if(setsockopt(multi_sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (const char*)&mreq, sizeof(mreq)) == -1) throw new SysException(errno, "Sock::LeaveMulticast:setsockopt(DROP)"); /* close */ shutdown(multi_sockfd, 2); close(multi_sockfd); log->Event(LEVEL_INFO, "Sock::LeaveMulticast", 1, "Left multicast group", inet_ntoa(mreq.imr_multiaddr)); listen_multi = 0; return(0); } /****************************************************************************** * AllowBroadcast - allow broadcasts * ******************************************************************************/ int Sock::AllowBroadcast() { int tmp=1; int pos = 0; for(pos=0; pos < ifnum; pos++) { if(setsockopt(sockfds[pos], SOL_SOCKET, SO_BROADCAST, (const char *)&tmp, sizeof(tmp)) == -1) throw new SysException(errno, "Sock::AllowBroadcast:setsockopt()"); } log->Event(LEVEL_INFO, "Sock::AllowBroadcast", 1, "Allowing broadcasts"); listen_broad = 1; return(0); } /****************************************************************************** * DenyBroadcast - deny broadcasts * ******************************************************************************/ int Sock::DenyBroadcast() { int tmp=0; int pos = 0; for(pos=0; pos < ifnum; pos++) { if(setsockopt(sockfds[pos], SOL_SOCKET, SO_BROADCAST, (const char *)&tmp, sizeof(tmp)) == -1) throw new SysException(errno, "Sock::DenyBroadcast:setsockopt()"); } log->Event(LEVEL_INFO, "Sock::DenyBroadcast", 1, "Disallowing broadcasts"); listen_broad = 0; return(0); } /****************************************************************************** * Close - close a routing socket * ******************************************************************************/ int Sock::Close() { int pos; if(listen_broad) DenyBroadcast(); if(listen_multi) LeaveMulticast(); for(pos=0; pos < ifnum; pos++) { shutdown(sockfds[pos], 2); close(sockfds[pos]); } log->Event(LEVEL_INFO, "Sock::Close", 1, "Released interface(s)"); return(0); } /****************************************************************************** * Read - read some data from the socket * ******************************************************************************/ int Sock::Read(unsigned char *buf, int maxlen, struct sockaddr_in *client_addr, struct sockaddr_in *server_addr) { int readlen=0; int size; int pos; int selret; int maxfdno=0; int livefd = 0; fd_set fdset; struct sockaddr_in *from=NULL; // get the max fd no if(NULL != sockfds) for(pos = 0; pos < ifnum; pos++) if(sockfds[pos] > maxfdno) maxfdno = sockfds[pos]; if((listen_multi == 1) && (multi_sockfd > maxfdno)) maxfdno = multi_sockfd; maxfdno++; // need to select from all sockets while(true) { // register all of the fd numbers FD_ZERO(&fdset); if(NULL != sockfds) for(pos = 0; pos < ifnum; pos++) FD_SET(sockfds[pos], &fdset); if(listen_multi == 1) FD_SET(multi_sockfd, &fdset); // wait for the next packet selret = select(maxfdno, &fdset, NULL, NULL, NULL); if(selret == -1) if(errno == EINTR) break; else throw new SysException(errno, "Sock::Read:select()"); // how many fds setup? if(selret < 1) goto Sock_Read_next; // where did it come from? if(NULL != sockfds) for(pos = 0; pos < ifnum; pos++) if(FD_ISSET(sockfds[pos], &fdset)) { livefd = sockfds[pos]; from = &(bind_addrs[pos]); break; } // was the multicast fd set if(listen_multi && FD_ISSET(multi_sockfd, &fdset)) { from = &default_addr; livefd = multi_sockfd; } // read the next packet size=sizeof(struct sockaddr_in); readlen = recvfrom(livefd, (char*)buf, maxlen, 0, (struct sockaddr*)client_addr, (socklen_t*)&size); if(readlen == -1) if(errno == EINTR) break; else throw new SysException(errno, "Sock::Read:read()"); if(readlen == 0) goto Sock_Read_next; // copy the server address memcpy(server_addr, from, sizeof(*from)); // receive any packet on unicast/multicast/broadcast if((client_addr->sin_port == clientport) || (livefd == multi_sockfd)) // HACK! break; Sock_Read_next: size=size; } return(readlen); } /****************************************************************************** * GetHostname - get the hostname of the connected socket * ******************************************************************************/ char * Sock::GetHostname(const struct sockaddr_in *address) { struct hostent *h_info; // get the address info h_info = gethostbyaddr((const char*)&(address->sin_addr.s_addr), sizeof(address->sin_addr.s_addr), AF_INET); if(h_info == NULL) { #ifdef HAVE_HSTRERROR log->Event(LEVEL_INFO, "Sock::GetHostname:gethostbyaddr()", 1, hstrerror(h_errno)); #else log->Event(LEVEL_INFO, "Sock::GetHostname:gethostbyaddr()", 1, "Resolver error occourred"); #endif return(NULL); } return(h_info->h_name); } /****************************************************************************** * Send - send some data to the client * ******************************************************************************/ int Sock::Send(unsigned char *buf, int maxlen, struct sockaddr_in *client_addr, struct sockaddr_in *server_addr) { int livefd=0; int ifno, len; int found = 0; // firstly, make some routing choices for(ifno=0; ifno < ifnum; ifno++) { if(bind_addrs[ifno].sin_addr.s_addr == server_addr->sin_addr.s_addr) { livefd = sockfds[ifno]; found++; break; } } if(multicast.sin_addr.s_addr == server_addr->sin_addr.s_addr) { found++; livefd = multi_sockfd; } // which interface? if(found == 0) throw new SysException(1, "Sock::Send", "Not bound to interface"); // send the message len = sendto(livefd, (char*)buf, maxlen, 0, (struct sockaddr*)client_addr, sizeof(struct sockaddr_in)); // ok? if(-1 == len) throw new SysException(errno, "Sock::Send:sendto()"); if(maxlen != len) throw new SysException(1, "Sock::Send", "Packet truncated"); return(len); } pxe-1.4.2/logfile.h0100644000175000017500000000360707531166304013004 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * logfile.h - a sereis of general event logging procedures * ******************************************************************************/ #ifndef _LOGFILE_H #define _LOGFILE_H #include #include #include #include #include #include #include #include #include #include #include #include #include "autoconf.h" #ifdef HAVE_STDINT_H #include #endif // HAVE_STDINT_H #define LEVEL_INFO_C "Info:" #define LEVEL_ERR_C "Error:" #define LEVEL_EMRG_C "Emergency:" #define LEVEL_FATAL_C "Fatal:" #define LEVEL_INFO 1 #define LEVEL_ERR 2 #define LEVEL_EMRG 3 #define LEVEL_FATAL 4 class LogFile { private: std::fstream *logfile; public: LogFile(); LogFile(const char *filename); ~LogFile(); void Event(int level, const char *where, int count, ...); private: void Open(const char *filename); void Close(void); }; #endif pxe-1.4.2/configure0100755000175000017500000033346107533630060013122 0ustar timhusers#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # 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 # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} ac_unique_file="pxe.cc" # Initialize some variables set by options. ac_init_help= ac_init_version=false # 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. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_prev= 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 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -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 | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$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 ;; -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 ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) 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) 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 ;; -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=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 ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && 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'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. build=$build_alias host=$host_alias target=$target_alias # FIXME: should be removed in autoconf 3.0. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe 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 # 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 its parent. ac_prog=$0 ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. 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 if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS # # 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 < if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. EOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue cd $ac_subdir # A "../" for each directory in /$ac_subdir. ac_dots=`echo $ac_subdir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` case $srcdir in .) # No --srcdir option. We are building in place. ac_sub_srcdir=$srcdir ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_sub_srcdir=$srcdir/$ac_subdir ;; *) # Relative path. ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; esac # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_sub_srcdir/configure.gnu; then echo $SHELL $ac_sub_srcdir/configure.gnu --help=recursive elif test -f $ac_sub_srcdir/configure; then echo $SHELL $ac_sub_srcdir/configure --help=recursive elif test -f $ac_sub_srcdir/configure.ac || test -f $ac_sub_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\EOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. EOF exit 0 fi exec 5>config.log cat >&5 </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` hostinfo = `(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` PATH = $PATH _ASUNAME } >&5 cat >&5 <\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" ac_sep=" " ;; esac # Get rid of the leading space. done # 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. trap 'exit_status=$? # Save into config.log some information that might help in debugging. echo >&5 echo "## ----------------- ##" >&5 echo "## Cache variables. ##" >&5 echo "## ----------------- ##" >&5 echo >&5 # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } >&5 sed "/^$/d" confdefs.h >conftest.log if test -s conftest.log; then echo >&5 echo "## ------------ ##" >&5 echo "## confdefs.h. ##" >&5 echo "## ------------ ##" >&5 echo >&5 cat conftest.log >&5 fi (echo; echo) >&5 test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" >&5 echo "$as_me: exit $exit_status" >&5 rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:841: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" 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. if test -f "$cache_file"; then { echo "$as_me:852: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:860: creating cache $cache_file" >&5 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 `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) { echo "$as_me:876: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:880: error: \`$ac_var' was not set in the previous run" >&5 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 { echo "$as_me:886: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:888: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:890: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. It doesn't matter if # we pass some twice (in addition to the command line arguments). if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:909: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:911: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if { (echo "$as_me:931: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:934: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else ac_path_separator=: fi PATH_SEPARATOR="$ac_path_separator" rm -f conftest.sh ac_config_headers="$ac_config_headers autoconf.h" 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 echo "$as_me:953: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:968: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:976: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:979: result: no" >&5 echo "${ECHO_T}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 echo "$as_me:988: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:1003: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1011: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1014: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC 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 echo "$as_me:1027: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:1042: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1050: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1053: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1062: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" echo "$as_me:1077: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1085: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1088: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" 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 echo "$as_me:1101: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:1121: found $ac_dir/$ac_word" >&5 break done 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 set dummy "$ac_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1143: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1146: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl 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 echo "$as_me:1157: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:1172: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1180: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1183: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:1196: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:1211: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1219: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1222: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:1234: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:1239:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:1242: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1245: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1247: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1250: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1252: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1255: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line 1259 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe" # 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. echo "$as_me:1275: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:1278: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1281: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. for ac_file in `ls a.exe conftest.exe 2>/dev/null; ls a.out conftest 2>/dev/null; ls a.* conftest.* 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1304: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:1310: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1315: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:1321: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1324: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1331: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:1339: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1346: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1348: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1351: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1353: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1356: \$? = $ac_status" >&5 (exit $ac_status); }; 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 `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:1372: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:1378: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:1384: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1390 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:1402: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1405: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1417: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:1424: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:1428: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1434 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1449: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1452: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1455: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1458: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:1470: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:1476: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1482 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1494: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1497: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1500: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1503: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:1513: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$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 # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1540: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1543: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1546: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1549: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line 1561 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1574: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1577: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1580: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1583: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line 1593 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1605: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1608: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1611: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1614: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 echo "$as_me:1646: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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. # 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 >conftest.$ac_ext <<_ACEOF #line 1667 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:1672: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1678: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 1701 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:1705: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1711: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f 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 echo "$as_me:1748: result: $CPP" >&5 echo "${ECHO_T}$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. # 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 >conftest.$ac_ext <<_ACEOF #line 1758 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:1763: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1769: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 1792 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:1796: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1802: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:1830: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } 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=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC 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 echo "$as_me:1851: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:1866: found $ac_dir/$ac_word" >&5 break done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:1874: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:1877: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:1890: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:1905: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:1913: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:1916: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:1928:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:1931: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1934: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1936: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1939: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1941: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1944: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:1947: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1953 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1968: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1971: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1974: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1977: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:1989: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:1995: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2001 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2013: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2016: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2019: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2022: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:2032: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line 2059 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2072: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2075: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2078: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2081: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line 2091 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2103: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2106: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2109: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2112: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h 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 echo "$as_me:2134: checking if the daemon should setuid to a non-privilaged user" >&5 echo $ECHO_N "checking if the daemon should setuid to a non-privilaged user... $ECHO_C" >&6 # Check whether --enable-setuid or --disable-setuid was given. if test "${enable_setuid+set}" = set; then enableval="$enable_setuid" echo "$as_me:2140: result: no." >&5 echo "${ECHO_T}no." >&6 cat >>confdefs.h <<\EOF #define NO_SUID 1 EOF else echo "$as_me:2148: result: yes." >&5 echo "${ECHO_T}yes." >&6 SETUID="\"nobody\"" # Check whether --with-setuid or --without-setuid was given. if test "${with_setuid+set}" = set; then withval="$with_setuid" SETUID="\"${withval}\"" fi; cat >>confdefs.h <&5 echo $ECHO_N "checking the location of the config file... $ECHO_C" >&6 PXECONFIGFILE="\"/etc/pxe.conf"\" # Check whether --with-config or --without-config was given. if test "${with_config+set}" = set; then withval="$with_config" PXECONFIGFILE="\"${withval}\"" fi; echo "$as_me:2172: result: $PXECONFIGFILE" >&5 echo "${ECHO_T}$PXECONFIGFILE" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking the location of the log file... $ECHO_C" >&6 PXELOGFILE="\"/tmp/pxe.log"\" # Check whether --with-log or --without-log was given. if test "${with_log+set}" = set; then withval="$with_log" PXELOGFILE="\"${withval}\"" fi; echo "$as_me:2187: result: $PXELOGFILE" >&5 echo "${ECHO_T}$PXELOGFILE" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2201 "configure" #include "confdefs.h" int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2213: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2216: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2219: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2222: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_main=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_socket_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2233: result: $ac_cv_lib_socket_main" >&5 echo "${ECHO_T}$ac_cv_lib_socket_main" >&6 if test $ac_cv_lib_socket_main = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2253 "configure" #include "confdefs.h" int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2265: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2268: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2271: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2274: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_main=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_nsl_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2285: result: $ac_cv_lib_nsl_main" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6 if test $ac_cv_lib_nsl_main = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for main in -lresolv... $ECHO_C" >&6 if test "${ac_cv_lib_resolv_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" cat >conftest.$ac_ext <<_ACEOF #line 2305 "configure" #include "confdefs.h" int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2317: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2320: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2323: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2326: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_resolv_main=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_resolv_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:2337: result: $ac_cv_lib_resolv_main" >&5 echo "${ECHO_T}$ac_cv_lib_resolv_main" >&6 if test $ac_cv_lib_resolv_main = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2355 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:2363: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2369: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line 2391 "configure" #include "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 >conftest.$ac_ext <<_ACEOF #line 2409 "configure" #include "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 >conftest.$ac_ext <<_ACEOF #line 2430 "configure" #include "confdefs.h" #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)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:2456: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2459: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:2461: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2464: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:2477: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi echo "$as_me:2487: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2493 "configure" #include "confdefs.h" #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2515: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2518: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2521: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2524: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:2534: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\EOF #define HAVE_SYS_WAIT_H 1 EOF fi for ac_header in fcntl.h strings.h sys/ioctl.h sys/time.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:2547: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2553 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:2557: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2563: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_ext fi echo "$as_me:2582: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2601 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:2605: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2611: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_ext fi echo "$as_me:2630: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line 2648 "configure" #include "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; } 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 # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:2697: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2700: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2703: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2706: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:2723: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:2726: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac echo "$as_me:2731: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2737 "configure" #include "confdefs.h" int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* 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"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 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; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2795: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2798: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2801: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2804: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:2814: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\EOF #define const EOF fi if test $ac_cv_c_compiler_gnu = yes; then echo "$as_me:2825: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF #line 2832 "configure" #include "confdefs.h" #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF #line 2847 "configure" #include "confdefs.h" #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi echo "$as_me:2860: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi echo "$as_me:2867: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2873 "configure" #include "confdefs.h" #include #include #ifdef signal # undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2895: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2898: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2901: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2904: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:2914: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2930 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2961: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2964: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2967: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2970: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:2980: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <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 overriden 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, don't put newlines in cache variables' values. # 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. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *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 \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" 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}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ 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[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:3070: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated automatically by configure. # 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 SHELL=\${CONFIG_SHELL-$SHELL} ac_cs_invocation="\$0 \$@" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } exec 6>&1 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\EOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -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 ." EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` shift set dummy "$ac_option" "$ac_optarg" ${1+"$@"} shift ;; -*);; *) # This is not an option, so the user has probably given explicit # arguments. ac_need_defaults=false;; esac case $1 in # Handling of the options. EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:3242: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) shift CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) shift CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # This is an error. -*) { { echo "$as_me:3261: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done exec 5>>config.log cat >&5 << _ACEOF ## ----------------------- ## ## Running config.status. ## ## ----------------------- ## This file was extended by $as_me 2.52, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS > $ac_cs_invocation on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF EOF cat >>$CONFIG_STATUS <<\EOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "autoconf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS autoconf.h" ;; *) { { echo "$as_me:3298: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; 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 # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. : ${TMPDIR=/tmp} { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } EOF cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@DEFS@,$DEFS,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t CEOF EOF cat >>$CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" EOF cat >>$CONFIG_STATUS <<\EOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` else ac_dir_suffix= ac_dots= fi case $srcdir in .) ac_srcdir=. if test -z "$ac_dots"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_dots$srcdir$ac_dir_suffix ac_top_srcdir=$ac_dots$srcdir ;; esac if test x"$ac_file" != x-; then { echo "$as_me:3499: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # 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 automatically by config.status. */ configure_input="Generated automatically from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:3517: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:3530: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done EOF cat >>$CONFIG_STATUS <<\EOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:3590: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:3601: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:3614: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in EOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\EOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end EOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #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. cat >>conftest.undefs <<\EOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, EOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # egrep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\EOF # 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 automatically by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated automatically by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then { echo "$as_me:3731: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } fi rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done EOF cat >>$CONFIG_STATUS <<\EOF { (exit 0); exit 0; } EOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # 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=: exec 5>/dev/null $SHELL $CONFIG_STATUS || 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 || { (exit 1); exit 1; } fi pxe-1.4.2/pxe.cc0100644000175000017500000002076307617210576012325 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * pxe.c - a pxe server, made better than intel's hack * ******************************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include "sock.h" #include "logfile.h" #include "packetstore.h" #include "options.h" #include "sysexception.h" #include "posix_signal.h" #include "autoconf.h" int service_requests=1; int watchchld = 1; #define BUFFER_SZ 2048 /* * can only bind to one address, otherwise multicast is inherently * messed up. There were big problems with the multicast address * as it can only send multicast when bound to 0.0.0.0 */ /****************************************************************************** * Usage - show the usage and exit * ******************************************************************************/ void Usage(char *progname) { std::cerr << "Usage: " << progname << " [-c ] [-d]\n"; std::cerr << "Tim Hurman (kano@kano.org.uk) " << __DATE__ << "\n"; exit(1); } /****************************************************************************** * HandleSig - handle some standard signals * ******************************************************************************/ void HandleSig(int signo) { service_requests=0; } /****************************************************************************** * HandleSigChld - handle the death of a child * ******************************************************************************/ void HandleSigChld(int signo) { int status; while(waitpid(-1, &status, WNOHANG) > 0) watchchld = 0; } /****************************************************************************** * StartPxeService - service incoming pxe requests * ******************************************************************************/ int StartPxeService(const char *configfile) { LogFile logger; Options *opts = NULL; Sock *connection = NULL; Signal sig(&logger); PacketStore request(&logger); PacketStore reply(&logger); PacketStore test(&logger); int retval = 0; int recvlen; char *buf; struct sockaddr_in server_addr, client_addr; bootp_packet_t *pkt; // register some signal handlers sig.Set(SIGINT, HandleSig); sig.Set(SIGTERM, HandleSig); sig.Set(SIGHUP, (void(*)(int))SIG_IGN); // assign memory buf = new char[BUFFER_SZ]; // read the config file std::cout << "Opening " << configfile << "\n"; try { opts = new Options(&logger, configfile); } catch (SysException *e) { std::cerr << "An error occurred, please check the logfile\n"; if(e->HaveMessage()) logger.Event(LEVEL_FATAL, e->GetWhere(), 1, e->GetMessage()); else logger.Event(LEVEL_FATAL, e->GetWhere(), 1, strerror(e->GetErrno())); delete e; retval = 1; goto MainCleanup; } // open the socket try { connection = new Sock(&logger, opts->GetInterface(), opts->GetPort()); connection->SetDefAddr(opts->GetDefAddr()); if(opts->UseBroadcast()) connection->AllowBroadcast(); if(opts->UseMulticast()) connection->JoinMulticast(opts->GetMulticast()); } catch (SysException *e) { std::cerr << "An error occurred, please check the logfile\n"; if(e->HaveMessage()) logger.Event(LEVEL_FATAL, e->GetWhere(), 1, e->GetMessage()); else logger.Event(LEVEL_FATAL, e->GetWhere(), 1, strerror(e->GetErrno())); delete e; retval = 1; goto MainCleanup; } // receive packets while(service_requests) { try { // blank the reply socket reply.Initalise(); request.Initalise(); // need try statement recvlen = connection->Read((unsigned char*)buf, BUFFER_SZ, &client_addr, &server_addr); if(recvlen <= 0) goto service_requests_next; // parse the request request.ReadPacket((unsigned char*)buf, recvlen); request.SetAddress(&client_addr); std::cout << "\n---Request---\n" << request << "\n"; if(reply.MakeReply(request, opts, &server_addr) == -1) goto service_requests_next; // print the packet std::cout << "\n---Reply---\n\n" << reply << "\n"; pkt = reply.PackPacket(); // send the packet back to the client connection->Send((unsigned char*)pkt->data, pkt->len, &client_addr, &server_addr); delete [] pkt->data; delete pkt; service_requests_next: recvlen=recvlen; } catch (SysException *e) { std::cerr << "An error occurred, please check the logfile\n"; if(e->HaveMessage()) logger.Event(LEVEL_FATAL, e->GetWhere(), 1, e->GetMessage()); else logger.Event(LEVEL_FATAL, e->GetWhere(), 1, strerror(e->GetErrno())); delete e; retval = 1; } } // tidy up and exit MainCleanup: if(opts != NULL) delete opts; if(connection != NULL) delete connection; delete[] buf; unlink(LOCKFILE); return(retval); } /****************************************************************************** * main - kick things off and do cool things * ******************************************************************************/ int main(int argc, char **argv) { int chk; char pidnum[8]; int _debug, c, errflg; const char *configfile=PXECONFIGFILE; std::fstream debug; errflg = _debug = 0; // get the command line opts while ((c = getopt(argc, argv, "dc:")) != EOF) switch(c) { case 'c': configfile = optarg; break; case 'd': _debug = 1; break; default: errflg++; } // errors? if(errflg) Usage(argv[0]); // check the config file exists debug.open(configfile, std::ios::in); if (!debug.is_open()) { std::cerr << "Unable to open the config file\n"; exit (1); } debug.close(); // redirect the file descriptors if (0 == _debug) { debug.open("/dev/null", std::ios::out); std::cout.rdbuf(debug.rdbuf()); std::cerr.rdbuf(debug.rdbuf()); debug.close(); debug.open("/dev/zero", std::ios::in); std::cin.rdbuf(debug.rdbuf()); debug.close(); } // set the UID/GID to a low user #ifndef NO_SUID struct passwd *pw; pw = getpwnam(SETUID); if(NULL == pw) std::cout << "Unable to find passwd entry for " << SETUID << ", continuing with user id " << getuid() << "\n"; else { if((-1 == setgid(pw->pw_gid)) || (-1 == setegid(pw->pw_gid))) std::cout << "Unable to change group id, continuing with group id " << getgid() << "\n"; if((-1 == setuid(pw->pw_uid)) || (-1 == seteuid(pw->pw_uid))) std::cout << "Unable to change user id, continuing with user id " << getuid() << "\n"; } #endif // check to see if the daemon is already running chk = open(LOCKFILE, O_WRONLY|O_CREAT|O_EXCL, 0644); if(-1 == chk) { std::cerr << "PXE daemon already running\n"; return(-1); } // if not in debug mode, fork and go if (0 == _debug) { signal(SIGCHLD, SIG_IGN); // set up the daemon switch (fork()) { case -1: std::cerr << "Unable to fork child\n"; exit(-1); case 0: // become the process group session leader setsid(); // the second fork switch(fork()) { case -1: std::cerr << "Unable to fork child\n"; exit(-1); case 0: // change the working dir chdir("/"); // clear the mask umask(0); // write out the pid sprintf(pidnum, "%ld", (long)getpid()); if(write(chk, pidnum, strlen(pidnum)) != (ssize_t)strlen(pidnum)) { std::cerr << "Unable to write lockfile\n"; exit(-1); } close(chk); StartPxeService(configfile); exit(0); } exit(0); } } else { // debug StartPxeService(configfile); } return(0); } pxe-1.4.2/logfile.cc0100644000175000017500000000740707617210034013137 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * logfile.c - a sereis of general event logging procedures * ******************************************************************************/ #include "logfile.h" /****************************************************************************** * LogFile - constructor * ******************************************************************************/ LogFile::LogFile() { Open(PXELOGFILE); } /****************************************************************************** * LogFile - constructor * ******************************************************************************/ LogFile::LogFile(const char *filename) { Open(filename); } /****************************************************************************** * LogFile - constructor * ******************************************************************************/ LogFile::~LogFile() { Close(); } /****************************************************************************** * LogOpen - open a log file or die and exit painfully * ******************************************************************************/ void LogFile::Open(const char *filename) { /* open the file */ umask(077); logfile = new std::fstream(filename, std::ios::out|std::ios::app); if(logfile == NULL) { std::cerr << "Error: LogFile::Open:open(): " << strerror(errno) <<"\n"; exit(-1); } } /****************************************************************************** * LogClose - close the active lof file * ******************************************************************************/ void LogFile::Close(void) { logfile->flush(); logfile->close(); } /****************************************************************************** * LogEvent - log an event into the logfile * ******************************************************************************/ void LogFile::Event(int level, const char *where, int count, ...) { time_t currsecs; char *timestr; const char *error; int len; va_list argp; char *p; /* format date and message etc */ currsecs = time(0); timestr = asctime(localtime(&currsecs)); len = strlen(timestr); timestr[len-1] = ':'; switch(level) { case 1: error = LEVEL_INFO_C; break; case 2: error = LEVEL_ERR_C; break; case 3: error = LEVEL_EMRG_C; break; case 4: error = LEVEL_FATAL_C; break; default: error = " Unknown: "; break; } /* write info */ *logfile << timestr << " " << error << " " << where << ": "; /* send any extra args */ va_start(argp, count); for(len = 0; len < count; len++) { p = va_arg(argp, char *); *logfile << p << " "; } va_end(argp); *logfile << "\n"; logfile->flush(); } pxe-1.4.2/options.cc0100644000175000017500000004103407617216015013210 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * options.cc - read the config options from the file * ******************************************************************************/ #include "options.h" // global vars CSA_t CSA_types[CSA_MAX_TYPES] = { {0, "X86PC"}, {1, "PC98"}, {2, "IA64PC"}, {3, "DEC"}, {4, "ArcX86"}, {5, "ILC"}, {(uint16_t)-1, NULL} }; /****************************************************************************** * Options - constructor - read from the default file * ******************************************************************************/ Options::Options(LogFile *_log) { this->log = _log; ReadFile(PXECONFIGFILE); } /****************************************************************************** * Options - constructor - read from the specified file * ******************************************************************************/ Options::Options(LogFile *_log, const char *filename) { this->log = _log; ReadFile(filename); } /****************************************************************************** * Options - Deconstuctor * ******************************************************************************/ Options::~Options() { services_t *serv_ptr, *serv_prev; if(interface != NULL) delete[] interface; if(prompt != NULL) delete[] prompt; if(domain != NULL) delete[] domain; if(tftpdbase != NULL) delete[] tftpdbase; port = 0; // scan and delete options for(serv_ptr=serv_prev=serv_head; serv_ptr != NULL; ) { serv_prev = serv_ptr; serv_ptr = serv_ptr->next; delete[] serv_prev->filebase; delete[] serv_prev->menu_text; delete serv_prev; } serv_head = NULL; } /****************************************************************************** * ReadFile - read the config file * ******************************************************************************/ void Options::ReadFile(const char *filename) { std::fstream *fp; int len; char *key,*val; struct in_addr t_addr; int key_id = 1; char *buf; // initalise vars buf = new char[1024]; tftpdbase = new char[strlen(TFTPD_BASE)+1]; strcpy(tftpdbase, TFTPD_BASE); domain = new char[strlen(DEF_DOMAIN)+1]; strcpy(domain, DEF_DOMAIN); prompt = new char[strlen(DEF_PROMPT)+1]; strcpy(prompt, DEF_PROMPT); interface = NULL; multicast_address = DEF_MULTI_BOOT; mtftp_address = DEF_MTFTP_ADDR; mtftp_cport = DEF_MTFTP_CPORT; mtftp_sport = DEF_MTFTP_SPORT; port = DEF_PORT; prompt_timeout = DEF_PROMPT_TIMEOUT; default_address = 0; use_multicast = use_broadcast = 1; serv_head = NULL; fp = new std::fstream(filename, std::ios::in); if(fp == NULL) throw new SysException(errno, "Options::ReadFile:fopen()"); while(fp->getline(buf, 1024)) { len = strlen(buf)-1; if(-1 == len) goto Options_ReadFile_next; for(; len > 0; len--) if((buf[len] != '\n') && (buf[len] != '\r')) { len++; break; } buf[len] = 0; if((buf[0] == ' ') || (buf[0] == '#') || (buf[0] == 0)) goto Options_ReadFile_next; // examine the string contents key = strtok(buf, "="); if(key == NULL) goto Options_ReadFile_next; val = strtok(NULL, "="); if(val == NULL) goto Options_ReadFile_next; // examine key if(strcmp("interface", key) == 0) { if (NULL != interface) delete interface; interface = new char[strlen(val)+1]; strcpy(interface, val); } else if(strcmp("prompt", key) == 0) { delete prompt; prompt = new char[strlen(val)+1]; strcpy(prompt, val); } else if(strcmp("listen_port", key) == 0) { port = atoi(val); } else if(strcmp("use_multicast", key) == 0) { use_multicast = atoi(val); } else if(strcmp("use_broadcast", key) == 0) { use_broadcast = atoi(val); } else if(strcmp("multicast_address", key) == 0) { t_addr.s_addr = 0; #ifdef HAVE_INET_ATON if(0 == inet_aton(val, &t_addr)) #else t_addr.s_addr = inet_addr(val); if((unsigned)-1 == t_addr.s_addr) #endif // HAVE_INET_ATON t_addr.s_addr = DEF_MTFTP_ADDR; multicast_address = ntohl(t_addr.s_addr); } else if(strcmp("domain", key) == 0) { delete domain; domain = new char[strlen(val)+1]; strcpy(domain, val); } else if(strcmp("tftpdbase", key) == 0) { delete tftpdbase; tftpdbase = new char[strlen(val)+1]; strcpy(tftpdbase, val); } else if(strcmp("service", key) == 0) { AddService(val, &key_id); } else if(strcmp("mtftp_address", key) == 0) { t_addr.s_addr = 0; #ifdef HAVE_INET_ATON if(0 == inet_aton(val, &t_addr)) #else t_addr.s_addr = inet_addr(val); if((unsigned)-1 == t_addr.s_addr) #endif // HAVE_INET_ATON t_addr.s_addr = htonl(DEF_MTFTP_ADDR); mtftp_address = ntohl(t_addr.s_addr); } else if(strcmp("mtftp_client_port", key) == 0) { mtftp_cport = atoi(val); if(mtftp_cport == 0) mtftp_cport = DEF_MTFTP_CPORT; } else if(strcmp("mtftp_server_port", key) == 0) { mtftp_sport = atoi(val); if(mtftp_sport == 0) mtftp_sport = DEF_MTFTP_SPORT; } else if(strcmp("prompt_timeout", key) == 0) { prompt_timeout = atoi(val); if((0 == prompt_timeout) && (EINVAL == errno)) prompt_timeout = DEF_PROMPT_TIMEOUT; } else if(strcmp("default_address", key) == 0) { t_addr.s_addr = 0; #ifdef HAVE_INET_ATON if(0 == inet_aton(val, &t_addr)) #else t_addr.s_addr = inet_addr(val); if((unsigned)-1 == t_addr.s_addr) #endif // HAVE_INET_ATON t_addr.s_addr = DEF_MTFTP_ADDR; default_address = ntohl(t_addr.s_addr); } else { log->Event(LEVEL_ERR, "Options::ReadFile", 2, "Unknown key:", key); } Options_ReadFile_next: fp = fp; } fp->close(); delete[] buf; } /****************************************************************************** * GetInterface - get the interface name * ******************************************************************************/ char * Options::GetInterface() { return(interface); } /****************************************************************************** * GetPort - return the port number * ******************************************************************************/ uint16_t Options::GetPort() { return(port); } /****************************************************************************** * UseMulticast - shall we use multicast discovery * ******************************************************************************/ int Options::UseMulticast() { return(use_multicast); } /****************************************************************************** * UseBroadcast - shall we use broadcast discovery * ******************************************************************************/ int Options::UseBroadcast() { return(use_broadcast); } /****************************************************************************** * GetMulticast - return the multicast address specified * ******************************************************************************/ uint32_t Options::GetMulticast() { return(multicast_address); } /****************************************************************************** * AddService - add a service to the list * ******************************************************************************/ void Options::AddService(char *serviceinfo, int *key_id) { services_t *serv_ptr, *serv_tail, *serv_prev; char *ptr; int i; ptr = strtok(serviceinfo, ","); if(ptr == NULL) { log->Event(LEVEL_ERR, "AddService:parse", 1, "Invalid service declaration"); return; } // see if it is a recognised CSA for(i=0; ((CSA_types[i].arch_name != NULL) && (strcmp(CSA_types[i].arch_name, ptr) != 0)); i++); // valid CSA? if(CSA_types[i].arch_name == NULL) { log->Event(LEVEL_ERR, "AddService:parse", 1, "Unknown client system architecture"); return; } // assign the info serv_ptr = new services_t; serv_ptr->csa = CSA_types[i].arch_id; // min layer ptr = strtok(NULL, ","); if(ptr == NULL) { log->Event(LEVEL_ERR, "AddService:parse", 1, "Invalid service declaration"); delete serv_ptr; return; } serv_ptr->min_level = atoi(ptr); // max layer ptr = strtok(NULL, ","); if(ptr == NULL) { log->Event(LEVEL_ERR, "AddService:parse", 1, "Invalid service declaration"); delete serv_ptr; return; } serv_ptr->max_level = atoi(ptr); // basename ptr = strtok(NULL, ","); if(ptr == NULL) { log->Event(LEVEL_ERR, "AddService:parse", 1, "Invalid service declaration"); delete serv_ptr; return; } serv_ptr->filebase = new char[strlen(ptr)+1]; strcpy(serv_ptr->filebase, ptr); // menu entry ptr = strtok(NULL, "\0"); if(ptr == NULL) { log->Event(LEVEL_ERR, "AddService:parse", 1, "Invalid service declaration"); delete[] serv_ptr->filebase; delete serv_ptr; return; } if(strlen(ptr) > 255) { log->Event(LEVEL_ERR, "AddService:parse", 1, "Menu item too long"); delete[] serv_ptr->filebase; delete serv_ptr; return; } serv_ptr->menu_text = new char[strlen(ptr)+1]; strcpy(serv_ptr->menu_text, ptr); if(strcmp(serv_ptr->filebase, "local") == 0) serv_ptr->menu_id = 0; else { serv_ptr->menu_id = *key_id; (*key_id)++; } // find the tail of the list for(serv_prev=serv_tail=serv_head; serv_tail != NULL; serv_tail=serv_tail->next) serv_prev = serv_tail; // append + sort out minor faults if(serv_tail == serv_prev) // on head serv_head = serv_ptr; else serv_prev->next = serv_ptr; // end of list serv_ptr->next = NULL; } /****************************************************************************** * GetMTFTPAddr - return the multicast address of the mtftp daemon * ******************************************************************************/ uint32_t Options::GetMTFTPAddr() { return(mtftp_address); } /****************************************************************************** * GetMTFTPAddr - return the multicast address of the mtftp daemon * ******************************************************************************/ uint32_t Options::GetDefAddr() { return(default_address); } /****************************************************************************** * GetMTFTPsport - return the multicast server port of the mtftp daemon * ******************************************************************************/ uint16_t Options::GetMTFTPsport() { return(mtftp_sport); } /****************************************************************************** * GetMTFTPcport - return the multicast client port of the mtftp daemon * ******************************************************************************/ uint16_t Options::GetMTFTPcport() { return(mtftp_cport); } /****************************************************************************** * GetMenuTimeout - return the amount of time the boot menu is shown for * ******************************************************************************/ uint8_t Options::GetMenuTimeout() { return(prompt_timeout); } /****************************************************************************** * GetMenuPrompt - return the menu string * ******************************************************************************/ char * Options::GetMenuPrompt() { char *c = new char[strlen(prompt)+1]; strcpy(c, prompt); return(c); } /****************************************************************************** * CheckMenu - check to see if there is a menu item for a specific CSA * ******************************************************************************/ uint16_t Options::CheckMenu(uint16_t reqcsa) { services_t *serv_ptr; serv_ptr = serv_head; while(NULL != serv_ptr) { if(serv_ptr->csa == reqcsa) return(serv_ptr->csa); serv_ptr = serv_ptr->next; } return((uint16_t)-1); } /****************************************************************************** * MakeBootMenu - make the option for the boot menu * ******************************************************************************/ option * Options::MakeBootMenu(int csa, int *arch_id, int *menu_id) { int i,j; uint16_t menu_id_n; int count = 0; services_t *serv_ptr; option *opt = new option; opt->len = i = 0; // work out how much memory we need serv_ptr = serv_head; while(NULL != serv_ptr) { if(serv_ptr->csa == csa) opt->len += strlen(serv_ptr->menu_text)+3; serv_ptr = serv_ptr->next; } opt->data = new uint8_t[opt->len]; // copy the menu items serv_ptr = serv_head; while(NULL != serv_ptr) { if(serv_ptr->csa == csa) { menu_id_n = htons(serv_ptr->menu_id); memcpy(opt->data+i, &menu_id_n, 2); i += 2; j = strlen(serv_ptr->menu_text); opt->data[i] = j; i++; memcpy(opt->data+i, serv_ptr->menu_text, j); i += j; if(0 == count) { *arch_id = serv_ptr->csa; *menu_id = serv_ptr->menu_id; } count++; } serv_ptr = serv_ptr->next; } // last check if(0 == opt->len) return(NULL); return(opt); } /****************************************************************************** * GetMinLayer - get the lowest layer for this item * ******************************************************************************/ uint8_t Options::GetMinLayer(int arch_id, int menu_id) { services_t *serv_ptr; serv_ptr = serv_head; while(NULL != serv_ptr) { if((menu_id == serv_ptr->menu_id) && (arch_id == serv_ptr->csa)) break; serv_ptr = serv_ptr->next; } if(NULL == serv_ptr) return(0); return(serv_ptr->min_level); } /****************************************************************************** * GetMaxLayer - get the highest layer for this item * ******************************************************************************/ uint8_t Options::GetMaxLayer(int arch_id, int menu_id) { services_t *serv_ptr; serv_ptr = serv_head; while(NULL != serv_ptr) { if((menu_id == serv_ptr->menu_id) && (arch_id == serv_ptr->csa)) break; serv_ptr = serv_ptr->next; } if(NULL == serv_ptr) return(0); return(serv_ptr->max_level); } /****************************************************************************** * MakeFilename - make the boot filename for a specific arch/layer * ******************************************************************************/ char * Options::MakeFilename(int menu_id, int arch_id, uint8_t layer) { services_t *serv_ptr; char *tmpc; int i; serv_ptr = serv_head; while(NULL != serv_ptr) { if((menu_id == serv_ptr->menu_id) && (arch_id == serv_ptr->csa)) break; serv_ptr = serv_ptr->next; } if(NULL == serv_ptr) return(NULL); if((layer < serv_ptr->min_level) || (serv_ptr->max_level < layer)) return(NULL); // search for the arch name for(i=0; i != CSA_types[i].arch_id; i++); tmpc = new char[strlen(CSA_types[i].arch_name) + (strlen(serv_ptr->filebase)*2) + 8]; sprintf(tmpc, "%s/%s/%s.%d", CSA_types[i].arch_name, serv_ptr->filebase, serv_ptr->filebase, layer); return(tmpc); } /****************************************************************************** * CheckLayer - see if the layer requested is withing the valid range * ******************************************************************************/ int Options::CheckLayer(int menu_id, int arch_id, uint8_t layer) { services_t *serv_ptr; serv_ptr = serv_head; while(NULL != serv_ptr) { if((menu_id == serv_ptr->menu_id) && (arch_id == serv_ptr->csa)) break; serv_ptr = serv_ptr->next; } if(NULL == serv_ptr) return(-1); if((layer < serv_ptr->min_level) || (serv_ptr->max_level < layer)) return(-1); return(0); } pxe-1.4.2/options.h0100644000175000017500000000553407531171537013063 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * options.h - read the config options from the file * ******************************************************************************/ #ifndef _OPTIONS_H #define _OPTIONS_H #include #include #include #include #include #include #include #include #include "autoconf.h" #include "sysexception.h" #include "logfile.h" struct _services { int csa; uint8_t min_level; uint8_t max_level; uint16_t menu_id; char *filebase; char *menu_text; struct _services *next; }; typedef struct _services services_t; struct _CSA { uint16_t arch_id; const char *arch_name; }; typedef struct _CSA CSA_t; #define CSA_MAX_TYPES 7 extern CSA_t CSA_types[CSA_MAX_TYPES]; struct _option { uint8_t major_no; uint8_t minor_no; uint8_t len; uint8_t *data; struct _option *next; }; typedef struct _option option; class Options { private: char *interface; char *prompt; uint8_t prompt_timeout; uint32_t multicast_address; char *domain; char *tftpdbase; uint16_t port; unsigned char use_multicast; unsigned char use_broadcast; services_t *serv_head; uint16_t mtftp_cport; uint16_t mtftp_sport; uint32_t mtftp_address; uint32_t default_address; LogFile *log; public: Options(LogFile *); Options(LogFile *, const char *); ~Options(); char *GetInterface(); uint16_t GetPort(); int UseMulticast(); int UseBroadcast(); uint32_t GetMulticast(); uint32_t GetMTFTPAddr(); uint16_t GetMTFTPsport(); uint16_t GetMTFTPcport(); uint32_t GetDefAddr(); uint8_t GetMenuTimeout(); char *GetMenuPrompt(); uint16_t CheckMenu(uint16_t); option *MakeBootMenu(int, int *, int *); uint8_t GetMinLayer(int, int); uint8_t GetMaxLayer(int, int); char *MakeFilename(int, int, uint8_t); int CheckLayer(int, int, uint8_t); private: void ReadFile(const char *); void AddService(char *, int *); }; #endif pxe-1.4.2/configure.in0100644000175000017500000000334107533630041013512 0ustar timhusersdnl Process this file with autoconf to produce a configure script. AC_INIT(pxe.cc) AC_CONFIG_HEADER(autoconf.h) AC_PROG_CC AC_PROG_CPP AC_PROG_CXX dnl Checks for programs. dnl Checks for user options. dnl setuid? AC_MSG_CHECKING(if the daemon should setuid to a non-privilaged user) AC_ARG_ENABLE(setuid, [ --disable-setuid disable the setuid facility], [ AC_MSG_RESULT(no.) AC_DEFINE(NO_SUID) ], [ AC_MSG_RESULT(yes.) SETUID="\"nobody\"" AC_ARG_WITH(setuid, [ --with-setuid=user name of the user to setuid to], [ SETUID="\"${withval}\"" ]) AC_DEFINE_UNQUOTED(SETUID, $SETUID) ] ) dnl location of the config file AC_MSG_CHECKING(the location of the config file) PXECONFIGFILE="\"/etc/pxe.conf"\" AC_ARG_WITH(config, [ --with-config=file location of the pxe config file], [ PXECONFIGFILE="\"${withval}\"" ]) AC_MSG_RESULT($PXECONFIGFILE) AC_DEFINE_UNQUOTED(PXECONFIGFILE, $PXECONFIGFILE) dnl location of the config file AC_MSG_CHECKING(the location of the log file) PXELOGFILE="\"/tmp/pxe.log"\" AC_ARG_WITH(log, [ --with-log=file location of the pxe log file], [ PXELOGFILE="\"${withval}\"" ]) AC_MSG_RESULT($PXELOGFILE) AC_DEFINE_UNQUOTED(PXELOGFILE, $PXELOGFILE) dnl Checks for libraries. AC_HAVE_LIBRARY(socket) AC_HAVE_LIBRARY(nsl) AC_HAVE_LIBRARY(resolv) dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h strings.h sys/ioctl.h sys/time.h unistd.h) AC_CHECK_HEADERS(sys/sockio.h stdint.h stropts.h ifaddrs.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL AC_CHECK_FUNCS(select socket strerror setsockopt getifaddrs hstrerror inet_aton) AC_OUTPUT(Makefile) pxe-1.4.2/pxe.conf0100644000175000017500000000126407617233547012663 0ustar timhusers# which interface to use interface=eth0 default_address=172.28.31.2 # the multicast ip address to listen on multicast_address=224.0.1.2 # mtftp info mtftp_address=224.1.5.1 mtftp_client_port=1758 mtftp_server_port=1759 # the port to listen on listen_port=4011 # enable multicast? use_multicast=1 # enable broadcast? use_broadcast=0 # user prompt prompt=Press F8 to view menu ... prompt_timeout=10 # what services to provide, priority in ordering # CSA = Client System Architecture # service=,,,, service=X86PC,0,0,local,Local boot service=X86PC,0,0,pxelinux,PXELinux # tftpd base dir tftpdbase=/tftpboot # domain name domain=bla.com pxe-1.4.2/sysexception.cc0100644000175000017500000000674707617216055014272 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * sysexception.cc - exceptions class for pxe daemon * ******************************************************************************/ #include "sysexception.h" /****************************************************************************** * SysException - constructor for exception * ******************************************************************************/ SysException::SysException(const int err, const char *location) { local_errno = err; loc = new char[strlen(location)+1]; strcpy(loc, location); mess = NULL; } /****************************************************************************** * SysException - constructor for exception * ******************************************************************************/ SysException::SysException(const int err, const char *location, const char *message) { local_errno = err; loc = new char[strlen(location)+1]; strcpy(loc, location); mess = new char[strlen(message)+1]; strcpy(mess, message); } /****************************************************************************** * SysException - deconstuctor for exception * ******************************************************************************/ SysException::~SysException() { local_errno = 0; delete[] loc; if(mess != NULL) delete[] mess; } /****************************************************************************** * HaveMessage - check is a message is present * ******************************************************************************/ int SysException::HaveMessage() { if(mess != NULL) return(1); else return(0); } /****************************************************************************** * GetWhere - return where the exception occurred * ******************************************************************************/ char * SysException::GetWhere() { return(loc); } /****************************************************************************** * GetMessage - return the message (if any) * ******************************************************************************/ char * SysException::GetMessage() { return(mess); } /****************************************************************************** * GetErrno - return the errno that occurred * ******************************************************************************/ int SysException::GetErrno() { return(local_errno); } pxe-1.4.2/sysexception.h0100644000175000017500000000300107527135563014114 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * sysexception.h - exceptions class for pxe daemon * ******************************************************************************/ #ifndef _SYSEXCEPTION_H #define _SYSEXCEPTION_H #include #include #include #include class SysException { private: int local_errno; char *loc; char *mess; public: SysException(const int err, const char *loc); SysException(const int err, const char *loc, const char *message); ~SysException(); int HaveMessage(); char *GetWhere(); char *GetMessage(); int GetErrno(); }; #endif pxe-1.4.2/packetstore.h0100644000175000017500000000626207531172446013713 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * packetstore.h - decode and store a packet in memory * ******************************************************************************/ #ifndef _PACKETSTORE_H #define _PACKETSTORE_H #include #include #include #include #include #include #include "options.h" #include "logfile.h" #include "sysexception.h" #include "autoconf.h" #define BOOTREQUEST 1 #define BOOTREPLY 2 #define DHCPDISCOVER 1 #define DHCPOFFER 2 #define DHCPREQUEST 3 #define DHCPDECLINE 4 #define DHCPACK 5 #define DHCPNACK 6 #define DHCPRELEASE 7 #define DHCPINFORM 8 #define MAGIC_COOKIE 0x63825363 #define DHCP_MAX_TYPES 9 extern const char *DHCP_types[DHCP_MAX_TYPES]; // some more defines #define DISABLE_MULTICAST 0x40 #define DISABLE_BROADCAST 0x80 // structs struct bootp_packet { int len; uint8_t *data; }; typedef struct bootp_packet bootp_packet_t; // the main class class PacketStore { protected: // all multibyte values are stored // in network byte order internally uint8_t op; uint8_t htype; uint8_t hlen; uint8_t hops; uint32_t xid; uint16_t secs; struct in_addr ciaddr; struct in_addr yiaddr; struct in_addr siaddr; struct in_addr giaddr; uint8_t chaddr[16]; char sname[64]; char file[128]; uint32_t magic_cookie; option *head; option *head43; struct sockaddr_in address; LogFile *logger; public: PacketStore(LogFile *); PacketStore(LogFile *, struct sockaddr_in *, uint8_t *, int); ~PacketStore(); option *operator () (int , int); int DelOption(int , int); int AddOption(const option *); void Initalise(void); void SetAddress(const struct sockaddr_in *); friend std::ostream& operator<< (std::ostream&, PacketStore&); int ReadPacket(uint8_t *, int); int MakeReply(PacketStore &, Options *, struct sockaddr_in *); bootp_packet_t *PackPacket(void); uint16_t GetCSA(); private: uint16_t checkCSA(uint16_t); option *GetOption(int, int); int ReadOptions(uint8_t *bootp_pkt, int bootp_pkt_len); int ReadOptions43(uint8_t *bootp_pkt, int bootp_pkt_len); uint16_t htois(uint16_t); uint32_t htoil(uint32_t); // generate reply options int GenOpt43(Options *, int, PacketStore &, int); int GenOpt54(void); int GenOpt60(void); }; #endif pxe-1.4.2/packetstore.cc0100644000175000017500000006643507716176215014064 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * packetstore.cc - decode and store a packet in memory * ******************************************************************************/ #include "packetstore.h" /* some global variables */ const char *DHCP_types[DHCP_MAX_TYPES] = { "INVALID", "DHCPDISCOVER", "DHCPOFFER", "DHCPREQUEST", "DHCPDECLINE", "DHCPACK", "DHCPNACK", "DHCPRELEASE", "DHCPINFORM" }; /****************************************************************************** * PacketStore - null packet constructor * ******************************************************************************/ PacketStore::PacketStore(LogFile *_logger) { this->logger = _logger; head = head43 = NULL; Initalise(); } /****************************************************************************** * PacketStore - full packet analyse * ******************************************************************************/ PacketStore::PacketStore(LogFile *_logger, struct sockaddr_in *_address, uint8_t *bootp_pkt, int bootp_pkt_len) { this->logger = _logger; memcpy(&(this->address), _address, sizeof(this->address)); ReadPacket(bootp_pkt, bootp_pkt_len); } /****************************************************************************** * ~PacketStore - descructor * ******************************************************************************/ PacketStore::~PacketStore() { Initalise(); } /****************************************************************************** * Initalise - init/blank a packet * ******************************************************************************/ void PacketStore::Initalise(void) { option *optptr, *optnext; // basic stuff op=htype=hlen=hops=0; secs=0; xid=0; memset(chaddr, 0, 16); sname[0] = file[0] = 0; magic_cookie = 0; memset(&ciaddr, 0, sizeof(ciaddr)); memset(&yiaddr, 0, sizeof(yiaddr)); memset(&siaddr, 0, sizeof(siaddr)); memset(&giaddr, 0, sizeof(giaddr)); memset(&address, 0, sizeof(giaddr)); // options for(optptr=head; optptr != NULL; optptr=optnext) { optnext = optptr->next; delete[] optptr->data; delete optptr; } head = NULL; // options 43 for(optptr=head43; optptr != NULL; optptr=optnext) { optnext = optptr->next; delete[] optptr->data; delete optptr; } head43 = NULL; } /****************************************************************************** * ReadPacket - read a bootp packet * ******************************************************************************/ int PacketStore::ReadPacket(uint8_t *bootp_pkt, int bootp_pkt_len) { if(bootp_pkt_len < 300) throw new SysException(0, "PacketStore::ReadPacket", "Invalid packet length"); op = bootp_pkt[0]; htype = bootp_pkt[1]; hlen = bootp_pkt[2]; hops = bootp_pkt[3]; // xid - store in network byte order xid = bootp_pkt[4]; xid <<= 8; xid |= bootp_pkt[5]; xid <<= 8; xid |= bootp_pkt[6]; xid <<= 8; xid |= bootp_pkt[7]; xid = htonl(xid); // no of secs secs = bootp_pkt[8]; secs <<= 8; secs |= bootp_pkt[9]; secs = htons(secs); // client IP addr (filled in by client) ciaddr.s_addr = bootp_pkt[12]; ciaddr.s_addr <<= 8; ciaddr.s_addr |= bootp_pkt[13]; ciaddr.s_addr <<= 8; ciaddr.s_addr |= bootp_pkt[14]; ciaddr.s_addr <<= 8; ciaddr.s_addr |= bootp_pkt[15]; ciaddr.s_addr = htonl(ciaddr.s_addr); // client IP addr (filled in by server) yiaddr.s_addr = bootp_pkt[16]; yiaddr.s_addr <<= 8; yiaddr.s_addr |= bootp_pkt[17]; yiaddr.s_addr <<= 8; yiaddr.s_addr |= bootp_pkt[18]; yiaddr.s_addr <<= 8; yiaddr.s_addr |= bootp_pkt[19]; yiaddr.s_addr = htonl(yiaddr.s_addr); // server IP address (filled in by server) siaddr.s_addr = bootp_pkt[20]; siaddr.s_addr <<= 8; siaddr.s_addr |= bootp_pkt[21]; siaddr.s_addr <<= 8; siaddr.s_addr |= bootp_pkt[22]; siaddr.s_addr <<= 8; siaddr.s_addr |= bootp_pkt[23]; siaddr.s_addr = htonl(siaddr.s_addr); // gateway IP address giaddr.s_addr = bootp_pkt[24]; giaddr.s_addr <<= 8; giaddr.s_addr |= bootp_pkt[25]; giaddr.s_addr <<= 8; giaddr.s_addr |= bootp_pkt[26]; giaddr.s_addr <<= 8; giaddr.s_addr |= bootp_pkt[27]; giaddr.s_addr = htonl(giaddr.s_addr); // client hardware address memcpy(chaddr, bootp_pkt+28, 16); // the servername if(bootp_pkt[107] != 0) throw new SysException(0, "PacketStore::ReadPacket", "Invalid servername"); strcpy(sname, (char*)bootp_pkt+44); // the file if(bootp_pkt[235] != 0) throw new SysException(0, "PacketStore::ReadPacket", "Invalid filename"); strcpy(file, (char*)bootp_pkt+108); // the magic cookie magic_cookie = bootp_pkt[236]; magic_cookie <<= 8; magic_cookie |= bootp_pkt[237]; magic_cookie <<= 8; magic_cookie |= bootp_pkt[238]; magic_cookie <<= 8; magic_cookie |= bootp_pkt[239]; magic_cookie = htonl(magic_cookie); if(bootp_pkt[236] == 0xff) return(0); // read the options head=head43=NULL; return(ReadOptions(bootp_pkt+240, bootp_pkt_len-240)); } /****************************************************************************** * print the packet to stdout * ******************************************************************************/ std::ostream& operator<< (std::ostream& os, PacketStore &pkt) { int i; option *optptr; // basic info os << "BOOTP type : " << (int)pkt.op << "\n"; os << "Hardware type : " << (int)pkt.htype << "\n"; os << "Hardware Length : " << (int)pkt.hlen << "\n"; os << "Hops : " << (int)pkt.hops << "\n"; os << "Transaction ID : 0x" << std::hex << ntohl(pkt.xid) << std::dec <<"\n"; os << "Seconds : " << ntohs(pkt.secs) << "\n"; os << "Client IP (From Client): " << inet_ntoa(pkt.ciaddr) << "\n"; os << "Client IP (From Server): " << inet_ntoa(pkt.yiaddr) << "\n"; os << "Server IP : " << inet_ntoa(pkt.siaddr) << "\n"; os << "Gateway IP : " << inet_ntoa(pkt.giaddr) << "\n"; os << "Client Hardware address: " ; // client hardware addr for(i=0; inext) { os << "Option major:" << (int)optptr->major_no << " minor: " << (int)optptr->minor_no << ", Length: " << (int)optptr->len << ", Data: "; for(i=0; ilen; i++) if((optptr->data[i] >0x20) && (optptr->data[i] < 0x7f)) os << "[" << (int)optptr->data[i] << "," << std::hex << (int)optptr->data[i] << std::dec << "," << (char)optptr->data[i] << "] "; else os << "[" << (int)optptr->data[i] << "," << std::hex << (int)optptr->data[i] << std::dec << ", ] "; os << "\n"; } if(pkt.head43 == NULL) return os; // option 43 os << "Options (sub-packed) :\n"; for(optptr = pkt.head43; optptr != NULL; optptr = optptr->next) { os << "Option [43] " << (int)optptr->major_no << " minor: " << (int)optptr->minor_no << ", Length: " << (int)optptr->len << ", Data: "; for(i=0; ilen; i++) if((optptr->data[i] >0x20) && (optptr->data[i] < 0x7f)) os << "[" << (int)optptr->data[i] << "," << std::hex << (int)optptr->data[i] << std::dec << "," << (char)optptr->data[i] << "] "; else os << "[" << (int)optptr->data[i] << "," << std::hex << (int)optptr->data[i] << std::dec << ", ] "; os << "\n"; } return os; } /****************************************************************************** * ReadOptions - read all the options contained within a packet * ******************************************************************************/ int PacketStore::ReadOptions(uint8_t *bootp_pkt, int bootp_pkt_len) { // everything will always be null here int pos; option *optptr = NULL; option *optprev = NULL; for(pos=0; pos < bootp_pkt_len; pos++) { if(bootp_pkt[pos] == 0) goto ReadOptions_next; // pad if(bootp_pkt[pos] == 255) break; // end options // lots of sub options if(bootp_pkt[pos] == 43) { ReadOptions43(bootp_pkt+pos+2, bootp_pkt[pos+1]); pos += bootp_pkt[pos+1]+1; goto ReadOptions_next; // next } // default optptr = new option; optptr->major_no = bootp_pkt[pos++]; optptr->minor_no = 0; optptr->len = bootp_pkt[pos++]; optptr->data = new uint8_t[optptr->len]; optptr->next = NULL; memcpy(optptr->data, bootp_pkt+pos, optptr->len); // increment pos, accounting to cyclic increment pos += (optptr->len-1); if(head != NULL) { optprev->next = optptr; // assign optprev = optprev->next; // advance } else optprev = head = optptr; ReadOptions_next: pos=pos; } return(0); } /****************************************************************************** * ReadOptions43 - read all the options contained within a packet * ******************************************************************************/ int PacketStore::ReadOptions43(uint8_t *bootp_pkt, int bootp_pkt_len) { // everything will always be null here int pos; option *optptr=NULL; option *optprev=NULL; for(pos=0; pos < bootp_pkt_len; pos++) { if(bootp_pkt[pos] == 0) goto ReadOptions43_next; // pad if(bootp_pkt[pos] == 255) break; // end options // lots of sub options if(bootp_pkt[pos] == 43) { std::cerr << "Option 43 detected\n"; break; } // default optptr = new option; optptr->major_no = 43; optptr->minor_no = bootp_pkt[pos++]; optptr->len = bootp_pkt[pos++]; optptr->data = new uint8_t[optptr->len]; optptr->next = NULL; memcpy(optptr->data, bootp_pkt+pos, optptr->len); // increment pos, accounting to cyclic increment pos += (optptr->len-1); if(head43 != NULL) { optprev->next = optptr; // assign optprev = optprev->next; // advance } else optprev = head43 = optptr; ReadOptions43_next: pos=pos; } return(0); } /****************************************************************************** * operator() - get an option from the list * ******************************************************************************/ option * PacketStore::operator()(int major_opt=0, int minor_opt=0) { return(GetOption(major_opt, minor_opt)); } /****************************************************************************** * GetOption - get an option fromthe option list * ******************************************************************************/ option * PacketStore::GetOption(int major_opt=0, int minor_opt=0) { option *opt = new option; option *optptr; if(major_opt == 43) optptr = head43; else optptr = head; for(; optptr != NULL; optptr = optptr->next) if((major_opt == optptr->major_no) && (minor_opt == optptr->minor_no)) break; if(optptr == NULL) return(NULL); opt->major_no = optptr->major_no; opt->minor_no = optptr->minor_no; opt->len = optptr->len; opt->next = NULL; opt->data = new uint8_t[opt->len]; memcpy(opt->data, optptr->data, opt->len); return(opt); } /****************************************************************************** * DelOption - delete an option from the list * ******************************************************************************/ int PacketStore::DelOption(int major_opt=0, int minor_opt=0) { option *optptr, *optprev; if(major_opt == 43) optptr = optprev = head43; else optptr = optprev = head; for(; ((major_opt != optptr->major_no) && (minor_opt != optptr->minor_no)) || (optptr != NULL); optptr = optptr->next) optprev = optptr; if(optptr != NULL) // option found { // re-arrange the pointers if(optprev == optptr) // head if(optptr == head43) head43 = optptr->next; else head = optptr->next; else optprev->next = optptr->next; // delete the memory delete[] optptr->data; delete optptr; } else return(1); // no found return(0); } /****************************************************************************** * AddOption - add an option to the list (overwrite) * ******************************************************************************/ int PacketStore::AddOption(const option *opt) { option *optptr, *optprev; if(opt->major_no == 43) optptr = optprev = head43; else optptr = optprev = head; // find the entry or null; while(optptr != NULL) { if((opt->major_no != optptr->major_no) && (opt->minor_no != optptr->minor_no)) break; optprev = optptr; optptr = optptr->next; } if(optptr == NULL) // new item { optptr = new option; optptr->major_no = opt->major_no; optptr->minor_no = opt->minor_no; optptr->next = NULL; if((43 == opt->major_no) && (NULL == head43)) head43 = optptr; else if(NULL == head) head = optptr; else optprev->next = optptr; } else // old item { delete[] optptr->data; } optptr->len = opt->len; optptr->data = new uint8_t[optptr->len]; memcpy(optptr->data, opt->data, opt->len); return(0); } /****************************************************************************** * htois - host to intel order (short) * ******************************************************************************/ uint16_t PacketStore::htois(uint16_t value) { uint8_t t1, t2; uint16_t val; // convert to a standard val = htons(value); // check if we need to go any further // since Intel order != network order if(val != value) return(value); // we now have a standard, can you read this Intel?, this is // STANDARD! // we know that Intel ordering is the opposite to network byte ordering // so just swap bytes all the way through // out t1 = (val & 0x00ff); t2 = (val & 0xff00) >> 8; // in val = (t1<<8); val |= t2; // we are now in a non-standard return val; } /****************************************************************************** * htoil - host to intel order (long) * ******************************************************************************/ uint32_t PacketStore::htoil(uint32_t value) { uint8_t t1, t2, t3, t4; uint32_t val; // convert to a standard val = htonl(value); // check if we need to go any further // since Intel order != network order if(val != value) return(value); // we now have a standard, can you read this Intel?, this is // STANDARD! // we know that Intel ordering is the opposite to network byte ordering // so just swap bytes all the way through // out t1 = (val & 0x000000ff); t2 = (val & 0x0000ff00) >> 8; t3 = (val & 0x00ff0000) >> 16; t4 = (val & 0xff000000) >> 24; // in val = (t1<<24); val |= (t2<<16); val |= (t3<<8); val |= (t4); return(val); } /****************************************************************************** * SetAddress - set the address fiel of the packet (from/to) * ******************************************************************************/ void PacketStore::SetAddress(const struct sockaddr_in *_address) { memcpy(&address, _address, sizeof(address)); } /****************************************************************************** * MakeReply - generate a reply to an incoming request * ******************************************************************************/ int PacketStore::MakeReply(PacketStore &request, Options *config, struct sockaddr_in *server_addr) { // local vars option *opt = NULL; option *req_list = NULL; int pkttype = 0; uint16_t reqCSA; // first, check for a valid bootp packet if(BOOTREQUEST != request.op) { logger->Event(LEVEL_INFO, "MakeReply", 1, "Packet is not a bootp request"); return(-1); } // valid client system arch? reqCSA = request.GetCSA(); if((uint16_t)-1 == reqCSA) { logger->Event(LEVEL_INFO, "MakeReply", 1, "packet contains an unknown client system architecture"); return(-1); } // see if there are any menus for this packet if((uint16_t)-1 == config->CheckMenu(reqCSA)) return(-1); // next, check what the packet type was opt = request(43,71); if(opt == NULL) { logger->Event(LEVEL_INFO, "MakeReply", 1, "Received proxy DHCP packet"); pkttype = 1; } else { delete[] opt->data; delete opt; logger->Event(LEVEL_INFO, "MakeReply", 1, "Received PXE request packet"); pkttype = 2; } // was it a valid request packet? opt = request(53); if((NULL == opt) || (DHCPREQUEST != opt->data[0])) { logger->Event(LEVEL_INFO, "MakeReply", 1, "Packet does not contain a valid DHCP message type"); return(-1); } opt->data[0] = DHCPACK; opt->len = 1; AddOption(opt); delete[] opt->data; delete opt; // is the param request list ok? req_list = request(55); if(NULL == req_list) { logger->Event(LEVEL_INFO, "MakeReply", 1, "No parameter request list found"); return(-1); } // good packet ok, build reply memset(file, 0, 128); memset(sname, 0, 64); // copy over the basic info op = BOOTREPLY; htype = request.htype; hlen = request.hlen; hops = request.hops; xid = request.xid; secs = request.secs; magic_cookie = htonl(MAGIC_COOKIE); // slightly harder memcpy(chaddr, request.chaddr, 16); memset(&ciaddr, 0, sizeof(ciaddr)); memset(&yiaddr, 0, sizeof(yiaddr)); memcpy(&siaddr, &(server_addr->sin_addr), sizeof(siaddr)); memset(&giaddr, 0, sizeof(yiaddr)); // set the destination address memcpy(&address, &(request.address), sizeof(address)); // good, now go through the option list for(int i=0; i < req_list->len; i++) switch(req_list->data[i]) { case 43: if(-1 == GenOpt43(config, reqCSA, request, pkttype)) return(-1); break; case 54: GenOpt54(); break; case 60: GenOpt60(); break; } return(0); } /****************************************************************************** * GenOpt43 - generate reply options * ******************************************************************************/ int PacketStore::GenOpt43(Options *config, int reqCSA, PacketStore &request, int pkttype) { option opt, *optptr; struct sockaddr_in t_addr; char *tmpc; int arch_id, menu_id; uint8_t req_layer; int tmpi; opt.major_no = 43; // Proxy DHCP packet if(1 == pkttype) { // minor 1 opt.minor_no = 1; t_addr.sin_addr.s_addr = htonl(config->GetMTFTPAddr()); opt.len = sizeof(t_addr.sin_addr.s_addr); opt.data = new uint8_t[opt.len]; memcpy(opt.data, &(t_addr.sin_addr.s_addr), opt.len); AddOption(&opt); delete [] opt.data; // minor 2 - n.b. Intel byte ordering - do intel have no common sense? opt.minor_no = 2; t_addr.sin_port = htois(config->GetMTFTPcport()); opt.len = sizeof(t_addr.sin_port); opt.data = new uint8_t[opt.len]; memcpy(opt.data, &(t_addr.sin_port), opt.len); AddOption(&opt); delete [] opt.data; // minor 3 - again Intel's bel^Wbig endian opt.minor_no = 3; t_addr.sin_port = htois(config->GetMTFTPsport()); opt.len = sizeof(t_addr.sin_port); opt.data = new uint8_t[opt.len]; memcpy(opt.data, &(t_addr.sin_port), opt.len); AddOption(&opt); delete [] opt.data; // minor 4 opt.minor_no = 4; opt.len = 1; opt.data = new uint8_t[opt.len]; opt.data[0] = MTFTP_OPEN_TIMEOUT; AddOption(&opt); // minor 5 opt.minor_no = 5; opt.data[0] = MTFTP_REOPEN_TIMEOUT; AddOption(&opt); // minor 6 opt.minor_no = 6; opt.data[0] = 0; // check for disabled broad/multicast if(0 == config->UseMulticast()) opt.data[0] |= DISABLE_MULTICAST; if(0 == config->UseBroadcast()) opt.data[0] |= DISABLE_BROADCAST; AddOption(&opt); delete [] opt.data; // minor 7 opt.minor_no = 7; t_addr.sin_addr.s_addr = htonl(config->GetMulticast()); opt.len = sizeof(t_addr.sin_addr.s_addr); opt.data = new uint8_t[opt.len]; memcpy(opt.data, &(t_addr.sin_addr.s_addr), opt.len); AddOption(&opt); delete [] opt.data; // minor 9 - will always be ok, as we checked the menus earlier optptr = config->MakeBootMenu(reqCSA, &arch_id, &menu_id); optptr->major_no = 43; optptr->minor_no = 9; AddOption(optptr); delete [] optptr->data; delete optptr; // minor 10 - the menu opt.minor_no = 10; tmpc = config->GetMenuPrompt(); opt.len = strlen(tmpc)+1; opt.data = new uint8_t[opt.len]; opt.data[0] = config->GetMenuTimeout(); memcpy(opt.data+1, tmpc, opt.len-1); AddOption(&opt); delete [] opt.data; delete [] tmpc; // minor 71 opt.minor_no = 71; opt.len = 4; opt.data = new uint8_t[4]; tmpi = htons(PXE_SERVER_TYPE); memcpy(opt.data, &tmpi, 2); opt.data[2] = 0; req_layer = opt.data[3] = config->GetMinLayer(arch_id, menu_id); AddOption(&opt); delete [] opt.data; } else // PXE layer request { arch_id = reqCSA; // get option 71 fromthe request packet optptr = request(43, 71); menu_id = optptr->data[0]; menu_id <<= 8; menu_id |= optptr->data[1]; // don't worry about the third byte, it is for 'credentials' req_layer = optptr->data[3]; // make the reply option opt.minor_no = 71; opt.len = 4; opt.data = new uint8_t[opt.len]; memcpy(opt.data, optptr->data, 2); opt.data[2] = 0; delete [] optptr->data; delete optptr; // which layer to get next/any if(config->CheckLayer(menu_id, arch_id, req_layer) == 0) { opt.data[3] = req_layer; } else { delete [] opt.data; return(-1); } AddOption(&opt); delete [] opt.data; } // make filename tmpc = config->MakeFilename(menu_id, arch_id, req_layer); if(strlen(tmpc) > 127) // gotta think of a better way tmpi = 127; else tmpi = strlen(tmpc); memcpy(file, tmpc, tmpi); file[tmpi] = 0; delete [] tmpc; // cool, send the reply return(0); } /****************************************************************************** * GenOpt54 - generate reply options * ******************************************************************************/ int PacketStore::GenOpt54(void) { option opt; opt.len = sizeof(siaddr.s_addr); opt.major_no = 54; opt.minor_no = 0; opt.data = new uint8_t[opt.len]; memcpy(opt.data, &(siaddr.s_addr), opt.len); AddOption(&opt); delete [] opt.data; return(0); } /****************************************************************************** * GenOpt60 - generate reply options * ******************************************************************************/ int PacketStore::GenOpt60(void) { option opt; opt.major_no=60; opt.minor_no=0; opt.len = strlen(DHCP_T60); opt.data = new uint8_t[opt.len]; memcpy(opt.data, DHCP_T60, opt.len); AddOption(&opt); delete [] opt.data; return(0); } /****************************************************************************** * GetCSA - get the Client System Archetecture of the packet * ******************************************************************************/ uint16_t PacketStore::GetCSA(void) { uint16_t csa1, csa2; option *opt; char csac[6]; int csa1_nok=0; int csa2_nok=0; // should have received two copies of the csa, compare csa1 = csa2 = 0; // the binary packed copy opt = GetOption(93); if(NULL == opt) csa1_nok = 1; else { memcpy(&csa1, opt->data, 2); csa1 = ntohs(csa1); delete [] opt->data; delete opt; } // get the ascii packed version opt = GetOption(60); if(NULL == opt) csa2_nok = 1; else if(32 != opt->len) { csa2_nok = 1; delete [] opt->data; delete opt; } else { memcpy(csac, opt->data+15, 5); csac[5] = 0; csa2 = atoi(csac); delete [] opt->data; delete opt; } // check details if((0 == csa1_nok) && (0 == csa2_nok ) && (csa1 == csa2)) return(checkCSA(csa1)); else if ((1 == csa1_nok) && (0 == csa2_nok )) return(checkCSA(csa2)); else if ((0 == csa1_nok) && (1 == csa2_nok )) return(checkCSA(csa1)); return((uint16_t)-1); } /****************************************************************************** * checkCSA - see if we are supporting the type of arch * ******************************************************************************/ uint16_t PacketStore::checkCSA(uint16_t reqCSA) { int i; for(i=0; (uint16_t)-1 != CSA_types[i].arch_id; i++) if(CSA_types[i].arch_id == reqCSA) break; return(CSA_types[i].arch_id); } /****************************************************************************** * MakeReply - pack the packet into a raw data form * ******************************************************************************/ bootp_packet_t * PacketStore::PackPacket(void) { int pktlen, pos, len43; option *optptr; bootp_packet_t *opt = new bootp_packet_t; // first go through the packet and see how big it is pktlen = 241; // 255 closing tag optptr = head; while(NULL != optptr) { pktlen += optptr->len+2; // ,, optptr = optptr->next; } optptr = head43; if(NULL != optptr) pktlen += 3; // 43,,...,255 len43 = 0; while(NULL != optptr) { pktlen += optptr->len+2; // ,, len43 = pktlen; optptr = optptr->next; } // initalise opt->data = new uint8_t[pktlen]; pos = 0; // basic packet info opt->data[0] = op; opt->data[1] = htype; opt->data[2] = hlen; opt->data[3] = hops; memcpy(opt->data+4, &xid, 4); memcpy(opt->data+8, &secs, 2); memset(opt->data+10, 0, 2); // the addresses memcpy(opt->data+12, &(ciaddr.s_addr), 4); memcpy(opt->data+16, &(yiaddr.s_addr), 4); memcpy(opt->data+20, &(siaddr.s_addr), 4); memcpy(opt->data+24, &(giaddr.s_addr), 4); // hardware addr memcpy(opt->data+28, chaddr, 16); // server name memcpy(opt->data+44, sname, 64); // filename memcpy(opt->data+108, file, 128); // magic cookie memcpy(opt->data+236, &magic_cookie, 4); // basic options pos = 240; optptr = head; while(NULL != optptr) { opt->data[pos] = optptr->major_no; opt->data[pos+1] = optptr->len; memcpy(opt->data+pos+2, optptr->data, optptr->len); pos += optptr->len+2; optptr = optptr->next; } // option 43 optptr = head43; if(NULL != optptr) { opt->data[pos] = 43; opt->data[pos+1] = len43; pos+=2; } while(NULL != optptr) { opt->data[pos] = optptr->minor_no; opt->data[pos+1] = optptr->len; memcpy(opt->data+pos+2, optptr->data, optptr->len); pos += optptr->len+2; optptr = optptr->next; } if(NULL != head43) { opt->data[pos] = 255; pos++; } // close the packet off opt->data[pos] = 255; opt->len=pos; return(opt); } pxe-1.4.2/posix_signal.h0100644000175000017500000000330607527135563014066 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * posix_signal.h - a nice posix abstraction for a horrible subject * ******************************************************************************/ #ifndef _POSIX_SIGNAL_H #define _POSIX_SIGNAL_H #include #include /* header for waitpid() and various macros */ #include /* header for signal functions */ #include /* header for fprintf() */ #include /* header for fprintf() */ #include #include #include #include #include "logfile.h" #include "autoconf.h" class Signal { private: LogFile *log; public: Signal(LogFile *log); ~Signal(); int Set(int SIGNAL, void (*ACTION) (int)); int Block(int SIGNAL); int UnBlock(int SIGNAL); }; #endif //_POSIX_SIGNAL_H pxe-1.4.2/posix_signal.cc0100644000175000017500000000666307531203615014222 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * posix_signal.cc - a nice posix abstraction for a horrible subject * ******************************************************************************/ #include "posix_signal.h" /****************************************************************************** * Constructor * ******************************************************************************/ Signal::Signal(LogFile *_log) { this->log = _log; } /****************************************************************************** * Destructor * ******************************************************************************/ Signal::~Signal() { } /****************************************************************************** * Set - set a signal register * ******************************************************************************/ int Signal::Set(int SIGNAL, void (*ACTION) (int)) { struct sigaction act; /* declare what is going to be called when */ act.sa_handler = ACTION; /* clear the structure's mask */ sigemptyset(&act.sa_mask); /* set up some flags */ act.sa_flags = SA_NOCLDSTOP; act.sa_flags &= ~SA_RESTART; /* set the signal handler */ if(sigaction(SIGNAL, &act, NULL) < 0) log->Event(LEVEL_ERR, "Signal::Set:sigaction()", 1, strerror(errno)); /* all ok */ return(0); } /****************************************************************************** * Block - block a signal * ******************************************************************************/ int Signal::Block(int SIGNAL) { sigset_t set; /* initalise */ sigemptyset(&set); /* add the SIGNAL to the set */ sigaddset(&set, SIGNAL); /* block it */ if(sigprocmask(SIG_BLOCK, &set, NULL) < 0) log->Event(LEVEL_ERR, "Signal::Block:sigprocmask()", 1, strerror(errno)); /* done */ return(0); } /****************************************************************************** * UnBlock - unblock a signal * ******************************************************************************/ int Signal::UnBlock(int SIGNAL) { sigset_t set; /* initalise */ sigemptyset(&set); /* add the SIGNAL to the set */ sigaddset(&set, SIGNAL); /* block it */ if(sigprocmask(SIG_UNBLOCK, &set, NULL) < 0) log->Event(LEVEL_ERR, "Signal::UnBlock:sigprocmask()", 1, strerror(errno)); /* done */ return(0); } pxe-1.4.2/INSTALL0100644000175000017500000001366007617233564012253 0ustar timhusersPXE daemon install ================== 1) If you have a bootp/dhcp daemon installed and running, skip to step 2. If you have not, download the boot daemon from a sunsite mirror, it is under: /pub/Linux/system/network/boot.net/bootpd-2.4.tar.gz eg: ftp://src.doc.ic.ac.uk//Mirrors/sunsite.unc.edu/pub/Linux/system/network/boot.net/bootpd-2.4.tar.gz Follow the install instructions in the bootp package. 2) Download and install PXELINUX from here: http://syslinux.zytor.com/pxe.php My setup for this looks something like this: in /tftpboot/X86PC/linux I have the PXELINUX bootstrap (linux.0) and the kernel I am going to boot from (bzImage) Make a directory here called pxelinux.cfg, inside are a series of files which are named after the hex IP addresses of the machines. ie: /tftpboot/X86PC/linux/pxelinux.cfg/C0A8C8F1 which contains: label linux kernel bzImage append ip=auto You may also need to update your tftp daemon for this as PXELINUX requires an options not present in many versions eg the Solaris tftpd. Details of this are on the PXELINUX page. 3) Run the configure script in this directory. There are several option that can be used in this: --disable-setuid => Disable the daemon from setuiding to a low privilaged user. --with-setuid=user => Set the username to setuid to. --with-config=file => Set the location of the config file. --with-log=file => Set the location of the log file. 4) Check config.h to make sure of things, most things should be ok, however you may wish to change the location of the log file and/or the configuration file. 5) Type 'make' in this directory. If this fails, please send me an email and I will try and fix it, however it is most likely to be a header clash or something. 6) Type 'make install', this will install the pxe daemon and it's config file. 7) Edit /etc/pxe.conf and set up the appropriate entries. set the interface line to be the interface on the machine to bind to. If you enter an invalid interface, the daemon will bind to all available interfaces. It is mandatory to set the default_address address to the default interface of the machine. This is because the PXE protocol is a bit dumb, it sends multicast packets to the bootserver, then uses the server address in the bootp server field for the tftp transfer procedure. 3Com cards are particularly prone to this stupidity. I have not fully tested broadcast capability as yet, there may be some problems with it, however PXE prefers multicast over broadcast, and that has been tested. Most of the other directives are fairly self-explanatory, and you should not need to change them. The menus however do need to be set up. As the config file stands, the first service is a local boot, and the second is a network boot/remote install. The format of the service line is: service=,,,, The CSA is one of several Client System Architectures, most PXE platforms are X86, so this should be left as 'X86PC' however other platforms are supported by inserting the appropriate CSA. The min and max layers are the starting and finishing layers in the boot protocol, most commonly these are: Layer 0: The bootstrap code. Layer 1: The kernel. Layer 2: The initrd. To use a ramdisk, please refer to the PXELINUX config. The basename defines how the filename is built, see below for an example. The Menu entry is the string that should be printed on screen when a menu is requested. There is one special case for all architectures, when the basename is "local" the layers will be ignored and a local boot performed. E.G.: service=X86PC,0,0,pxelinux,PXELinux This defines a service for an X86 PC, starting at layer 0 and ending at layer 1. The basename (filenames below) builds the filename, and "Linux Install" will be displayed on the boot menu. Files requested: /tftpboot/X86PC/pxelinux/pxelinux.0 When more than one service is configured, the menu order is implied by the service description order. If no key is pressed within the prompt_timeout time, the first item from the services list will be selected. 8) Before you are ready to go, make sure you have the following lines in your inetd.conf file (or equivalent): in /etc/bootptab, make sure every system you intend to boot via PXE has the line :T60="PXEClient":\ in it (This is case sensitive). Otherwise the PXE ROM on the network card will not use the PXE protocol. Also make sure the bootptab has a correctly set tftp base directory and has no boot filename. for ISC dhcpd 3.0 users, just add option vendor-class-identifier "PXEClient"; to each class you wish to PXE boot. ######### #tftpd tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot #bootp bootps dgram udp wait root /usr/local/sbin/bootpd bootpd -i -c /tftpboot /etc/bootptab ######### BSD users may want something like: ######### tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tft pboot -u nobody / ######### If you change your inetd.conf file, make sure to send inetd a HUP signal. If you do not understand how to so this, please read the appropriate man pages/One of the Linux HOWTOs. And /etc/services: pxe 4011/udp # pxe Also make sure you have a route specified for multicast packets, or a default route. Solaris automatically defines a route for multicast packets however you may need to change the binding interface. to enable a default route, as root type route add default where is the name of your interface, eg eth0, le0, hme0, ... on some versions of linux you can type to route multicast packets route add 224.0.0.0 netmask 240.0.0.0 dev 9) as root type "pxe" (otherwise the daemon will not set UID to another user. 10) go play. If you have problems with this daemon, please make sure it is repeatable, and send any core dumps/packet dumps to me. If you compiled the daemon without debugging, please don't send the core dumps. Tim Hurman. Feb 2003 kano@kano.org.uk pxe-1.4.2/LICENCE0100644000175000017500000003545307527135563012213 0ustar timhusers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS pxe-1.4.2/README0100644000175000017500000000226407533634466012103 0ustar timhusersPXE daemon readme ================= This is an implementation of the Intel PXE bootstrap protocol. This protocol is roughtly speaking based upon the bootp protocol, and currently needs the bootp daemon to work. The bootp daemon can be found on any sunsite.unc mirror, under /pub/Linux/system/network/boot.net/bootpd-2.4.tar.gz To obtain a bootstrap (code that prepares the machine for a kernel) please look at: http://syslinux.zytor.com/pxe.php Licence info ============ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. October 24, 2000 Tim Hurman (kano@kano.org.uk) pxe-1.4.2/Changes0100644000175000017500000000157110040447343012475 0ustar timhusersApril 14 2004 Tim Hurman Increase the interface buffer to hold more than three interfaces Fixed a segfault in when multicast was disabled Fixed null pointer dereference when looking at interfaces with no IP address Mar 26 2003 Tim Hurman Made the source ansi compliant and fixed namespace usage. Aug 30 2002 Tim Hurman pxe 1.3 released. Made debuging a command line switch. Converted code to use namespaces. Oct 26 2000 Tim Hurman pxe 1.2 released. OpenBSD support fixed. Still a small problem due to OpenBSD's interface arrangement. Virtual interfaces have the same name as the main interface. configure script made, new install instructions. Oct 25 2000 - Tim Hurman pxe 1.1 released. OpenBSD support added Oct 24 2000 - Tim Hurman pxe 1.0 released. pxe-1.4.2/autoconf.h.in0100644000175000017500000000506707531224023013601 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * autoconf.h - pxe daemon configuration file * ******************************************************************************/ #ifndef _AUTOCONF_H #define _AUTOCONF_H /* define this if you have stdint.h */ #undef HAVE_STDINT_H /* define this if you have stropts.h */ #undef HAVE_STROPTS_H /* define this if you have sys/sockio.h */ #undef HAVE_SYS_SOCKIO_H /* define this if you have ifaddrs.h */ #undef HAVE_IFADDRS_H /* define this if you have getifaddrs */ #undef HAVE_GETIFADDRS /* define this if you have hstrerror */ #undef HAVE_HSTRERROR /* define this if you have inet_aton */ #undef HAVE_INET_ATON /* define this if you don't want the daemon to setuid */ #undef NO_SUID /* the user to setuid to */ #define SETUID "nobody" /* the location of the pxe daemon config file */ #define PXECONFIGFILE "/etc/pxe.conf" /* location of the pxe daemon log file */ #define PXELOGFILE "/tmp/pxe.log" /******************************************************************************/ /* should not need to change from here onwards */ /* the lock file */ #define LOCKFILE "/tmp/pxe.pid" #define DEF_MULTI_BOOT 0xe0000102 #define DEF_ADDR "0.0.0.0" #define DEF_PORT 4011 #define BOOTPC_NAME "bootpc" #define PXE_SERVER_TYPE 0 // PXE bootstrap server #define DHCP_T60 "PXEClient" #define DEF_MTFTP_ADDR 0xe0010501 #define DEF_MTFTP_CPORT 0x06de #define DEF_MTFTP_SPORT 0x06df #define MTFTP_OPEN_TIMEOUT 1 // secs before fail #define MTFTP_REOPEN_TIMEOUT 2 // secs before retrying #define DEF_DOMAIN "example.net" #define TFTPD_BASE "/tftpboot" #define DEF_PROMPT "Press F8 to view menu ..." #define DEF_PROMPT_TIMEOUT 10 #endif // _AUTOCONF_H pxe-1.4.2/Makefile.in0100644000175000017500000000130507617216763013262 0ustar timhusersCXX = @CXX@ CXXFLAGS = @CXXFLAGS@ LDFLAGS = @LDFLAGS@ @LIBS@ EXECS = pxe CP = cp all: $(EXECS) pxe.o: pxe.cc sock.o: sock.cc logfile.o: logfile.cc options.o: options.cc sysexception.o: sysexception.cc packetstore.o: packetstore.cc packetstore.h posix_signal.o: posix_signal.cc OBJS = pxe.o sock.o logfile.o options.o sysexception.o \ packetstore.o posix_signal.o clean: /bin/rm -f $(EXECS) $(OBJS) *.o core a.out .nfs* distclean: clean /bin/rm -f config.cache autoconf.h config.log Makefile config.status pxe: $(OBJS) $(CXX) $(OBJS) -o pxe $(LDFLAGS) .cc.o: $(CXX) $(CXXFLAGS) -c $*.cc install: all $(CP) pxe /usr/sbin/ @if test ! -e /etc/pxe.conf; then \ $(CP) pxe.conf /etc/; \ fi pxe-1.4.2/sock.h0100644000175000017500000000536307527135563012333 0ustar timhusers/* * PXE daemon - enable the remote booting of PXE enabled machines. * Copyright (C) 2000 Tim Hurman (kano@kano.org.uk) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ /****************************************************************************** * sock.h - socket IO class * ******************************************************************************/ #ifndef _SOCK_H #define _SOCK_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "autoconf.h" #ifdef HAVE_STROPTS_H #include #endif // HAVE_STROPTS_H #ifdef HAVE_SYS_SOCKIO_H #include #endif // HAVE_SYS_SOCKIO_H #ifdef HAVE_IFADDRS_H #include #endif // HAVE_IFADDRS_H #include "sysexception.h" #include "logfile.h" struct _iflist_t { char *if_name; in_addr if_addr; struct _iflist_t *next; }; typedef struct _iflist_t iflist_t; class Sock { protected: int *sockfds; int ifnum; uint16_t listenport; uint16_t clientport; int multi_sockfd; int broad_sockfd; int use_multi; int use_broad; struct sockaddr_in *bind_addrs; struct sockaddr_in multicast; int listen_multi; struct sockaddr_in broadcast; int listen_broad; struct sockaddr_in default_addr; LogFile *log; public: // constructors Sock(LogFile *log, const char *interface, uint16_t port); ~Sock(); // methods int JoinMulticast(uint32_t multi_addr); int LeaveMulticast(); int Read(unsigned char *, int, struct sockaddr_in *, struct sockaddr_in *); int Send(unsigned char *, int, struct sockaddr_in *, struct sockaddr_in *); int AllowBroadcast(); int DenyBroadcast(); char *GetHostname(const struct sockaddr_in *address); void SetDefAddr(uint32_t); private: int Open(iflist_t *local_addr_t, int listlen, const uint16_t port); int Close(); iflist_t *GetIfList(); }; #endif pxe-1.4.2/THANKS0100644000175000017500000000064410055064213012112 0ustar timhusersThanks to some of the contributors: Anders Nordby - gcc 3.3 patches. Erwan Velu - gcc 3.3 patches. - Itanium 2 support. Matt Brown - interface buffer increase - fix for multicast segfault Pavel Roskin - another fix for the multicast segfault. Sorry if I have left your name out of here... Only just started this.