pen-0.32.0/ 0000755 0001750 0001750 00000000000 12624555212 007363 5 0000000 0000000 pen-0.32.0/pen_poll.h 0000644 0001750 0001750 00000000035 12514665761 011273 0000000 0000000 extern void poll_init(void);
pen-0.32.0/client.h 0000644 0001750 0001750 00000001054 12531277031 010727 0000000 0000000 #include
#include
#ifndef WINDOWS
#include
#else
#include
#endif
#define CLIENTS_MAX 2048 /* max clients */
#define TRACKING_TIME 0 /* how long a client is remembered */
typedef struct {
time_t last; /* last time this client made a connection */
struct sockaddr_storage addr;
int server; /* server used last time */
long connects;
uint64_t csx, crx;
} client;
extern client *clients;
extern int clients_max;
extern int store_client(struct sockaddr_storage *);
extern void expand_clienttable(int);
pen-0.32.0/configure.ac 0000644 0001750 0001750 00000006200 12624554450 011572 0000000 0000000 dnl Process this file with autoconf to produce a configure script.
AC_INIT([pen],[0.32.0])
AC_CONFIG_SRCDIR([pen.c])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_ISC_POSIX
dnl Checks for libraries.
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(nsl, main)
dnl Next line is for Solaris
AC_CHECK_LIB(resolv, inet_aton)
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_MAJOR
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
if test "$GCC" = "yes"; then
CFLAGS="-Wall $CFLAGS"
fi
dnl Checks for library functions.
dnl AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON, 1, [#undef HAVE_INET_ATON]))
AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO, 1, [#undef HAVE_GETADDRINFO]))
AC_CHECK_FUNC(accept4, AC_DEFINE(HAVE_ACCEPT4, 1, [#undef HAVE_ACCEPT4]))
dnl Check things for pen
AC_CHECK_HEADERS([sys/select.h])
AC_ARG_ENABLE(profiling,
[ --enable-profiling enable profiling],
[ if test "$withval" != "no"; then
CFLAGS="$CFLAGS -pg"
fi ])
AC_ARG_ENABLE(debugging, AS_HELP_STRING([--enable-debugging], [enable debugging messages]))
AS_IF([test "$enable_debugging" != "no"], [CFLAGS="$CFLAGS -DDEBUGGING"])
AC_ARG_WITH(daemon,
[ --with-daemon use daemon() if available],
[ if test "$withval" != "no"; then
AC_CHECK_FUNC(daemon,
AC_DEFINE([HAVE_DAEMON], 1, [#undef HAVE_DAEMON]))
fi ])
AC_ARG_WITH(poll, AS_HELP_STRING([--with-poll], [use poll() if available]))
AS_IF([test "$with_poll" != "no"],
AC_CHECK_FUNC(poll,
AC_DEFINE([HAVE_POLL], 1, [#undef HAVE_POLL])))
AC_ARG_WITH(epoll, AS_HELP_STRING([--with-epoll], [use epoll if available]))
AS_IF([test "$with_epoll" != "no"],
AC_CHECK_FUNC(epoll_create1,
AC_DEFINE([HAVE_EPOLL], 1, [#undef HAVE_EPOLL])))
AC_ARG_WITH(kqueue, AS_HELP_STRING([--with-kqueue], [use kqueue() if available]))
AS_IF([test "$with_kqueue" != "no"],
AC_CHECK_FUNC(kqueue,
AC_DEFINE([HAVE_KQUEUE], 1, [#undef HAVE_KQUEUE])))
AC_ARG_WITH(fd_setsize,
[ --with-fd_setsize=N set FD_SETSIZE to N (see INSTALL)],
[ if test "$withval" != "no"; then
AC_DEFINE_UNQUOTED([FD_SETSIZE], $withval, [#undef FD_SETSIZE])
fi ])
AC_ARG_WITH(ssl, AS_HELP_STRING([--with-ssl], [use SSL (default /usr/local/ssl)]))
AS_IF([test "$with_ssl" != "no"],
AC_CHECK_LIB(crypto, main)
AC_CHECK_LIB(ssl, main))
dnl Some people think the EC stuff is patented and needs to be stripped out
AC_CHECK_FUNC(EC_KEY_new_by_curve_name,
AC_DEFINE([HAVE_EC_KEY], 1, [#undef HAVE_EC_KEY]))
AC_ARG_WITH(geoip, AS_HELP_STRING([--with-geoip], [use libgeoip]))
AS_IF([test "$with_geoip" != "no"],
AC_CHECK_LIB([GeoIP], [GeoIP_country_code_by_addr]))
AC_ARG_WITH(dsr, AS_HELP_STRING([--with-dsr], [enable direct server return]))
AS_IF([test "$with_dsr" != "no"],
[ AC_CHECK_HEADERS([linux/if_packet.h])
AC_CHECK_HEADERS([net/netmap_user.h])])
docdir='${prefix}/doc/pen'
AC_ARG_WITH(docdir,
[ --with-docdir=DIR install docs in DIR [[PREFIX/doc/pen]]],
[ if test "$withval" != "yes" && test "$withval" != "no"; then
docdir=$withval
fi ])
AC_SUBST(docdir)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
pen-0.32.0/mergelogs.c 0000644 0001750 0001750 00000020651 12526565545 011452 0000000 0000000 /*
mergelogs.c
Copyright (C) 2001-2015 Ulric Eriksson
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include "diag.h"
#include "memory.h"
#include "settings.h"
#define KEEP_MAX 100 /* how much to keep from the URI */
typedef struct {
char *a; /* server name */
char *fn; /* log file name */
FILE *fp; /* file pointer, or NULL if eof */
time_t t; /* time stamp from last line */
char cli[1024]; /* client address */
char tim[1024]; /* time string */
char uri[1024]; /* uri */
char b1[1024], b2[1024], b3[1024]; /* misc text */
} server;
static server *servers;
static int nservers;
static char *pfile;
static int jitter = 600; /* 10 minutes */
static FILE *pfp;
static int tz = 0;
static int cache_penlog = 1;
static char *months[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
static void usage(void)
{
printf("Usage: mergelogs -p penlog [-j jitter] \\\n"
" server1:logfile1 [server2:logfile2 ...]\n\n"
" -c Do not use penlog cache\n"
" -d Debugging (repeat for more)\n"
" -p penlog Log file from pen\n"
" -j jitter Jitter in seconds [2]\n"
" -r filename Where to put rejects\n"
" -t seconds Timezone\n"
" server:logfile Web server address and name of logfile\n");
exit(0);
}
static int options(int argc, char **argv)
{
int c;
while ((c = getopt(argc, argv, "p:a:j:t:cd")) != -1) {
switch (c) {
case 'p':
pfile = optarg;
break;
case 'j':
jitter = atoi(optarg);
break;
case 't':
tz = atoi(optarg);
break;
case 'c':
cache_penlog = 0;
break;
case 'd':
debuglevel++;
break;
default:
usage();
}
}
return optind;
}
static int mon2num(char *p)
{
int i;
for (i = 0; i < 12; i++)
if (!strcmp(p, months[i])) return i;
return -1;
}
static char *num2mon(int m)
{
if (m < 0 || m > 11) return "no such month";
return months[m];
}
static void thenp(char *b, time_t t)
{
struct tm *tms = localtime(&t);
snprintf(b, 1024, "%02d/%s/%04d:%02d:%02d:%02d +0000",
tms->tm_mday, num2mon(tms->tm_mon), tms->tm_year+1900,
tms->tm_hour, tms->tm_min, tms->tm_sec);
}
/*
Time format: 09/Jan/2002:00:27:15 +0100
*/
static time_t whenp(char *p, struct tm *tms)
{
char dd[100], mm[100], yy[100];
char hh[100], mi[100], ss[100], tz[100];
time_t t;
tz[0] = '\0';
sscanf(p, "%[^/]/%[^/]/%[^:]:%[^:]:%[^:]:%s %s",
dd, mm, yy, hh, mi, ss, tz);
tms->tm_sec = atoi(ss);
tms->tm_min = atoi(mi);
tms->tm_hour = atoi(hh);
tms->tm_mday = atoi(dd);
tms->tm_mon = mon2num(mm);
tms->tm_year = atoi(yy)-1900;
t = mktime(tms);
if (t != -1 && strlen(tz) == 5) {
int d = 60*atoi(tz+3);
tz[3] = '\0';
d += 3600*atoi(tz+1);
if (tz[0] == '+') t -= d;
else t += d;
}
return t;
}
static void read_server_line(int s)
{
char b[1024];
struct tm tms;
int n;
do {
if (fgets(b, sizeof b, servers[s].fp) == NULL) {
fclose(servers[s].fp);
servers[s].fp = NULL;
return;
}
n = sscanf(b, "%[^ ] %[^[][%[^]]]%[^\"]\"%[^\"]\"%[^\n]",
servers[s].cli, servers[s].b1, servers[s].tim,
servers[s].b2, servers[s].uri, servers[s].b3);
if (n == 6) {
servers[s].t = whenp(servers[s].tim, &tms);
} else if (debuglevel) {
debug("Read %d fields", n);
}
} while (n != 6);
}
static int oldest_server(void)
{
int i, n = -1;
time_t t = -1;
for (i = 0; i < nservers; i++) {
if (servers[i].fp) {
if (t == -1 || servers[i].t < t) {
n = i;
t = servers[i].t;
}
}
}
return n;
}
typedef struct {
char *cli; /* client address */
int ser; /* server index (in servers array) */
time_t t; /* time stamp */
char *uri; /* uri */
} pencache;
static pencache *pc;
static int npc;
static int server2num(char *s)
{
int i;
for (i = 0; i < nservers; i++) {
if (!strcmp(servers[i].a, s)) return i;
}
return -1;
}
/* cache relevant penlog lines to speed up the search */
static void best_client1(char *p, char *s, long t, char *u)
{
char b[1024], from[1024], to[1024], uri[1024];
long when, td, ntd;
int i, j;
int ser = server2num(s);
/* first remove all entries that are older than (t-jitter) */
for (i = 0; i < npc; i++) {
if (pc[i].t >= (t-jitter)) break;
}
if (i) {
if (debuglevel) debug("uncache %d lines\n", i);
for (j = 0; j < i; j++) {
if (debuglevel >= 2) {
debug("uncache '%s %ld %d %s'",
pc[j].cli, pc[j].t,
pc[j].ser, pc[j].uri);
}
free(pc[j].cli);
free(pc[j].uri);
}
while (j < npc) {
pc[j-i] = pc[j];
j++;
}
npc -= i;
}
/* then add entries until eof or newer than (t+jitter) */
for (;;) {
if (npc > 0 && pc[npc-1].t > (t+jitter)) break;
if (feof(pfp)) break;
if (fgets(b, sizeof b, pfp) == NULL) break;
pc = pen_realloc(pc, (npc+1)*sizeof *pc);
if (debuglevel) debug("pc = %p, b = '%s'", pc, b);
if (sscanf(b, "%s %ld %s %[^\n]", from, &when, to, uri) != 4) {
continue;
}
pc[npc].cli = pen_strdup(from);
pc[npc].ser = server2num(to);
pc[npc].t = when-tz;
pc[npc].uri = pen_strdup(uri);
if (debuglevel >= 2) {
debug("cache '%s %ld %d %s'",
pc[npc].cli, pc[npc].t,
pc[npc].ser, pc[npc].uri);
}
npc++;
}
/* now search the cache for a best match */
snprintf(p, 1024, "%s", s);
td = LONG_MAX;
for (i = 0; i < npc; i++) {
if (ser != pc[i].ser) continue;
if (strcmp(u, pc[i].uri)) continue;
ntd = labs(t-pc[i].t);
if (ntd < td) {
td = ntd;
snprintf(p, 1024, "%s", pc[i].cli);
}
}
}
/* same again, this time without the cache */
static void best_client0(char *p, char *s, long t, char *u)
{
char b[1024], from[1024], to[1024], uri[1024];
long when, td, ntd;
rewind(pfp);
snprintf(p, 1024, "%s", s); /* default is client = server */
td = LONG_MAX;
while (fgets(b, sizeof b, pfp)) {
if (sscanf(b, "%s %ld %s %[^\n]", from, &when, to, uri) != 4) {
continue;
}
if (strcmp(s, to)) continue;
if (strcmp(u, uri)) continue;
when -= tz;
ntd = labs(t-when);
if (ntd < td) {
td = ntd;
snprintf(p, 1024, "%s", from);
}
}
if (debuglevel && td > 600) {
debug("Warning: time difference %ld", td);
}
}
static void best_client(char *p, char *s, long t, char *u)
{
if (cache_penlog) best_client1(p, s, t, u);
else best_client0(p, s, t, u);
}
int main(int argc, char **argv)
{
int i, n, s;
n = options(argc, argv);
argc -= n;
argv += n;
if (argc < 1) {
usage();
}
if (pfile == NULL) error("pfile null");
pfp = fopen(pfile, "r");
if (pfp == NULL) error("pfp null");
s = 0;
servers = pen_calloc(argc, sizeof *servers);
for (i = 0; i < argc; i++) {
servers[s].a = pen_strdup(argv[i]);
servers[s].fn = strchr(servers[s].a, ':');
if (servers[s].fn == NULL)
error("Bogus server '%s'\n", argv[i]);
*servers[s].fn++ = '\0';
servers[s].fp = fopen(servers[s].fn, "r");
if (servers[s].fp == NULL)
error("Can't open logfile '%s'\n", servers[s].fn);
read_server_line(s);
nservers++;
s++;
}
/*
Example log lines:
10.0.18.6 - - [09/Jan/2002:00:28:50 +0100] "GET /robots.txt HTTP/1.0" 404 268
10.0.18.6 - - [09/Jan/2002:00:28:50 +0100] "GET /news.html HTTP/1.0" 200 4017
That is: client, whatever, whatever, [timestamp], "URI", code, size.
*/
while ((s = oldest_server()) != -1) {
char cli[1024], tim[1024];
thenp(tim, servers[s].t);
best_client(cli, servers[s].a, servers[s].t, servers[s].uri);
if (debuglevel >= 2) {
debug("\tclient = '%s' => '%s'",
servers[s].cli, cli);
debug("\ttime = '%s' => %d => '%s'",
servers[s].cli, cli, servers[s].tim,
(int)servers[s].t, tim);
debug("\turi = '%s'",
servers[s].uri);
}
printf("%s %s[%s]%s\"%s\"%s\n",
cli, servers[s].b1, tim,
servers[s].b2, servers[s].uri, servers[s].b3);
read_server_line(s);
}
fclose(pfp);
return 0;
}
pen-0.32.0/penctl.cgi 0000755 0001750 0001750 00000022026 12507562420 011260 0000000 0000000 #!/bin/sh
# Copyright (C) 2002-2015 Ulric Eriksson
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
PENCTL=penctl
#set -x
header()
{
if test -z "$1"; then
TITLE=Penctl
else
TITLE="$1"
fi
cat << EOF
$TITLE
$TITLE
EOF
}
footer()
{
cat << EOF
EOF
}
errorpage()
{
header "Error"
echo "$1"
footer
exit 0
}
get_query()
{
echo "$QUERY_STRING"|tr '&' '\n'|grep "^$1="|cut -f 2 -d =|sed -e 's,%2F,/,g' -e 's,%..,,g'
}
statuspage()
{
test -z "$SERVER" && errorpage "No server"
test -z "$PORT" && errorpage "No port"
$PENCTL $SERVER:$PORT status 2> /path/to/tmp/penctl.cgi
if test "$?" != "0"; then
errorpage "`cat /path/to/tmp/penctl.cgi`"
fi
echo ""
}
# testmode modelist setting
testmode()
{
echo "$1"|egrep "no(\+| )$2" > /dev/null 2>&1
if test "$?" = "0"; then
echo "no"
else
echo "yes"
fi
}
# setmode setting old new
setmode()
{
if test "$2" != "$3"; then
if test "$3" = "yes"; then
$PENCTL $SERVER:$PORT $1
else
$PENCTL $SERVER:$PORT no $1
fi
fi
}
settingspage()
{
test -z "$SERVER" && errorpage "No server"
test -z "$PORT" && errorpage "No port"
OLDMODE=`get_query oldmode`
if test ! -z "$OLDMODE"; then
BLACKLIST=`get_query blacklist`
test -z "$BLACKLIST" || $PENCTL $SERVER:$PORT blacklist $BLACKLIST
DEBUG=`get_query debug`
test -z "$DEBUG" || $PENCTL $SERVER:$PORT debug $DEBUG
LOG=`get_query log`
test -z "$LOG" || $PENCTL $SERVER:$PORT log $LOG
TIMEOUT=`get_query timeout`
test -z "$TIMEOUT" || $PENCTL $SERVER:$PORT timeout $TIMEOUT
TRACKING=`get_query tracking`
test -z "$TRACKING" || $PENCTL $SERVER:$PORT tracking $TRACKING
WEB_STATS=`get_query web_stats`
test -z "$WEB_STATS" || $PENCTL $SERVER:$PORT web_stats $WEB_STATS
x=`testmode "$OLDMODE" block`
BLOCK=`get_query block`
setmode "block" "$x" "$BLOCK"
x=`testmode "$OLDMODE" delayed_forward`
DFORWARD=`get_query dforward`
setmode "dforward" "$x" "$DFORWARD"
x=`testmode "$OLDMODE" hash`
HASH=`get_query hash`
setmode "hash" "$x" "$HASH"
# HTTP=`get_query http`
# setmode "$OLDMODE" "$x" "$HTTP"
x=`testmode "$OLDMODE" roundrobin`
ROUNDROBIN=`get_query roundrobin`
setmode "roundrobin" "$x" "$ROUNDROBIN"
x=`testmode "$OLDMODE" stubborn`
STUBBORN=`get_query stubborn`
setmode "stubborn" "$x" "$STUBBORN"
fi
cat << EOF 1>&2
BLOCK="$BLOCK"
DFORWARD="$DFORWARD"
HASH="$HASH"
ROUNDROBIN="$ROUNDROBIN"
STUBBORN="$STUBBORN"
EOF
header "Global Settings"
BLACKLIST=`$PENCTL $SERVER:$PORT blacklist`
CLIENTS_MAX=`$PENCTL $SERVER:$PORT clients_max`
CONN_MAX=`$PENCTL $SERVER:$PORT conn_max`
DEBUG=`$PENCTL $SERVER:$PORT debug`
LISTEN=`$PENCTL $SERVER:$PORT listen`
LOG=`$PENCTL $SERVER:$PORT log`
MODE=`$PENCTL $SERVER:$PORT mode`
echo "MODE=$MODE
"
BLOCK=`testmode "$MODE" block`
DFORWARD=`testmode "$MODE" delayed_forward`
HASH=`testmode "$MODE" hash`
ROUNDROBIN=`testmode "$MODE" roundrobin`
STUBBORN=`testmode "$MODE" stubborn`
PID=`$PENCTL $SERVER:$PORT pid`
TIMEOUT=`$PENCTL $SERVER:$PORT timeout`
TRACKING=`$PENCTL $SERVER:$PORT tracking`
WEB_STATS=`$PENCTL $SERVER:$PORT web_stats`
BLOCKCHECKED=""
test x$BLOCK = xyes && BLOCKCHECKED=checked
DFORWARDCHECKED=""
test x$DFORWARD = xyes && DFORWARDCHECKED=checked
HASHCHECKED=""
test x$HASH = xyes && HASHCHECKED=checked
ROUNDROBINCHECKED=""
test x$ROUNDROBIN = xyes && ROUNDROBINCHECKED=checked
STUBBORNCHECKED=""
test x$STUBBORN = xyes && STUBBORNCHECKED=checked
cat << EOF
EOF
footer
}
managepage()
{
test -z "$SERVER" && errorpage "No server"
test -z "$PORT" && errorpage "No port"
N=0
A=`get_query "A.$N"`
while test ! -z "$A"; do
P=`get_query "P.$N"`
M=`get_query "M.$N"`
H=`get_query "H.$N"`
T=`get_query "T.$N"`
x=""
test -z "$A" || x="$x address $A"
test -z "$P" || x="$x port $P"
test -z "$M" || x="$x max $M"
test -z "$H" || x="$x hard $H"
test -z "$T" || x="$x blacklist $T"
test -z "$x" || $PENCTL $SERVER:$PORT server $N $x
# N=`echo $N+1|bc`
N=$((N+1))
A=`get_query "A.$N"`
done
header "Manage Servers"
cat << EOF
EOF
}
mainpage()
{
header
cat << EOF
EOF
footer
}
echo Content-type: text/html
echo
echo "This script has not been updated in many years and is unfit for public consumption"
exit
SERVER=`get_query server`
PORT=`get_query port`
MODE=`get_query mode`
case "$MODE" in
Status )
statuspage
;;
Manage )
managepage
;;
Settings )
settingspage
;;
* )
mainpage
;;
esac
pen-0.32.0/penlogd.1 0000644 0001750 0001750 00000003155 12527416603 011023 0000000 0000000 .TH PENLOGD 1 LOCAL
.SH NAME
penlogd - consolidate web server logs
.SH SYNOPSIS
.B penlogd
[-fd] [-j dir] [-l logfile] [-n N] [-p pidfile] [-u user] port
.SH EXAMPLE
penlogd -l /var/log/access_log -p /var/run/penlogd.pid 10000
.SH DESCRIPTION
.I Penlogd
receives log entries from Pen and from each of the web servers. It
consolidates the entries by replacing the source addresses in each entry
with the "real" client address and writes the result to stdout or to
the file given on the command line.
This completely removes the need for postprocessing with mergelogs,
since the logs are already merged.
Pen must be instructed to send its log to penlogd. See HOWTO and pen man page
for details.
Sending penlogd a HUP signal will make it close and reopen the logfile, unless
it is logging to stdout. Rotate the log like this:
mv access_log access_log.1
kill -HUP `cat `
where is the file containing pen's process id.
Sending penlogd a TERM signal will make it close the log file and exit cleanly.
.SH OPTIONS
.TP
-d
Turn on debugging. The output goes to stderr if we are running in the
foreground (see -f) and to syslog (facility user, priority debug)
otherwise.
.TP
-f
Stay in foreground.
.TP
-j \fIdir\fR
Run in a chroot environment.
.TP
-l \fIlogfile\fR
Write output into logfile.
.TP
-n \fIN\fR
Number of pen log entries to cache (default 1000).
.TP
-p \fIpidfile\fR
Write process id into pidfile.
.TP
-u \fIuser\fR
Run as a different user.
.TP
port
The UDP port where penlogd receives log entries.
.SH SEE ALSO
pen(1), penlog(1), webresolve(1)
.SH AUTHOR
Copyright (C) 2002-2015 Ulric Eriksson, .
pen-0.32.0/ssl.c 0000644 0001750 0001750 00000026641 12554727213 010265 0000000 0000000 #include "config.h"
#ifdef HAVE_LIBSSL
#include
#include
#include
#include
#include
#include
#include
#include
#include "ssl.h"
#include "client.h"
#include "conn.h"
#include "pen.h"
#include "diag.h"
#include "memory.h"
#include "server.h"
char ssl_compat;
char require_peer_cert;
char ssl_protocol;
char *certfile;
char *keyfile;
char *cacert_dir;
char *cacert_file;
char *ssl_sni_path;
SSL_CTX *ssl_context = NULL;
long ssl_options;
char *ssl_ciphers;
int ssl_session_id_context = 1;
int ssl_client_renegotiation_interval = 3600; /* one hour, effectively disabled */
unsigned char ocsp_resp_data[OCSP_RESP_MAX];
long ocsp_resp_len = 0;
char *ocsp_resp_file = NULL;
static int ssl_verify_cb(int ok, X509_STORE_CTX *ctx)
{
char buffer[256];
X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),
buffer, sizeof(buffer));
if (ok) {
debug("SSL: Certificate OK: %s", buffer);
} else {
switch (ctx->error) {
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
debug("SSL: Cert error: CA not known: %s", buffer);
break;
case X509_V_ERR_CERT_NOT_YET_VALID:
debug("SSL: Cert error: Cert not yet valid: %s",
buffer);
break;
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
debug("SSL: Cert error: illegal \'not before\' field: %s",
buffer);
break;
case X509_V_ERR_CERT_HAS_EXPIRED:
debug("SSL: Cert error: Cert expired: %s", buffer);
break;
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
debug("SSL: Cert error: invalid \'not after\' field: %s",
buffer);
break;
default:
debug("SSL: Cert error: unknown error %d in %s",
ctx->error, buffer);
break;
}
}
return ok;
}
static RSA *ssl_temp_rsa_cb(SSL *ssl, int export, int keylength)
{
static RSA *rsa = NULL;
if (rsa == NULL)
rsa = RSA_generate_key(512, RSA_F4, NULL, NULL);
return rsa;
}
static void ssl_info_cb(const SSL *ssl, int where, int ret)
{
int st = SSL_get_state(ssl);
const char *state = SSL_state_string_long(ssl);
const char *type = SSL_alert_type_string_long(ret);
const char *desc = SSL_alert_desc_string_long(ret);
connection *conn = SSL_get_app_data(ssl);
int renegotiating = 0;
DEBUG(3, "ssl_info_cb(ssl=%p, where=%d, ret=%d)", ssl, where, ret);
if (where & SSL_CB_LOOP) DEBUG(3, "\tSSL_CB_LOOP");
if (where & SSL_CB_EXIT) DEBUG(3, "\tSSL_CB_EXIT");
if (where & SSL_CB_READ) DEBUG(3, "\tSSL_CB_READ");
if (where & SSL_CB_WRITE) DEBUG(3, "\tSSL_CB_WRITE");
if (where & SSL_CB_ALERT) DEBUG(3, "\tSSL_CB_ALERT");
if (where & SSL_CB_READ_ALERT) DEBUG(3, "\tSSL_CB_READ_ALERT");
if (where & SSL_CB_WRITE_ALERT) DEBUG(3, "\tSSL_CB_WRITE_ALERT");
if (where & SSL_CB_ACCEPT_LOOP) DEBUG(3, "\tSSL_CB_ACCEPT_LOOP");
if (where & SSL_CB_ACCEPT_EXIT) DEBUG(3, "\tSSL_CB_ACCEPT_EXIT");
if (where & SSL_CB_CONNECT_LOOP) DEBUG(3, "\tSSL_CB_CONNECT_LOOP");
if (where & SSL_CB_CONNECT_EXIT) DEBUG(3, "\tSSL_CB_CONNECT_EXIT");
if (where & SSL_CB_HANDSHAKE_START) DEBUG(3, "\tSSL_CB_HANDSHAKE_START");
if (where & SSL_CB_HANDSHAKE_DONE) DEBUG(3, "\tSSL_CB_HANDSHAKE_DONE");
DEBUG(3, "SSL state = %s", state);
DEBUG(3, "Alert type = %s", type);
DEBUG(3, "Alert description = %s", desc);
if (st == SSL3_ST_SR_CLNT_HELLO_A) {
DEBUG(3, "\tSSL3_ST_SR_CLNT_HELLO_A");
renegotiating = 1;
} else if (st == SSL23_ST_SR_CLNT_HELLO_A) {
DEBUG(3, "\tSSL23_ST_SR_CLNT_HELLO_A");
renegotiating = 1;
}
if (conn == NULL) {
debug("Whoops, no conn info");
} else {
DEBUG(3, "Connection in state %d from client %d to server %d",
conn->state, conn->client, conn->server);
if (renegotiating) {
int reneg_time = now-conn->reneg;
conn->reneg = now;
DEBUG(3, "Client asks for renegotiation");
DEBUG(3, "Last time was %d seconds ago", reneg_time);
if (reneg_time < ssl_client_renegotiation_interval) {
debug("That's more often than we care for");
conn->state = CS_CLOSED;
}
}
}
}
static struct sni {
char *name;
SSL_CTX *ssl_context;
unsigned char ocsp_resp_data[OCSP_RESP_MAX];
int ocsp_resp_len;
time_t ocsp_resp_time;
struct sni *next;
} *sni_list;
static SSL_CTX *ssl_create_context(char *keyfile, char *certfile,
char *cacert_dir, char *cacert_file);
static struct sni *lookup_sni(const char *name)
{
struct sni *s;
for (s = sni_list; s; s = s->next)
if (!strcmp(s->name, name)) break;
if (s == NULL) {
char keyfile[1024], certfile[1024], cacert_file[1024];
s = pen_malloc(sizeof *s);
s->name = pen_strdup(name);
s->next = sni_list;
sni_list = s;
snprintf(keyfile, sizeof keyfile, "%s/%s.key", ssl_sni_path, name);
snprintf(certfile, sizeof certfile, "%s/%s.crt", ssl_sni_path, name);
snprintf(cacert_file, sizeof cacert_file, "%s/%s.ca", ssl_sni_path, name);
s->ocsp_resp_len = 0;
s->ocsp_resp_time = 0; /* never */
s->ssl_context = ssl_create_context(keyfile, certfile, NULL, cacert_file);
}
return s;
}
static long read_ocsp(const char *fn, unsigned char *data)
{
int f = open(fn, O_RDONLY);
long len = 0;
DEBUG(3, "Read ocsp response from '%s'", fn);
if (f == -1) {
DEBUG(3, "Can't read file");
} else {
len = read(f, data, OCSP_RESP_MAX);
DEBUG(3, "Read %ld bytes of ocsp response", len);
close(f);
}
if (len < 0) len = 0;
return len;
}
static int ssl_stapling_cb(SSL *ssl, void *p)
{
connection *conn = SSL_get_app_data(ssl);
unsigned char *data, *ocsp_resp_copy;
long len = 0;
if (conn == NULL) {
debug("Whoops, no conn info");
return SSL_TLSEXT_ERR_ALERT_FATAL;
} else {
DEBUG(3, "ssl_stapling_cb() called for connection from client %d to server %d",
conn->client, conn->server);
}
if (SSL_get_SSL_CTX(ssl) != ssl_context) {
const char *n;
char ocsp_file[1024];
struct sni *s;
DEBUG(3, "stapling for sni context");
n = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
if (n == NULL) {
DEBUG(3, "SNI hostname null, giving up");
return SSL_TLSEXT_ERR_NOACK;
}
s = lookup_sni(n);
if (now-s->ocsp_resp_time > 3600) { /* seems about right */
snprintf(ocsp_file, sizeof ocsp_file, "%s/%s.ocsp", ssl_sni_path, n);
s->ocsp_resp_len = read_ocsp(ocsp_file, s->ocsp_resp_data);
s->ocsp_resp_time = now;
}
len = s->ocsp_resp_len;
data = s->ocsp_resp_data;
} else {
DEBUG(3, "stapling for default context");
if (ocsp_resp_file) {
ocsp_resp_len = read_ocsp(ocsp_resp_file, ocsp_resp_data);
free(ocsp_resp_file);
ocsp_resp_file = NULL;
}
len = ocsp_resp_len;
data = ocsp_resp_data;
}
if (len == 0) {
DEBUG(3, "No ocsp data");
return SSL_TLSEXT_ERR_NOACK;
}
ocsp_resp_copy = pen_malloc(len);
memcpy(ocsp_resp_copy, data, len);
SSL_set_tlsext_status_ocsp_resp(ssl, ocsp_resp_copy, len);
return SSL_TLSEXT_ERR_OK;
}
static int ssl_sni_cb(SSL *ssl, int *foo, void *arg)
{
const char *n;
struct sni *s;
n = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
if (n == NULL) {
DEBUG(3, "SNI hostname null, giving up");
return SSL_TLSEXT_ERR_NOACK;
}
DEBUG(3, "ssl_sni_cb() => name = '%s'", n);
if (ssl_sni_path == NULL) {
DEBUG(3, "ssl_sni_path not set, giving up");
return SSL_TLSEXT_ERR_NOACK;
}
s = lookup_sni(n);
if (s->ssl_context == NULL) return SSL_TLSEXT_ERR_NOACK;
SSL_set_SSL_CTX(ssl, s->ssl_context);
return SSL_TLSEXT_ERR_OK;
}
static SSL_CTX *ssl_create_context(char *keyfile, char *certfile,
char *cacert_dir, char *cacert_file)
{
int n, err;
SSL_CTX *ssl_context;
if (certfile == NULL || *certfile == 0) {
debug("SSL: No cert file specified in config file!");
debug("The server MUST have a certificate!");
return NULL;
}
if (keyfile == NULL || *keyfile == 0)
keyfile = certfile;
if (cacert_dir != NULL && *cacert_dir == 0)
cacert_dir = NULL;
if (cacert_file != NULL && *cacert_file == 0)
cacert_file = NULL;
switch (ssl_protocol) {
#if 0
case SRV_SSL_V2:
ssl_context = SSL_CTX_new(SSLv2_method());
break;
#endif
#ifndef OPENSSL_NO_SSL3
case SRV_SSL_V3:
ssl_context = SSL_CTX_new(SSLv3_method());
break;
#endif
default:
case SRV_SSL_V23:
ssl_context = SSL_CTX_new(SSLv23_method());
break;
case SRV_SSL_TLS1:
ssl_context = SSL_CTX_new(TLSv1_method());
break;
}
if (ssl_context == NULL) {
err = ERR_get_error();
debug("SSL: Error allocating context: %s",
ERR_error_string(err, NULL));
return NULL;
}
DEBUG(1, "ssl_options = 0x%lx", ssl_options);
if (ssl_options) {
SSL_CTX_set_options(ssl_context, ssl_options);
}
if (ssl_compat) {
SSL_CTX_set_options(ssl_context, SSL_OP_ALL);
}
DEBUG(1, "ssl_ciphers = '%s'", ssl_ciphers);
if (ssl_ciphers) {
n = SSL_CTX_set_cipher_list(ssl_context, ssl_ciphers);
if (n == 0) {
err = ERR_get_error();
DEBUG(3, "SSL_CTX_set_cipher_list(ssl_context, %s) returns %d (%s)",
ssl_ciphers, n, err);
}
}
if (!SSL_CTX_use_certificate_file(ssl_context, certfile,
SSL_FILETYPE_PEM)) {
err = ERR_get_error();
debug("SSL: error reading certificate from file %s: %s",
certfile, ERR_error_string(err, NULL));
return NULL;
}
if (!SSL_CTX_use_PrivateKey_file(ssl_context, keyfile,
SSL_FILETYPE_PEM)) {
err = ERR_get_error();
debug("SSL: error reading private key from file %s: %s",
keyfile, ERR_error_string(err, NULL));
return NULL;
}
if (!SSL_CTX_check_private_key(ssl_context)) {
debug("SSL: Private key does not match public key in cert!");
return NULL;
}
if (cacert_dir != NULL || cacert_file != NULL) {
if (!SSL_CTX_load_verify_locations(ssl_context,
cacert_file, cacert_dir)) {
err = ERR_get_error();
debug("SSL: Error error setting CA cert locations: %s",
ERR_error_string(err, NULL));
cacert_file = cacert_dir = NULL;
}
}
if (cacert_dir == NULL && cacert_file == NULL) { /* no verify locations loaded */
debug("SSL: No verify locations, trying default");
if (!SSL_CTX_set_default_verify_paths(ssl_context)) {
err = ERR_get_error();
debug("SSL: Error error setting default CA cert location: %s",
ERR_error_string(err, NULL));
debug("continuing anyway...");
}
}
SSL_CTX_set_tmp_rsa_callback(ssl_context, ssl_temp_rsa_cb);
SSL_CTX_set_info_callback(ssl_context, ssl_info_cb);
SSL_CTX_set_tlsext_status_cb(ssl_context, ssl_stapling_cb);
SSL_CTX_set_tlsext_servername_callback(ssl_context, ssl_sni_cb);
if (require_peer_cert) {
SSL_CTX_set_verify(ssl_context,
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
ssl_verify_cb);
} else {
SSL_CTX_set_verify(ssl_context,
SSL_VERIFY_NONE,
ssl_verify_cb);
}
SSL_CTX_set_client_CA_list(ssl_context,
SSL_load_client_CA_file(certfile));
/* permit large writes to be split up in several records */
SSL_CTX_set_mode(ssl_context, SSL_MODE_ENABLE_PARTIAL_WRITE|SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
DEBUG(3, "SSL_CTX_get_session_cache_mode() returns %d",
SSL_CTX_get_session_cache_mode(ssl_context));
SSL_CTX_set_session_cache_mode(ssl_context, SSL_SESS_CACHE_SERVER);
#if defined(HAVE_EC_KEY) && defined(NID_X9_62_prime256v1)
EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
if (ecdh == NULL) {
debug("EC_KEY_new_by_curve_name failure");
} else {
if (SSL_CTX_set_tmp_ecdh(ssl_context, ecdh) != 1) {
debug("SSL_CTX_set_tmp_ecdh failure");
} else {
DEBUG(1, "ECDH Initialized with NIST P-256");
}
EC_KEY_free(ecdh);
}
#endif
SSL_CTX_set_session_id_context(ssl_context, (void *)&ssl_session_id_context,
sizeof ssl_session_id_context);
return ssl_context;
}
int ssl_init(void)
{
SSL_load_error_strings();
SSLeay_add_ssl_algorithms();
ssl_context = ssl_create_context(keyfile, certfile, cacert_dir, cacert_file);
if (ssl_context == NULL) {
error("Unable to create default context");
}
return 0;
}
#endif /* HAVE_LIBSSL */
pen-0.32.0/penlog.c 0000644 0001750 0001750 00000004125 12516364701 010736 0000000 0000000 /*
Copyright (C) 2000-2015 Ulric Eriksson
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "diag.h"
#define MAXBUF 1024
int main(int argc, char **argv)
{
int sk;
struct addrinfo *client, *server;
struct addrinfo hints;
char buf[MAXBUF];
int n;
if (argc < 3) {
error("Usage: %s server_ip server_port [my_ip]", argv[0]);
}
memset(&hints, 0, sizeof hints);
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_ADDRCONFIG;
n = getaddrinfo(argv[1], argv[2], &hints, &server);
if (n != 0) {
error("getaddrinfo: %s", gai_strerror(n));
}
sk = socket(server->ai_family, server->ai_socktype, server->ai_protocol);
if (sk == -1) {
error("Problem creating socket");
}
if (argc > 3) { /* set local address */
memset(&hints, 0, sizeof hints);
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_ADDRCONFIG;
n = getaddrinfo(argv[3], NULL, &hints, &client);
if (n != 0) {
error("getaddrinfo: %s", gai_strerror(n));
}
if (bind(sk, client->ai_addr, client->ai_addrlen) != 0) {
error("Problem creating socket");
}
}
while (fgets(buf, sizeof buf, stdin)) {
n = sendto(sk, buf, strlen(buf), 0,
server->ai_addr, server->ai_addrlen);
if (n < 0) {
debug("Problem sending data: %s", strerror(errno));
}
}
return 0;
}
pen-0.32.0/missing 0000755 0001750 0001750 00000015330 12423346767 010716 0000000 0000000 #! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard , 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to ."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
pen-0.32.0/settings.c 0000644 0001750 0001750 00000000407 12531541655 011313 0000000 0000000 #include "config.h"
#ifndef WINDOWS
#include
#else
#include
#endif
int foreground;
int abort_on_error = 0;
int multi_accept = 100;
int tcp_fastclose = 0;
int keepalive = 0;
int protoid = SOCK_STREAM;
int udp = 0;
int transparent = 0;
pen-0.32.0/kqueue.c 0000644 0001750 0001750 00000005640 12521104515 010743 0000000 0000000 #include "config.h"
#include
#include
#include
#include
#include "conn.h"
#include "diag.h"
#include "event.h"
#include "memory.h"
#ifdef HAVE_KQUEUE
#include
#include
#include
static int kq;
static struct kevent *kev, *kev_out;
static int nfds, maxevents;
static int count;
static int pindex;
static void kqueue_event_add(int fd, int events)
{
DEBUG(2, "kqueue_event_add(fd=%d, events=%d)", fd, events);
if (events & EVENT_READ) {
EV_SET(&kev[nfds], fd, EVFILT_READ, EV_ADD|EV_ENABLE, 0, 0, 0);
} else {
EV_SET(&kev[nfds], fd, EVFILT_READ, EV_ADD|EV_DISABLE, 0, 0, 0);
}
nfds++;
if (events & EVENT_WRITE) {
EV_SET(&kev[nfds], fd, EVFILT_WRITE, EV_ADD|EV_ENABLE, 0, 0, 0);
} else {
EV_SET(&kev[nfds], fd, EVFILT_WRITE, EV_ADD|EV_DISABLE, 0, 0, 0);
}
nfds++;
}
static void kqueue_event_arm(int fd, int events)
{
DEBUG(2, "kqueue_event_arm(fd=%d, events=%d)", fd, events);
if (events & EVENT_READ) {
EV_SET(&kev[nfds], fd, EVFILT_READ, EV_ENABLE, 0, 0, 0);
} else {
EV_SET(&kev[nfds], fd, EVFILT_READ, EV_DISABLE, 0, 0, 0);
}
nfds++;
if (events & EVENT_WRITE) {
EV_SET(&kev[nfds], fd, EVFILT_WRITE, EV_ENABLE, 0, 0, 0);
} else {
EV_SET(&kev[nfds], fd, EVFILT_WRITE, EV_DISABLE, 0, 0, 0);
}
nfds++;
}
/* The only time we call event_delete is when we are about to close the fd,
so we can save this operation since the fd will be deleted automatically.
*/
static void kqueue_event_delete(int fd)
{
DEBUG(2, "kqueue_event_delete(fd=%d)", fd);
;
}
static void kqueue_event_wait(void)
{
struct timespec tv;
DEBUG(2, "kqueue_event_wait()");
tv.tv_sec = timeout;
tv.tv_nsec = 0;
count = kevent(kq, kev, nfds, kev_out, maxevents, &tv);
DEBUG(2, "kevent returns %d", count);
if (count < 0 && errno != EINTR) {
error("Error on kevent: %s", strerror(errno));
}
pindex = -1;
nfds = 0;
}
static int kqueue_event_fd(int *revents)
{
int events = 0;
DEBUG(2, "kqueue_event_fd(revents=%p)", revents);
pindex++;
if (pindex >= count) return -1;
DEBUG(3, "\tkev_out[%d] = {filter=%d, ident=%d}", pindex, kev_out[pindex].filter, kev_out[pindex].ident);
if (kev_out[pindex].filter == EVFILT_READ) events |= EVENT_READ;
if (kev_out[pindex].filter == EVFILT_WRITE) events |= EVENT_WRITE;
*revents = events;
return kev_out[pindex].ident;
}
void kqueue_init(void)
{
kq = kqueue();
if (kq == -1) {
error("Error creating kernel queue: %s", strerror(errno));
}
maxevents = connections_max*2+2;
kev = pen_malloc(maxevents*sizeof *kev);
kev_out = pen_malloc(maxevents*sizeof *kev_out);
event_add = kqueue_event_add;
event_arm = kqueue_event_arm;
event_delete = kqueue_event_delete;
event_wait = kqueue_event_wait;
event_fd = kqueue_event_fd;
nfds = 0;
}
#else
void kqueue_init(void)
{
debug("You don't have kqueue");
exit(EXIT_FAILURE);
}
#endif
pen-0.32.0/penlogd.c 0000644 0001750 0001750 00000016676 12516404152 011113 0000000 0000000 /*
Copyright (C) 2002-2015 Ulric Eriksson
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "diag.h"
#include "settings.h"
#define PEN_MAX 1000 /* make that at least 1000 for prod */
/* This structure is statically allocated, which is wasteful but saves us
from frequest memory allocation.
*/
static struct penlog {
struct in_addr addr;
char client[100];
char request[100];
} *penlog;
static int pen_n = 0; /* next slot in buffer */
static int unbuffer = 0;
static char *logfile = NULL;
static FILE *logfp;
static char *pidfile = NULL;
static int loopflag = 1;
static int do_restart_log = 0;
static int pen_max = PEN_MAX;
static char *user = NULL, *jail = NULL;
static struct sigaction hupaction, termaction;
static void restart_log(int dummy)
{
do_restart_log = 1;
sigaction(SIGHUP, &hupaction, NULL);
}
static void quit(int dummy)
{
loopflag = 0;
}
static void store_web(char *b, int n, struct in_addr addr)
{
char request[1024];
char *p, *q;
int i, m;
b[n] = '\0';
if (debuglevel > 1) debug("store_web(%s, %d)", b, n);
p = strchr(b, '"');
if (p == NULL) {
debug("bogus web line %s", b);
return;
}
p++;
q = strchr(p, '"');
if (q == NULL) {
debug("bogus line %s", b);
return;
}
memcpy(request, p, q-p);
request[q-p] = '\0';
if (q-p < 100) m = q-p;
else m = 100;
i = pen_n-1;
if (i < 0) i = pen_max-1;
while (i != pen_n) {
if (penlog[i].request[0] &&
addr.s_addr == penlog[i].addr.s_addr &&
!strncmp(request, penlog[i].request, m)) {
break;
}
i--;
if (i < 0) i = pen_max-1;
}
if (i == pen_n) { /* no match */
fwrite(b, 1, n, logfp);
} else {
fputs(penlog[i].client, logfp);
p = strchr(b, ' ');
if (p == NULL) {
if (debuglevel) debug("Ugly");
return;
}
fwrite(p, 1, n-(p-b), logfp);
}
}
static void store_pen(char *b, int n)
{
char client[100], server[100], request[100];
#ifdef HAVE_INET_ATON
struct in_addr addr;
#else
struct hostent *hp;
#endif
b[n] = '\0';
if (sscanf(b, "+ %99[^ ] %99[^ ] %99[^\n]",
client, server, request) != 3) {
debug("discarding bogus pen line %s", b);
return;
}
if (debuglevel > 1)
debug("store_pen(%i: %s, %s, %s)",pen_n, client, server, request);
#ifdef HAVE_INET_ATON
if (inet_aton(server, &addr) == 0) {
debug("bogus address %s", server);
return;
}
penlog[pen_n].addr = addr;
#else
hp = gethostbyname(server);
memcpy(&penlog[pen_n].addr, hp->h_addr, hp->h_length);
#endif
strncpy(penlog[pen_n].client, client, 100);
strncpy(penlog[pen_n].request, request, 100);
pen_n++;
if (pen_n >= pen_max) pen_n = 0;
}
static void usage(void)
{
printf("Usage:\n"
" penlogd [options] port\n"
"\n"
" -d debugging on\n"
" -f stay in foreground\n"
" -j dir run in chroot\n"
" -l file write log to file\n"
" -b unbuffer output (Testing Only!)\n"
" -n N number of pen log entries to cache [1000]\n"
" -p file write pid to file\n"
" -u user run as alternative user\n");
exit(0);
}
static void background(void)
{
#ifdef HAVE_DAEMON
daemon(0, 0);
#else
int childpid;
if ((childpid = fork()) < 0) {
error("Can't fork");
} else {
if (childpid > 0) exit(0); /* parent */
}
setsid();
signal(SIGCHLD, SIG_IGN);
#endif
}
static int options(int argc, char **argv)
{
int c;
while ((c = getopt(argc, argv, "j:l:n:p:u:dfb")) != -1) {
switch (c) {
case 'd':
debuglevel++;
break;
case 'b':
unbuffer = 1;
break;
case 'f':
foreground = 1;
break;
case 'j':
jail = optarg;
break;
case 'l':
logfile = optarg;
break;
case 'n':
pen_max = atoi(optarg);
break;
case 'p':
pidfile = optarg;
break;
case 'u':
user = optarg;
break;
default:
usage();
}
}
return optind;
}
int main(int argc, char **argv)
{
struct passwd *pwd = NULL;
struct sockaddr_in a;
socklen_t len;
int ld, p;
char b[1024];
int n = options(argc, argv);
argc -= n;
argv += n;
if (argc < 1 || (p = atoi(argv[0])) == 0) {
usage();
exit(0);
}
penlog = malloc(pen_max * sizeof *penlog);
if (!penlog) error("Can't allocate penlog");
if (!foreground) background();
if (user) {
if (debuglevel) debug("Run as user %s", user);
pwd = getpwnam(user);
if (pwd == NULL) error("Can't getpwnam(%s)", user);
}
if (jail) {
if (debuglevel) debug("Run in %s", jail);
if (chroot(jail) == -1) error("Can't chroot(%s)", jail);
}
if (pwd) {
if (setuid(pwd->pw_uid) == -1)
error("Can't setuid(%d)", (int)pwd->pw_uid);
}
if (logfile) {
if (debuglevel) debug("Logging to %s", logfile);
logfp = fopen(logfile, "a");
if (!logfp) error("Can't open logfile %s", logfile);
if (unbuffer) setvbuf(logfp, (char *)NULL, _IOLBF, 0);
} else {
if (debuglevel) debug("Logging to stdout");
logfp = stdout;
}
if (pidfile) {
FILE *pidfp = fopen(pidfile, "w");
if (debuglevel) {
debug("Writing pid %d to %s",
(int)getpid(), pidfile);
}
if (!pidfp) error("Can't create pidfile %s", pidfile);
fprintf(pidfp, "%d", (int)getpid());
fclose(pidfp);
}
if ((ld = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
error("Problem creating socket");
}
a.sin_family = AF_INET;
a.sin_addr.s_addr = htonl(INADDR_ANY);
a.sin_port = htons(p);
if (bind(ld, (struct sockaddr *) &a, sizeof(a)) < 0) {
error("Problem binding");
}
len = sizeof a;
if (getsockname(ld, (struct sockaddr *) &a, &len) < 0) {
error("Error getsockname");
}
hupaction.sa_handler = restart_log;
sigemptyset(&hupaction.sa_mask);
hupaction.sa_flags = 0;
sigaction(SIGHUP, &hupaction, NULL);
termaction.sa_handler = quit;
sigemptyset(&termaction.sa_mask);
termaction.sa_flags = 0;
sigaction(SIGTERM, &termaction, NULL);
loopflag = 1;
if (debuglevel) debug("Enter main loop\n");
while (loopflag) {
if (do_restart_log) {
if (debuglevel) debug("Reopen log file %s", logfile);
if (logfp != stdout) {
fclose(logfp);
logfp = fopen(logfile, "a");
if (!logfp) error("Can't open %s", logfile);
if (unbuffer) setvbuf(logfp, (char *)NULL, _IOLBF, 0);
}
do_restart_log = 0;
}
n = recvfrom(ld, b, sizeof b, 0, (struct sockaddr *) &a, &len);
if (n < 0) {
if (errno != EINTR)
debug("Error receiving data: %s", strerror(errno));
continue;
}
b[n] = 0;
#if 0 /* what on earth would send us something like that? */
if (strstr(b, "Host:")) {
continue; /* do nothing */
#endif
if (b[0] == '+') {
store_pen(b, n);
} else {
store_web(b, n, a.sin_addr);
}
}
if (debuglevel) debug("Exit main loop");
if (logfp) fclose(logfp);
if (pidfile) unlink(pidfile);
return 0;
}
pen-0.32.0/client.c 0000644 0001750 0001750 00000004641 12622544530 010731 0000000 0000000 #include "config.h"
#include
#ifndef WINDOWS
#include
#endif
#include "client.h"
#include "conn.h"
#include "diag.h"
#include "memory.h"
#include "netconv.h"
#include "pen.h"
#include "server.h"
client *clients;
int clients_max = 0;
int client_acl;
/* Store client and return index */
int store_client(struct sockaddr_storage *cli)
{
int i;
int empty = -1; /* first empty slot */
int oldest = -1; /* in case we need to recycle */
struct sockaddr_in *si;
struct sockaddr_in6 *si6;
int family = cli->ss_family;
unsigned long ad = 0;
void *ad6 = 0;
if (family == AF_INET) {
si = (struct sockaddr_in *)cli;
ad = si->sin_addr.s_addr;
} else if (family == AF_INET6) {
si6 = (struct sockaddr_in6 *)cli;
ad6 = &si6->sin6_addr;
}
for (i = 0; i < clients_max; i++) {
/* look for client with same family and address */
if (family == clients[i].addr.ss_family) {
if (family == AF_UNIX) break;
if (family == AF_INET) {
si = (struct sockaddr_in *)&clients[i].addr;
if (ad == si->sin_addr.s_addr) break;
}
if (family == AF_INET6) {
si6 = (struct sockaddr_in6 *)&clients[i].addr;
if (!memcmp(ad6, &si6->sin6_addr, sizeof *ad6)) break;
}
}
/* recycle slots of client that haven't been used for some time */
if (tracking_time > 0 && clients[i].last+tracking_time < now) {
/* too old, recycle */
clients[i].last = 0;
}
/* we already have an empty slot but keep looking for known client */
if (empty != -1) continue;
/* remember this empty slot in case we need it later */
if (clients[i].last == 0) {
empty = i;
continue;
}
/* and if we can't find any reusable slot we'll reuse the oldest one */
if (oldest == -1 || (clients[i].last < clients[oldest].last)) {
oldest = i;
}
}
/* reset statistics in case this is a "new" client */
if (i == clients_max) {
if (empty != -1) i = empty;
else i = oldest;
DEBUG(2, "Resetting client stats for slot %d", i);
clients[i].connects = 0;
clients[i].csx = 0;
clients[i].crx = 0;
clients[i].server = NO_SERVER;
}
clients[i].last = now;
clients[i].addr = *cli;
clients[i].connects++;
DEBUG(2, "Client %s has index %d", pen_ntoa(cli), i);
return i;
}
void expand_clienttable(int size)
{
if (size <= clients_max) return; /* nothing to do */
clients = pen_realloc(clients, size*sizeof *clients);
memset(&clients[clients_max], 0, (size-clients_max)*sizeof clients[0]);
clients_max = size;
}
pen-0.32.0/depcomp 0000755 0001750 0001750 00000056016 12423346767 010702 0000000 0000000 #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva .
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to .
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
pen-0.32.0/README 0000644 0001750 0001750 00000004467 12566550425 010204 0000000 0000000
This is pen, a load balancer for udp and tcp based protocols such as
dns, http or smtp. It allows several servers to appear as one to the
outside and automatically detects servers that are down and distributes
clients among the available servers. This gives high availability and
scalable performance.
The load balancing algorithm keeps track of clients and will try to
send them back to the server they visited the last time. The client
table has a number of slots (default 2048, settable through command-line
arguments). When the table is full, the least recently used one will
be thrown out to make room for the new one.
This is superior to a simple round-robin algorithm, which sends a client
that connects repeatedly to different servers. Doing so breaks
applications that maintain state between connections in the server,
including most modern web applications.
When pen detects that a server is unavailable, it scans for another
starting with the server after the most recently used one. That way
we get load balancing and "fair" failover for free.
Correctly configured, pen can ensure that a server farm is always
available, even when individual servers are brought down for maintenance
or reconfiguration. The final single point of failure, pen itself,
can be eliminated by running pen on several servers, using vrrp to
decide which is active.
A side-effect of load-balancing web servers is that several logfiles
are produced, and by default, Pen operates in a proxy mode that makes
all accesses seem to come from the load balancer.
The program penlogd solves this problem by merging pen's log file
with the ones produced by the web servers. See penlogd(1) and penlog(1)
for details.
The Direct Server Return and Transparent Reverse Proxy modes make
accesses seem to come directly from the client. Multiple logfiles
are still created, and Penlogd can still be used to consolidate them
automatically.
This load balancer is known to work on FreeBSD, Linux, HP-UX and Solaris.
Other Unixes should work as well, possibly requiring trivial changes.
Success stories or problem reports are welcome.
If pen is started with the -w option, statistics are saved in html
format when a USR1 signal is received. The cgi script penstats can
be used to simplify this; it must be edited to reflect local conditions.
I am Ulric Eriksson, ulric@siag.nu.
pen-0.32.0/select.c 0000644 0001750 0001750 00000004747 12524651724 010746 0000000 0000000 #include "config.h"
#include
#include
#include
#include
#ifdef WINDOWS
#include
#endif
#if defined HAVE_SYS_SELECT_H && !defined WINDOWS
/* because windows doesn't have it */
#include
#endif
//#include "pen.h"
#include "conn.h"
#include "diag.h"
#include "event.h"
static fd_set w_read, w_write;
static fd_set w_r_copy, w_w_copy;
static int w_max;
static void select_event_ctl(int fd, int events)
{
DEBUG(2, "select_event_ctl(fd=%d, events=%d)", fd, events);
if (events & EVENT_READ) FD_SET(fd, &w_read);
else FD_CLR(fd, &w_read);
if (events & EVENT_WRITE) FD_SET(fd, &w_write);
else FD_CLR(fd, &w_write);
if (events) {
if (fd >= w_max) w_max = fd+1;
}
}
static void select_event_add(int fd, int events)
{
DEBUG(2, "select_event_add(fd=%d, events=%d)", fd, events);
select_event_ctl(fd, events);
}
static void select_event_arm(int fd, int events)
{
DEBUG(2, "select_event_arm(fd=%d, events=%d)", fd, events);
select_event_ctl(fd, events);
}
static void select_event_delete(int fd)
{
DEBUG(2, "select_event_delete(fd=%d)", fd);
FD_CLR(fd, &w_read);
FD_CLR(fd, &w_write);
}
static int fd;
static void select_event_wait(void)
{
int n, err;
struct timeval tv;
DEBUG(2, "select_event_wait()");
tv.tv_sec = timeout;
tv.tv_usec = 0;
memcpy(&w_r_copy, &w_read, sizeof w_read);
memcpy(&w_w_copy, &w_write, sizeof w_write);
fd = -1;
n = select(w_max, &w_r_copy, &w_w_copy, 0, &tv);
err = socket_errno;
DEBUG(2, "select returns %d, socket_errno=%d", n, err);
if (n < 0 && err != EINTR) {
error("Error on select: %s", strerror(errno));
}
}
static int select_event_fd(int *revents)
{
int events = 0;
DEBUG(2, "select_event_fd(revents=%p)", revents);
for (fd++; fd < w_max; fd++) {
if (FD_ISSET(fd, &w_r_copy)) events |= EVENT_READ;
if (FD_ISSET(fd, &w_w_copy)) events |= EVENT_WRITE;
if (events) {
*revents = events;
return fd;
}
}
return -1;
}
void select_init(void)
{
DEBUG(2, "select_init()");
if ((connections_max*2+10) > FD_SETSIZE) {
error("Number of simultaneous connections to large.\n"
"Maximum is %d, or re-build pen with larger FD_SETSIZE",
(FD_SETSIZE-10)/2);
}
FD_ZERO(&w_read);
FD_ZERO(&w_write);
w_max = 0;
event_add = select_event_add;
event_arm = select_event_arm;
event_delete = select_event_delete;
event_wait = select_event_wait;
event_fd = select_event_fd;
}
pen-0.32.0/dsr.c 0000644 0001750 0001750 00000042711 12624554430 010245 0000000 0000000 #include "config.h"
#include
#include
#include
#include "acl.h"
#include "pen.h"
#include "diag.h"
#include "memory.h"
#include "server.h"
#include "settings.h"
int tarpit_acl = -1;
#if defined(HAVE_LINUX_IF_PACKET_H) || defined(HAVE_NET_NETMAP_USER_H)
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static char *mac2str(unsigned char *b)
{
static char p[100];
snprintf(p, sizeof p, "%02x:%02x:%02x:%02x:%02x:%02x",
b[0], b[1], b[2], b[3], b[4], b[5]);
return p;
}
static char *type2str(int type)
{
switch (type) {
case 0x0800: return "IPv4";
case 0x0806: return "ARP";
case 0x8100: return "802.1Q";
case 0x86DD: return "IPv6";
default: return "Unknown";
}
}
static char *proto2str(int proto)
{
switch (proto) {
case 0x01: return "ICMP";
case 0x06: return "TCP";
case 0x17: return "UDP";
default: return "Other";
}
}
static void hexdump(uint8_t *b, int n)
{
int i;
for (i = 0; i < n; i++) {
printf("%02x ", b[i]);
if ((i % 8) == 7) printf("\n");
}
if (i % 8) printf("\n");
}
#define MAXBUF 32000
#define MAC_DST(f) (uint8_t *)(f)
#define MAC_SRC(f) (uint8_t *)(f+6)
#define ETHERTYPE(f) (uint16_t *)(f+12)
#define PAYLOAD(f) (f+14)
#define ARP_HTYPE(f) (uint16_t *)(PAYLOAD(f))
#define ARP_PTYPE(f) (uint16_t *)(PAYLOAD(f)+2)
#define ARP_HLEN(f) (uint8_t *)(PAYLOAD(f)+4)
#define ARP_PLEN(f) (uint8_t *)(PAYLOAD(f)+5)
#define ARP_OPER(f) (uint16_t *)(PAYLOAD(f)+6)
#define ARP_SHA(f) (uint8_t *)(PAYLOAD(f)+8)
#define ARP_SPA(f) (struct in_addr *)(PAYLOAD(f)+14)
#define ARP_THA(f) (uint8_t *)(PAYLOAD(f)+18)
#define ARP_TPA(f) (struct in_addr *)(PAYLOAD(f)+24)
#define IPV4_IHL(f) (uint8_t *)(PAYLOAD(f))
#define IPV4_PROTOCOL(f) (uint8_t *)(PAYLOAD(f)+9)
#define IPV4_SRC(f) (struct in_addr *)(PAYLOAD(f)+12)
#define IPV4_DST(f) (struct in_addr *)(PAYLOAD(f)+16)
static int port;
static uint8_t *buf;
static struct in_addr our_ip_addr;
static uint8_t our_hw_addr[6];
/* OS specific features */
#ifdef HAVE_LINUX_IF_PACKET_H
#include
#include
static int dsr_init_os(char *dsr_if)
{
int fd, n, ifindex;
struct ifreq ifr;
struct sockaddr_ll sll;
fd = socket_nb(AF_PACKET, SOCK_RAW, IPPROTO_RAW);
buf = pen_malloc(MAXBUF);
memset(&ifr, 0, sizeof ifr);
/* display mac */
strncpy(ifr.ifr_name, dsr_if, IFNAMSIZ-1);
n = ioctl(fd, SIOCGIFHWADDR, &ifr);
if (n == -1) debug("ioctl: %s", strerror(errno));
memcpy(our_hw_addr, ifr.ifr_hwaddr.sa_data, 6);
DEBUG(2, "Our hw addr: %s\n", mac2str(our_hw_addr));
/* display interface number */
ioctl(fd, SIOCGIFINDEX, &ifr);
ifindex = ifr.ifr_ifindex;
DEBUG(2, "Index = %d", ifindex);
/* bind to interface */
memset(&sll, 0, sizeof sll);
sll.sll_family = AF_PACKET;
sll.sll_ifindex = ifindex;
sll.sll_protocol = htons(ETH_P_ALL);
if (bind(fd, (struct sockaddr *)&sll, sizeof sll) == -1) {
error("bind: %s", strerror(errno));
}
return fd;
}
static int send_packet(int fd, const void *b, int len)
{
int n = sendto(fd, b, len, 0, NULL, 0);
if (n == -1) { /* fail */
DEBUG(2, "Can't send %d bytes: %s", len, strerror(errno));
}
return n;
}
static int recv_packet(int fd, void *buf)
{
int n = recvfrom(fd, buf, MAXBUF, 0, NULL, NULL);
DEBUG(2, "Received %d bytes", n);
return n;
}
static int max_pkts(void)
{
return multi_accept;
}
#else /* HAVE_NET_NETMAP_USER_H */
#include
#include
#define NETMAP_WITH_LIBS
#include
static struct nm_desc *d;
static int dsr_init_os(char *dsr_if)
{
int fd;
struct ifaddrs *ifa, *a;
struct sockaddr_dl *dl;
if (getifaddrs(&ifa)) {
error("Can't get list of interfaces: %s", strerror(errno));
}
for (a = ifa; a; a = a->ifa_next) {
if ((a->ifa_addr->sa_family == AF_LINK) &&
(strcmp(a->ifa_name, dsr_if) == 0)) {
break;
}
}
if (a == NULL) {
error("Can't find interface %s", dsr_if);
}
dl = (struct sockaddr_dl *)a->ifa_addr;
memcpy(our_hw_addr, dl->sdl_data+dl->sdl_nlen, 6);
DEBUG(2, "Our hw addr: %s\n", mac2str(our_hw_addr));
char ifname[100];
snprintf(ifname, sizeof ifname, "netmap:%s", dsr_if);
d = nm_open(ifname, NULL, 0, 0);
DEBUG(2, "first_tx_ring = %d, last_tx_ring = %d, first_rx_ring = %d, last_rx_ring = %d",
d->first_tx_ring, d->last_tx_ring, d->first_rx_ring, d->last_rx_ring);
fd = NETMAP_FD(d);
buf = pen_malloc(MAXBUF);
return fd;
}
static int send_packet(int fd, const void *b, int len)
{
int n = nm_inject(d, b, len);
if (n == 0) { /* fail */
DEBUG(2, "Can't send %d bytes", len);
return -1;
}
return n;
}
static int recv_packet(int fd, void *buf)
{
int n;
struct nm_pkthdr h;
uint8_t *b = nm_nextpkt(d, &h);
if (b == NULL) return -1;
n = h.caplen;
DEBUG(2, "Received %d bytes", n);
memcpy(buf, b, n);
return n;
}
static int max_pkts(void)
{
int in, out, m;
m = multi_accept;
in = nm_ring_space(NETMAP_RXRING(d->nifp, 0));
if (in < m) m = in;
out = nm_ring_space(NETMAP_TXRING(d->nifp, 0));
if (out < m) m = out;
DEBUG(3, "multi_accept = %d, in = %d, out = %d => m = %d", multi_accept, in, out, m);
return m;
}
#endif
/* returns a raw socket or -1 for failure */
int dsr_init(char *dsr_if, char *listenport)
{
char *dsr_ip, *dsr_port;
dsr_ip = strtok(listenport, ":");
dsr_port = strtok(NULL, ":");
if (dsr_port) port = atoi(dsr_port);
else port = 0;
if (inet_aton(dsr_ip, &our_ip_addr) == 0) {
debug("Address %s is not valid", dsr_ip);
return -1;
}
return dsr_init_os(dsr_if);
}
void send_arp_request(int fd, struct in_addr *a)
{
debug("MAC_DST(%p) = %p", buf, MAC_DST(buf));
memset(MAC_DST(buf), 0xff, 6);
memcpy(MAC_SRC(buf), our_hw_addr, 6);
*ETHERTYPE(buf) = htons(0x0806);
*ARP_HTYPE(buf) = htons(1);
*ARP_PTYPE(buf) = htons(0x0800);
*ARP_HLEN(buf) = 6;
*ARP_PLEN(buf) = 4;
*ARP_OPER(buf) = htons(1);
memcpy(ARP_SHA(buf), our_hw_addr, 6);
memset(ARP_SPA(buf), 0, 4);
memset(ARP_THA(buf), 0, 6);
memcpy(ARP_TPA(buf), a, 4);
hexdump(buf, 42);
DEBUG(2, "Sending arp request");
send_packet(fd, buf, 42);
}
static void store_hwaddr(struct in_addr *ip, uint8_t *hw)
{
int server;
DEBUG(2, "Storing ARP reply");
DEBUG(2, "Real address %s has hardware address %s",
inet_ntoa(*ip), mac2str(hw));
for (server = 0; server < nservers; server++) {
struct sockaddr_storage *a = &servers[server].addr;
if (a->ss_family == AF_INET) {
struct sockaddr_in *si = (struct sockaddr_in *)a;
if (memcmp(ip, &(si->sin_addr), 4) == 0) {
memcpy(servers[server].hwaddr, hw, 6);
}
}
}
}
/* returns 1 if this is an arp request for us, 0 otherwise */
static int our_arp(uint16_t arp_htype, uint16_t arp_ptype, uint16_t arp_oper, struct sockaddr_in *dest)
{
if ((arp_htype != 1) || (arp_ptype != 0x0800) || (arp_oper != 1)) return 0;
if (memcmp(&dest->sin_addr.s_addr, &our_ip_addr, 4) == 0) return 1;
return match_acl(tarpit_acl, (struct sockaddr_storage *)dest);
}
static void arp_frame(int fd, int n)
{
uint16_t arp_htype, arp_ptype, arp_oper;
struct sockaddr_in dest;
memcpy(&dest.sin_addr.s_addr, ARP_TPA(buf), 4);
dest.sin_family = AF_INET;
DEBUG(2, "ARP");
arp_htype = ntohs(*ARP_HTYPE(buf));
arp_ptype = ntohs(*ARP_PTYPE(buf));
arp_oper = ntohs(*ARP_OPER(buf));
DEBUG(2, "Hardware type: %d / %s", arp_htype,
arp_htype == 1 ? "Ethernet" : "Other");
DEBUG(2, "Protocol type: 0x%x / %s", arp_ptype,
arp_ptype == 0x0800 ? "IPv4" : "Other");
DEBUG(2, "Operation: %d / %s", arp_oper,
arp_oper == 1 ? "Request" : "Reply");
DEBUG(2, "Sender hardware address: %s", mac2str(ARP_SHA(buf)));
DEBUG(2, "Sender protocol address: %s", inet_ntoa(*ARP_SPA(buf)));
DEBUG(2, "Target hardware address: %s", mac2str(ARP_THA(buf)));
DEBUG(2, "Target protocol address: %s", inet_ntoa(*ARP_TPA(buf)));
if (our_arp(arp_htype, arp_ptype, arp_oper, &dest)) {
hexdump(buf, n);
DEBUG(2, "We should reply to this.");
memcpy(MAC_DST(buf), ARP_SHA(buf), 6);
memcpy(MAC_SRC(buf), our_hw_addr, 6);
*ARP_OPER(buf) = htons(2);
memcpy(ARP_THA(buf), ARP_SHA(buf), 6);
memcpy(ARP_TPA(buf), ARP_SPA(buf), 4);
memcpy(ARP_SHA(buf), our_hw_addr, 6);
// memcpy(ARP_SPA(buf), &our_ip_addr, 4);
memcpy(ARP_SPA(buf), &dest.sin_addr.s_addr, 4);
DEBUG(2, "Sending %d bytes", n);
n = send_packet(fd, buf, n);
} else if ((arp_htype == 1) &&
(arp_ptype == 0x0800) &&
(arp_oper == 2)) {
store_hwaddr(ARP_SPA(buf), ARP_SHA(buf));
}
}
static int real_hw_known(int server)
{
static uint8_t zero[6] = {0, 0, 0, 0, 0, 0};
return (memcmp(servers[server].hwaddr, zero, 6) != 0);
}
#define HASH_INDEX_SIZE 256
static uint16_t hash_index[HASH_INDEX_SIZE];
static int rebuild_hash_index(void)
{
int i, j;
int t; /* number of slots to fill */
int *s; /* how many slots should each server occupy */
int ls; /* number of live, available servers */
int tw; /* total weights of all available servers */
int w;
DEBUG(3, "rebuild_hash_index()");
s = pen_malloc(nservers*sizeof *s);
/* first count how many servers we have */
ls = 0;
tw = 0;
for (i = 0; i < nservers; i++) {
if (server_is_unavailable(i)) {
s[i] = -1;
} else {
if (servers[i].weight > 0) {
s[i] = servers[i].weight;
} else {
s[i] = 1;
}
tw += s[i];
ls++;
}
}
DEBUG(3, "%d servers with total weight %d", ls, tw);
if (tw == 0) {
debug("No available servers, can't rebuild");
free(s);
return 0; /* without setting ALG_HASH_VALID */
}
t = HASH_INDEX_SIZE;
for (i = 0; i < nservers; i++) {
if (s[i] == -1) continue;
w = t*s[i]/tw;
t -= w;
tw -= s[i];
s[i] = w;
DEBUG(3, "Server %d gets %d slots; %d weight and %d slots remaining", i, w, tw, t);
}
t = HASH_INDEX_SIZE;
j = 0;
for (i = 0; t; i = (i+3) % HASH_INDEX_SIZE) {
while (s[j] <= 0) j++;
hash_index[i] = j;
s[j]--;
t--;
}
#if 0
for (i = 0; i < HASH_INDEX_SIZE; i++) {
printf("%d ", hash_index[i]);
}
printf("\n");
#endif
/* finally claim that the hash index is up to date */
server_alg |= ALG_HASH_VALID;
free(s);
return 1;
}
static int hash(struct in_addr *a, uint16_t port)
{
uint8_t *p = (uint8_t *)&a->s_addr;
int h = p[0]^p[1]^p[2]^p[3];
if (server_alg & ALG_ROUNDROBIN) {
p = (uint8_t *)&port;
h = h^p[0]^p[1];
}
return h;
}
static int select_server(struct in_addr *a, uint16_t port)
{
int h = hash(a, port);
int i;
if ((server_alg & ALG_HASH_VALID) == 0) {
if (!rebuild_hash_index()) return NO_SERVER; /* failure */
}
i = hash_index[h];
DEBUG(3, "select_server returning server %d for hash %d", i, h);
return i;
}
#define TCP_SEGMENT(f, i) (PAYLOAD(f)+i)
#define TCP_SRC_PORT(f, i) (uint16_t *)(TCP_SEGMENT(f, i))
#define TCP_DST_PORT(f, i) (uint16_t *)(TCP_SEGMENT(f, i)+2)
#define TCP_SEQ_NR(f, i) (uint32_t *)(TCP_SEGMENT(f, i)+4)
#define TCP_ACK_NR(f, i) (uint32_t *)(TCP_SEGMENT(f, i)+8)
#define TCP_FLAGS(f, i) (uint16_t *)(TCP_SEGMENT(f, i)+12)
#define TCP_WINDOW(f, i) (uint16_t *)(TCP_SEGMENT(f, i)+14)
#define TCP_CHECKSUM(f, i) (uint16_t *)(TCP_SEGMENT(f, i)+16)
#define TCP_URGENT(f, i) (uint16_t *)(TCP_SEGMENT(f, i)+18)
#define TCP_OPTIONS(f, i) (uint8_t *)(TCP_SEGMENT(f, i)+20)
#define UDP_SEGMENT(f, i) (PAYLOAD(f)+i)
#define UDP_SRC_PORT(f, i) (uint16_t *)(UDP_SEGMENT(f, i))
#define UDP_DST_PORT(f, i) (uint16_t *)(UDP_SEGMENT(f, i)+2)
struct ptcp_header {
uint32_t src, dst;
uint8_t zero, protocol;
uint16_t length;
};
static int ipv4_frame(int fd, int n)
{
uint8_t ipv4_protocol;
uint8_t ipv4_ihl;
uint16_t src_port, dst_port;
int server;
struct sockaddr_in dest;
DEBUG(2, "IPv4");
ipv4_ihl = ((*IPV4_IHL(buf)) & 0xf)*4;
ipv4_protocol = *IPV4_PROTOCOL(buf);
DEBUG(2, "IPv4 header size: %d bytes", ipv4_ihl);
DEBUG(2, "Protocol: %d / %s", ipv4_protocol, proto2str(ipv4_protocol));
DEBUG(2, "Sender IPv4 address: %s", inet_ntoa(*IPV4_SRC(buf)));
DEBUG(2, "Destination IPv4 address: %s", inet_ntoa(*IPV4_DST(buf)));
dest.sin_family = AF_INET;
dest.sin_addr = *IPV4_DST(buf);
if (udp) {
DEBUG(3, "Doing udp");
if ((ipv4_protocol == 17) &&
(*(uint32_t *)IPV4_DST(buf) == (uint32_t)our_ip_addr.s_addr)) {
DEBUG(2, "We should forward this.");
src_port = htons(*UDP_SRC_PORT(buf, ipv4_ihl));
dst_port = htons(*UDP_DST_PORT(buf, ipv4_ihl));
server = select_server(IPV4_SRC(buf), src_port);
if (server == NO_SERVER) {
debug("Dropping frame, nowhere to put it");
return -1;
}
if (!real_hw_known(server)) {
DEBUG(2, "Real hw addr unknown");
return -1;
}
DEBUG(2, "Source port = %d, destination port = %d",
src_port, dst_port);
if (port == 0 || dst_port == port) {
memcpy(MAC_DST(buf), servers[server].hwaddr, 6);
DEBUG(2, "Sending %d bytes", n);
n = send_packet(fd, buf, n);
}
}
} else { /* not udp, i.e. tcp */
DEBUG(3, "Doing tcp");
if (ipv4_protocol == 6) {
if (match_acl(tarpit_acl, (struct sockaddr_storage *)&dest)) {
struct ptcp_header ph;
int i;
unsigned char src_mac[6];
uint32_t seq_nr;
uint16_t flags = ntohs(*TCP_FLAGS(buf, ipv4_ihl));
uint32_t checksum;
uint16_t *csp;
DEBUG(2, "Tarpitting: flags = 0x%x");
if ((flags & 0x0002) == 0) return 0; /* not SYN */
/* fill in the pseudo header fields */
memcpy(&ph.src, IPV4_DST(buf), 4);
memcpy(&ph.dst, IPV4_SRC(buf), 4);
ph.zero = 0; /* :P */
ph.protocol = 6; /* tcp */
ph.length = htons(40); /* 5 32-bit words */
DEBUG(2, "We should tarpit this");
/* reverse everything to make the syn+ack frame */
/* reverse mac addresses */
memcpy(src_mac, MAC_SRC(buf), 6);
memcpy(MAC_SRC(buf), MAC_DST(buf), 6);
memcpy(MAC_DST(buf), src_mac, 6);
/* reverse ip addresses */
*IPV4_DST(buf) = *IPV4_SRC(buf);
*IPV4_SRC(buf) = dest.sin_addr;
/* reverse port numbers */
src_port = ntohs(*TCP_SRC_PORT(buf, ipv4_ihl));
*TCP_SRC_PORT(buf, ipv4_ihl) = *TCP_DST_PORT(buf, ipv4_ihl);
*TCP_DST_PORT(buf, ipv4_ihl) = htons(src_port);
/* reverse sequence numbers */
seq_nr = ntohl(*TCP_SEQ_NR(buf, ipv4_ihl));
*TCP_SEQ_NR(buf, ipv4_ihl) = htonl(42); /* our random number */
*TCP_ACK_NR(buf, ipv4_ihl) = htonl(seq_nr+1);
/* 5 words of tcp header and SYN+ACK */
*TCP_FLAGS(buf, ipv4_ihl) = htons((5 << 12) | 0x0012);
*TCP_CHECKSUM(buf, ipv4_ihl) = 0;
*TCP_URGENT(buf, ipv4_ihl) = 0;
checksum = 0;
csp = (uint16_t *)&ph;
for (i = 0; i < 6; i++) {
checksum += ntohs(csp[i]);
}
csp = (uint16_t *)TCP_SRC_PORT(buf, ipv4_ihl);
for (i = 0; i < 10; i++) {
checksum += ntohs(csp[i]);
}
checksum = (checksum & 0xffff) + (checksum >> 16);
checksum ^= 0xffff;
*TCP_CHECKSUM(buf, ipv4_ihl) = htons(checksum);
DEBUG(2, "Checksum = 0x%x", checksum);
/* ignore options */
uint8_t offset = (flags >> 12);
DEBUG(2, "Offset = %d => %d bytes of options", offset, 4*(offset-5));
uint8_t *options = TCP_OPTIONS(buf, ipv4_ihl);
DEBUG(2, "Options start at %p", options);
i = 0;
for (i = 0; i < 4*(offset-5); i++) {
options[i] = 0;
}
n = send_packet(fd, buf, n);
} else if (*(uint32_t *)IPV4_DST(buf) == (uint32_t)our_ip_addr.s_addr) {
DEBUG(2, "We should forward this.");
src_port = ntohs(*TCP_SRC_PORT(buf, ipv4_ihl));
dst_port = ntohs(*TCP_DST_PORT(buf, ipv4_ihl));
server = select_server(IPV4_SRC(buf), src_port);
if (server == NO_SERVER) {
debug("Dropping frame, nowhere to put it");
return -1;
}
if (!real_hw_known(server)) {
DEBUG(2, "Real hw addr unknown");
return -1;
}
DEBUG(2, "Source port = %d, destination port = %d",
src_port, dst_port);
if (port == 0 || dst_port == port) {
memcpy(MAC_DST(buf), servers[server].hwaddr, 6);
DEBUG(2, "Sending %d bytes", n);
n = send_packet(fd, buf, n);
}
}
}
}
return 0;
}
void dsr_arp(int fd)
{
int server, since;
static time_t last_arp = 0;
struct sockaddr_in *si;
DEBUG(2, "dsr_arp(%d)", fd);
since = now-last_arp;
DEBUG(2, "%d seconds since last update", since);
if (since) {
DEBUG(2, "Going through the server list");
for (server = 0; server < nservers; server++) {
DEBUG(2, "Checking server %d", server);
if (unused_server_slot(server)) {
DEBUG(2, "Server slot %d is unused", server);
continue;
}
if (real_hw_known(server) && since < 60) {
DEBUG(2, "Server %d hw address is known", server);
continue;
}
si = (struct sockaddr_in *)&servers[server].addr;
send_arp_request(fd, &si->sin_addr);
last_arp = now;
}
}
}
void dsr_frame(int fd)
{
int i, type, n, limit;
static int dirty_bytes = 0;
if (dirty_bytes) {
DEBUG(1, "Retrying transmission of %d bytes", dirty_bytes);
n = send_packet(fd, buf, dirty_bytes);
if (n == -1) {
DEBUG(2, "Failed again, discarding packet");
}
}
limit = max_pkts();
for (i = 0; i < limit; i++) {
dirty_bytes = recv_packet(fd, buf);
if (dirty_bytes == -1) {
dirty_bytes = 0;
break;
}
DEBUG(2, "MAC destination: %s", mac2str(MAC_DST(buf)));
DEBUG(2, "MAC source: %s", mac2str(MAC_SRC(buf)));
type = ntohs(*ETHERTYPE(buf));
DEBUG(2, "EtherType: %s", type2str(type));
switch (type) {
case 0x0806:
arp_frame(fd, dirty_bytes);
break;
case 0x0800:
if (ipv4_frame(fd, dirty_bytes) == -1) {
DEBUG(2, "Couldn't process frame, retry later");
goto End;
}
break;
default:
DEBUG(2, "Other (%x)", type);
}
dirty_bytes = 0;
}
End:
DEBUG(2, "Processed %d frames, %d bytes remaining", i, dirty_bytes);
}
#else
int dsr_init(char *dsr_if, char *dsr_ip)
{
error("Direct server return is not available");
return -1;
}
void dsr_arp(int fd)
{
error("Direct server return is not available");
}
void dsr_frame(int fd)
{
error("Direct server return is not available");
}
#endif
pen-0.32.0/idlers.c 0000644 0001750 0001750 00000001433 12531071327 010727 0000000 0000000 #include "config.h"
#include "conn.h"
#include "diag.h"
#include "idlers.h"
#include "server.h"
int idlers = 0, idlers_wanted = 0;
void close_idlers(int n)
{
int conn;
DEBUG(2, "close_idlers(%d)", n);
for (conn = 0; n > 0 && conn < connections_max; conn++) {
if (idler(conn)) {
DEBUG(3, "Closing idling connection %d", conn);
close_conn(conn);
n--;
}
}
}
int add_idler(void)
{
#ifdef HAVE_LIBSSL
int conn = store_conn(-1, NULL, -1);
#else
int conn = store_conn(-1, -1);
#endif
if (conn == -1) return 0;
conns[conn].initial = server_by_roundrobin();
if (conns[conn].initial == NO_SERVER) {
close_conn(conn);
return 0;
}
if (!try_server(conns[conn].initial, conn)) {
if (!failover_server(conn)) {
close_conn(conn);
return 0;
}
}
idlers++;
return 1;
}
pen-0.32.0/ChangeLog 0000644 0001750 0001750 00000061250 12624554761 011071 0000000 0000000
151123 Released 0.32.0.
151120 Added tarpit test case to testsuite.sh.
151117 Tarpit functionality to be used with the DSR mode.
151112 pen.1: removed obsolete -S option, updated defaults for -x and -L.
151105 Released 0.31.1.
151103 In failover_server: sanity checks to failover routine.
151102 In add_client: add the initial server to .client as well as .initial.
151029 In failover_server: changed abuse_server to ABUSE_SERVER and emerg_server
to EMERG_SERVER, to handle their default NO_SERVER values.
See issue #19 on Github.
151012 At the suggestion from Marcos Vinicius Rogowski, the hash algorith
will now include the client port number if the -r (roundrobin)
option is used. See https://github.com/UlricE/pen/pull/18
Released 0.31.0.
150915 Officially released 0.30.1.
150909 Fixed IP-based client tracking.
150828 Removed unnecessary #include in dlist.c
150818 Released 0.30.0.
150803 Added UDP mode for Direct Server Return.
150803 Updated configure.ac for compatibility with CentOS 6.
150725 Added #ifdef around SSLv3 initialization code in ssl, as
suggested by jca@openbsd.org.
150608 Released 0.29.0.
150528 Transparent reverse proxy support for Linux, FreeBSD and OpenBSD.
150527 Allow the client table size to be updated on the fly. Default size still 2048.
Allow the connection table size to be updated in the fly. Default still 500.
See penctl.1, options clients_max and conn_max.
150526 Introduced the macro NO_SERVER to be used instead of -1 to signify
error conditions and such.
Removed the fixed server table size along with the -S option.
150525 Fixed cosmetic bug in startup code which required port to be specified
on backend servers even if it was the same as the listening port.
150520 Released 0.28.0.
150513 Numerous updates to support the madness that is Windows.
150501 Fix from Vincent Bernat: segfault when not using SSL.
150427 DSR support using Netmap on FreeBSD.
Unbroke DSR on Linux.
150424 Replaced all calls to perror with debug(..., strerror(errno);
Updated penlog and penlogd to use diag.[ch].
150422 More refactoring: broke out conn.[ch], client.[ch], server.[ch],
idler.[ch].
Made a hash index such that the load balancer may balance load.
150420 Broke out Windows code from pen.c into windows.c. Added windows.h.
150419 Broke out public definitions for dsr into dsr.h.
Broke out memory management into memory.[ch].
Broke out dignostic and logging functions into diag.[ch].
Broke out settings into settings.[ch].
Broke out access lists into acl.[ch].
Broke out event initialization into event.[ch].
Added pen_epoll.h, pen_kqueue.h, pen_poll.h, pen_select.h.
Broke out pen_aton et al into netconv.[ch].
150416 Added dsr.c
150408 Bug in copy_down affecting SSL connections fixed.
Released 0.27.5.
150408 Updated ocsp stapling to be compatible with server name indication.
Added pen-ocsp.sh script.
Released 0.27.4.
150407 SSL code broken out into ssl.[ch]. SSL context creation broken
out from ssl_init to ssl_create_context.
Server Name Indication support. New command to enable:
ssl_sni_path PATH
where PATH is the name of a directory containing domain.key,
domain.crt and domain.ca files for each domain.
150406 OCSP stapling. New command ssl_ocsp_response filename
specifies the location of the ocsp response to be stapled.
The response must be pre-fetched. The idea was borrowed
from Rob Stradling.
150403 New command ssl_client_renegotiation_interval specifies the
minimum number of seconds the client must wait between
renegotiation requests. Default 3600.
150402 Enabled SSL session resumption.
In do_cmd: don't print "ignoring command" for comments starting
with '#'.
150330 Added ssl_option no_tlsv1.1 and ssl_option no_tlsv1.2 to disable
SSL 1.1 and 1.2 respectively.
150330 Released 0.27.3.
150330 Added autoconf check that the ECDHE is available and not disabled.
Bumped default max connections and listen queue to 500.
150326 Support for ECDHE cipher suites.
150325 New commands ssl_option and ssl_ciphers to individually disable
insecure protocols and ciphers.
150324 Updated penctl.1 with the new command.
150322 New knob to tweak max number of pending nonblocking connection
attempts: pending_max N (default 100).
150305 Released 0.27.2.
150228 Moved dlist prototypes to dlist.h.
150227 Added check to close idle connections after a period of inactivity.
Penctl: idle_timeout N (default 0 = never close idle connections).
150225 Moved git repository to GitHub..
150225 New feature: dummy server. Rather than acting as a proxy,
Pen will pretend to be a web server with just barely enough
functionality to work as a test target.
Penctl: dummy|no dummy.
150224 Yet Another command: abort_on_error|no abort_on_error makes
Pen call abort() (or not) when encountering a fatal error.
150224 New feature: "reliable idling". Pen will make and maintain a
number of idle connections to the backend servers. When a connection
closes, a new one is made (hence "reliable"). Penctl: idlers [N].
150223 In do_cmd: return diagnostics to penctl so the user can see them,
instead of uselessly sending them to syslog.
150223 New penctl commands:
socket N (print which connection the socket belongs to)
connection N (print info on the specified connection)
close N (forcibly close connection N)
150219 In open_listener: check that the requested port is in range.
Fixed bug in dlist_insert.
Released 0.27.1.
150215 Even load distribution when a server is unavailable.
150212 Let pen save the settings for tcp_nodelay and tcp_fastclose.
Make flush_up and flush_down return the correct value on error.
150212 Added config.h.win with reasonable settings for Windows.
Released 0.27.0.
150211 Better detection and blacklisting of unavailable servers.
150209 New penctl commands:
tcp_nodelay sets TCP_NODELAY on sockets. Turn off with no tcp_nodelay.
tcp_fastclose closes both upstream and downstream sockets if one of them
closes theirs. Will take the values up, down, both or off (default).
150208 Rather than making a table of pending connections every time through
the main loop, keep them in a doubly linked list which is only updated
as needed. O(n) -> O(1).
150207 A bug in udp mode: after successful "connect", do not event_add downfd,
because it is equal to listenfd and epoll_ctl doesn't like that.
150206 Module kqueue.c updated.
Module poll.c: set unused fd:s to -1, or Solaris will say ENOSYS.
150205 Enable diagnostic messages by default in configure.ac.
Changed event bookkeeping from stateless to stateful.
Made keepalive optional and added "keepalive / no keepalive" penctl command.
150204 Added windows.c and pen.h to the release tarball.
Released 0.26.1.
150204 Released 0.26.0.
150203 More sensible autoconfiguration defaults: poll, kqueue, epoll, openssl and geoip
are built if found unless explicitly excluded.
New event management defaults: kqueue, epoll, poll, select in that order.
New penctl commands: kqueue, epoll, poll, select.
New command line option: -O cmd where cmd is any penctl command.
E.g. -O select to use select instead of the compiled-in default.
150127 New penctl option "listen [address:]port" to allow listening address
to be changed on the fly or via a configuration file.
New pen options -i and -u to install and uninstall Pen as a Windows service.
See pen manpage.
Reduced default timeout to 3 seconds.
150126 New autoconf option --enable-debugging to enable debugging code.
Lots of fixes for compatibility with Windows.
Released 0.26.0beta2.
150123 Fixed bug in mainloop which kept trying to write 0 bytes.
MinGW port. Use Makefile.win to compile.
150121 Event management code broken out into select.c, poll.c, kqueue.c and epoll.c.
150113 New command-line option -m to accept multiple incoming connections in a batch.
New command-line option -q to set incoming pending connection queue length.
150112 Close upfd when failing over.
150109 Released 0.26.0beta1.
Adjusted debug logging levels.
150108 Started on epoll support for Linux.
150107 Rewrote output_net and output_file to take a variable number of arguments.
Handle timed out connection attempts in mainloop_kqueue.
150105 Fixed mainloop_kqueue.
150103 A lot of code broken out from mainloop_select into separate functions.
Fixed mainloop_poll.
150102 Bugfixes related to the new backend connection logic.
141229 Cleaned up and simplified add_client() and associated circuitry.
Connections to back end servers are now nonblocking and parallel.
141217 Removed the -n option and all code explicitly using blocking sockets.
Removed the -D option and the "delayed forward" feature.
141213 Renamed server and client fields in the conn, client and server structures
to better reflect what they are.
Restructured the add_client, store_client, store_conn and try_server
functions.
140814 Allow write_cfg to save IPv6 and GeoIP access lists.
Released 0.25.1.
140804 Fixed a bug in write_cfg, where Pen would try to write to an unwritable
file. Reported by Steven Myint
140804 Released 0.25.0.
140701 Return UDP replies from the server to the client.
140621 UDP load balancing code restructured and bugfixed. Released 0.24.0.
140616 Released 0.23.0.
140417 In mainloop_select: When there is a pending connection, keep accepting
up to multi_accept times *or* until EAGAIN *or* connection table is full.
This improves performance under load.
140414 Updated GeoIP support for IPv6.
140410 Servers can have ipv6 addresses. It is possible to use a mix of ipv4
and ipv6 servers:
./pen -df -S 2 -r :::2222 [::1]:22 [127.0.0.1]:22
140409 In order to allow server addresses with : in them (i.e. ipv6), it is now
possible to use square brackets around the address part of the server
specification: [address]:port (e.g. [::1]:8080).
140408 Pen can now listen on ipv6 sockets in addition to ipv4 and unix ones.
I.e. things like "pen ::1:2222 127.0.0.1:22" are now possible.
140402 snprintf format errors reported by Christopher Meng fixed in
pen.c and penctl.c.
Released 0.22.1.
140331 Updated pen manpage to clarify what the control socket does.
Resist opening control socket running as root.
Remove the default file name for web log.
New feature: unix domain listening sockets.
Released 0.22.0.
140221 Redesigned server and client structs to allow ipv6 addresses and require
less casting (yuck) in the code.
140205 Updated penctl man page with syntax for IPv6 and GeoIP access lists.
Fixed cosmetic signedness compiler warnings.
140204 Moved defines for ACE_IPV4 et al outside #ifdef HAVE_SSL clause.
Otherwise pen won't compile without ssl.
Released 0.21.1.
140204 GeoIP access lists.
Released 0.21.0.
140120 Added "special exception" clause for linking with OpenSSL.
Released 0.20.2.
131127 Penlog ipv6 compatible.
131126 Modernized automake configuration.
Penctl ipv6 compatible.
131123 Updated autoconf to 2.69.
Released 0.20.1.
131122 Updated SSL code. Protocol ssl2 removed. Default changed to tls1.
Released 0.20.0.
131120 Added UDP patch from Zen.
Released 0.19.0.
080517 Added patch from Debian that fixes some issues with penctl.cgi.
Released 0.18.0.
080503 Priority based server selection algorithm.
080501 Patch from Stephen P. Schaefer fixes several issues in
write_cfg.
In the server_by_weight function, multiply current connections
by WEIGHT_FACTOR to make the selection mo fine grained when the
number of connections is small.
Released 0.17.3.
080326 Patch from Dana Contreras: send stdio to /dev/null after
forking.
Fixed a bunch of cosmetic signedness compiler warnings.
070912 Added sanity check to init() to make sure that servers_max
is large enough for the number of servers specified on the
command line.
Released 0.17.2.
070829 Faster string duplication courtesy of Nigel Horne.
070502 Updated automake links.
070212 Updated INSTALL with instructions for increasing the number
of connections on Windows.
061204 Include server weight in response to "penctl servers" command.
Set server weight on command line. Server is specified as
host:port:maxconn:hard:weight.
060627 Bugfix by Chris Elsworth: server_by_weight would never
consider blacklisted servers, which kept them blacklisted
indefinitely.
Released 0.17.1.
051230 Added code by Chris Elsworth for kqueue support. Configure
with --with-kqueue to enable.
Released 0.17.0.
051215 Changed the configure option for ssl to
--with-experimental-only-ssl.
Released 0.16.0.
040709 Added an "abuse server" for naughty clients that have been
denied access by an acl. Works similar to the emergency server,
use command-line option "-B host:port" to enable.
040706 Servers can be assigned different weights to account for
differing capacity. New -W command-line option. New penctl
commands:
server S weight W (assign weight to server)
weight (use weight for server selection)
no weight (do not use weight for server selection)
Cleaned up the logic in add_client so the weighted server
selection can be used without client tracking.
Released 0.15.0.
040624 Some performance enhancing changes:
New variable connections_used remembers the number of used
slots in conns[]. It is incremented by store_conn and
decremented by close_conn. This allows the main loop to
only accept new connections if there are empty slots in
conns[], which is much better than accepting the connection
only to immediately close it because we can't handle it.
New variable connections_last remembers the last used slot
in conns[]. This allows us to scan for empty slots much faster
in store_conn when there are many simultaneous connections.
Released 0.14.0.
040622 Documented the procedure to change FD_SETSIZE on Linux
in INSTALL.
040604 Documented the include command in the penctl manpage.
040527 Fixed SSL so it works in nonblocking mode, except that
it doesn't work anyway.
Moved listenfd and ctrlfd out of main.
040428 Highly experimental SSL code in pen.c. Updated manpage
with the new options. Added https example to HOWTO.
Released 0.13.0.
040403 Replaced signal with sigaction so connect() to nonexisting
servers can be interrupted and not restarted.
Released 0.12.3.
040318 Bugfix by Andreas Wrede: Running pen with -H to generate
X-Forwarded-For headers causes POST request data sections
to be dropped, if they are in the same packet as the POST
header (rather than a continuation packet) and the if the
POST data contains binary zeros. This is almost always the
case with Internet Explorer 6. Mozilla and friends send
the data of a POST request in a separate packet, so the
problem does not show up there.
040310 Changed setlinebuf to setvbuf in penlogd.c
Released 0.12.2.
040201 Bugfix: rewrite_request would only add the X-Forwarded-For
header for the first request.
Released 0.12.1.
040104 Removed the reference to mergelogs from the README and
added one to penlogd instead.
031023 Released 0.12.0.
031022 Penlogd: sscanf would read 100 bytes + terminating nul into
a buffer of size 100. Now reads 99+nul. Spotted by Oezguer Kesim.
031021 Let tracking time be set through penctl.cgi.
In do_cmd, "no log": only close the logfile if it is open.
New penctl command, "write [FILE]" writes current configuration
to a file. If FILE is omitted, overwrite the original
configuration file (-F option).
031017 Pen: Time based expiration of tracked clients. Default is
0 seconds = never expire. Added -T option to control expiry
time. Also added penctl command "tracking N".
Penlogd: zero-terminate results from recvfrom.
031013 In penlogd.c: don't complain if recvfrom is interrupted by signal.
031013 Released 0.11.1.
031011 Use sigaction rather than signal in penlogd.
Check for inet_aton in libresolv (needed for Solaris).
Install documentation into ${prefix}/doc/pen (can be
changed using the --with-doc= configuration option).
Added tgz target to Makefile.am for Slackware packaging.
030922 Added an "include" keyword to the command interface, so the
configuration can be split into several files.
Added access control lists, numbered 0 to 9. The command
syntax to define them are:
acl N permit|deny ipaddress mask create acl
no acl N delete acl
client_acl N bind clients to acl
control_acl N bind control interface to acl
server S acl N who can use server S
All access lists start out empty, defaulting to permit anything.
030910 In rewrite_request: don't add an X-Forwarded-For: if there
already is one.
030906 Added a configuration file (-F option) with commands in
penctl format. It is read after processing all command line
arguments and also when a HUP signal is received.
030905 Updated pen manpage to reflect the new -X and -S options.
In rewrite_request: look for \n\n if we can't find
\r\n\r\n. Some clients do that, according to
Steve Hall .
Moved everything from CONTROL into penctl.1.
Also added the exit command to penctl.1.
030905 Released 0.10.3.
030904 Preallocate slots for servers that can be dynamically added
and removed using the control interface, up to a maximum
number determined by the -S option (default 16).
030821 A patch from Anders Nordby sets the group
as well as user id when running pen with the -u option.
030821 Released 0.10.2.
030820 A patch from Mikko Ruuska (mikko.ruuskaxi at solidtech.com) adds
an exit command to pen's control port interface.
030820 Patch for pen.c by Andreas Wrede , fixing
the following bugs:
The message indicating a failed server is re-issued on every attempt,
due to a inverted if-test.
The attached patch issues the messages only the first time a server
fails and it shows when we will retry the connection. It also
suppresses multiple "Using emergency server" messages.
030820 #include in penlog.c.
030820 Patch for penlogd.c by Branson Matheson :
- pen sends two lines for every log.. penlogd only needs one
to function.
- added a -b ... unbuffer to the opts for penlogd so that you
can actually see the lines as they come out.
- changed one of the dubugs to so post processing of the input
data.
030407 Bugs uncovered by Charlie Reitsma :
HOWTO incorrectly specified penctl in place of penlog
in Apache configuration example, and using penctl to
redirect log to penlogd didn't work.
Avoid bogus header rewriting in rewrite_request.
Released 0.10.1.
030210 New penctl commands "http" and "no http" to toggle -H.
030208 New option -H adds X-Forwarded-For header to http requests.
020717 Patches from Patroklos G. Argyroudis :
- check getopt() calls against -1 and not EOF
- fix for a possible format string in pen.c
020711 Ported to Darwin/MacOS X.
Released 0.9.4.
020705 New penctl command: recent [seconds] displays clients that have
connected recently (default five minutes), along with number of
connects, transmitted and received data.
020702 Buffer overflow in netlog. See comment in pen.c.
Added options -j (for chroot) and -u (for setuid) to pen and
penlogd. See manpages.
020627 Fixed an error which could throw penlogd into an endless loop
if a udp packet was lost at the crucial moment.
020626 Pedantic checking of memory allocations and buffer sizes.
020618 Penlogd: added option -n to adjust the number of cached log
entries from Pen.
020614 Added options -d, -f, -l and -p to penlogd. They do the same
as in pen. Also added signal handlers for TERM and HUP; these
too do the same as in pen. Updated penlogd manpage.
Updated www section in HOWTO to use penlog rather than mergelogs.
020613 Added penlog.c to log over a network using Apaches reliable
piped logs. A companion log server, penlogd.c, consolidates
logs from Pen and from all web servers into a single file.
Added the necessary code to Pen log over the network.
020610 Wrote penctl.cgi, a web wrapper for penctl.
020609 Wrote a new version of the main loop, using poll() instead of
select(). Added configuration option --with-poll to enable.
Also turned redefinition of FD_SETSIZE into a configuration
option --with-fd_setsize=N.
Updated installation instructions in INSTALL.
020605 Added optional hard limit to the number of connections to each
server.
Timestamps in debug log entries.
Released 0.8.0.
020604 Added "server of last resort" (-e option) which is only used
when all other servers are unavailable. (Andreas Wrede)
020528 Several enhancements and bugfixes by Andreas Wrede:
In webstats: changed CLIENTS_MAX to clients_max and
CONNECTIONS_MAX to connections_max.
Show time in human-readable format rather than seconds since 1970.
Changed byte counters from unsigned long to unsigned long long.
Fixed file descriptor leak: The connection wasn't closed when
the connection table was full.
Moved stats generation and log restart out of the signal handlers
and into the main loop.
If a client went away before receiving all its data (large files),
the remaining portion would be sent to the next client occupying
the same slot.
Added pointers in connection structure to avoid having to memcpy
the buffers in flush_up/flush_down.
Released 0.7.0.
020507 Updated the penctl manpage to reflect reality.
Released 0.6.3.
020417 Added -D switch to make copy_up and copy_down *always* store data
in a temporary buffer and wait for the next round through the
main loop before passing it on to the receiving end.
The penctl command for this is "delayed_forward".
When making sockets nonblocking (through fcntl(..., O_NONBLOCK)),
make sure that any existing flags are not reset in the process.
Important bugfix: each failed connection attempt in try_server
would result in one socket leaked because we returned without
closing it.
020413 Figured out why nonblocking mode was slower than blocking. Fixed.
020411 Added penctl, a simple user interface to the control protocol.
020324 Cancel timeout if it isn't needed.
020115 Added LDAP info in the HOWTO.
Added the flush_up/flush_down bugfix from 0.5.0 again.
Released 0.6.1.
020111 Moved #include before #include
Replaced the call to setpgrp with setsid.
Transformed mergelogs into ultimately portable ANSI C (almost).
Thanks to Mike Dugas for help with porting
to FreeBSD 4.4-RELEASE.
020110 Rewrote mergelogs completely. It will now never discard a web
server log entry, and it tries much harder to locate a good
match in the pen log. It deals with log entries that are out
of order and servers with unsynchronized clocks and/or
different time zones. The -l (lag) option is no more.
Removed the -r (rejects) option, since we no longer reject anything.
Released 0.6.0
010915 Made the use of daemon() optional.
Added the cgi script penstats to update and display statistics.
Set current in store_conn.
Released 0.5.0.
010914 Statistics in HTML format (Riccard Åkerman).
Tested pen on HP-UX 10.20.
010913 Released 0.4.0.
010912 When storing part of the buffer for a renewed attempt,
store the *end*, not the beginning. Affects copy_up and copy_down.
Autoconf. Use daemon() if available. Make sure that we don't try
to close uninitialized file handles in add_client.
New option -n to not make sockets nonblocking (mainly useful
for debugging).
010911 Make sure that remaining data is stored away when we get EAGAIN
in copy_up.
Released 0.3.3.
010909 Added -p argument to store process id in a file (Andreas Wrede).
Made the sockets nonblocking. Handle EAGAIN in copy_up/down.
Released 0.3.2.
010908 Ignore SIGPIPE. Released 0.3.1.
010827 Option -h uses a hash on the client IP address for the initial
server selection. Option -s ("stubborn") prevents failover to
another server if the initial choice is unavailable.
010824 Use getport for the local port as well.
010820 Append to the logfile rather than overwriting it.
Released 0.2.0.
010817 Server selection algorithm rewritten in a cleaner, simpler way.
Blacklist nonresponding servers for a selectable period of time.
Optional "plain" roundrobin without client tracking.
(options -b and -r, see manpage).
Log to syslog if we are running in the background.
010814 Installed pen on siag.nu, which now load-balances itself. Apache
runs on port 8080, pen on 80. Seems to work (tm).
010813 Added description of options to pen.1 and mergelogs.1.
Script to guess libraries.
010812 Fixed typo (webmerge -> mergelogs) in pen.1.
010809 Added mergelogs, a program to match pen logs against web server
logs and merge the results into one log file with the correct
client addresses.
Released 0.1.0.
010808 Print statistics on stderr when sent USR1 signal.
Ported to Solaris, i.e. verified that it works ;-).
Logging. Reopen log file when sent HUP signal.
Exit cleanly when sent TERM signal.
010807 Wrote a manpage.
010803 Completed the conversion to non-forking, selecting mode. Works
really well now, with very low CPU utilization even with many
simultaneous connections.
010729 Rewrote the program to not fork.
010722 Prettied up the source.
001218 Updated the README.
001022 Rewrote the load balancing algorithm.
pen-0.32.0/memory.h 0000644 0001750 0001750 00000000233 12514656632 010770 0000000 0000000 extern void *pen_malloc(size_t);
extern void *pen_calloc(size_t, size_t);
extern void *pen_realloc(void *, size_t);
extern char *pen_strdup(const char *);
pen-0.32.0/pen.h 0000644 0001750 0001750 00000000570 12524651724 010244 0000000 0000000 #include
#ifdef WINDOWS
#include
#include
#include
extern void stop_winsock();
#else
#include
#endif
//#ifdef HAVE_LIBSSL
//#include
//#include
//#endif /* HAVE_LIBSSL */
extern int socket_nb(int, int, int);
extern int listenfd;
extern time_t now;
extern void mainloop(void);
pen-0.32.0/NEWS 0000644 0001750 0001750 00000000000 12507562420 007767 0000000 0000000 pen-0.32.0/settings.h 0000644 0001750 0001750 00000000267 12531541665 011325 0000000 0000000 extern int foreground;
extern int abort_on_error;
extern int multi_accept;
extern int tcp_fastclose;
extern int keepalive;
extern int protoid;
extern int udp;
extern int transparent;
pen-0.32.0/event.h 0000644 0001750 0001750 00000000570 12514670554 010604 0000000 0000000 #define EVENT_READ (0x10000)
#define EVENT_WRITE (0x20000)
#define TIMEOUT 3 /* default timeout for non reachable hosts */
extern int timeout;
extern void (*event_init)(void);
extern void (*event_add)(int, int);
extern void (*event_arm)(int, int);
extern void (*event_delete)(int);
extern void (*event_wait)(void);
extern int (*event_fd)(int *);
pen-0.32.0/siag.pem 0000644 0001750 0001750 00000003433 12507562420 010733 0000000 0000000 -----BEGIN RSA PRIVATE KEY-----
MIICXwIBAAKBgQDKcE9kAiLqzJWQAImFRhC1e6wvfTtd1Gcy+eoP+Ngnqroijeon
lV2vsNENsr+AMksRREeRFk4WP14MUZAB2p2iEy5J8jU31iUvFHswvWY6IEThwESP
bt+3h2buJ6475UgQ3Ww2lJ6jTewBOEEZ/sRuqEmLy33bQEMOwFlSJcFsXwIDAQAB
AoGBALxYDaUwT6hAu44E0e3LKFSRQbvVOdysd294EQrXLNSLBS6M9qPpVgbV7Upf
Wcg+ApWH/0W/iNsuDaRMZj0zVqAClE9W9mcbIIKxAExj5kBiUSiVJjKiM/N6V/TH
a9rqPpUsHkJ2YhN7VWgW8Fkd9l0Poe4eQaQfEYzv/reAHjLxAkEA6bBIB+OztkMv
YgKRILwOxIaNUjeo8rYPc5hzQlfHAClr27eTJmKI5vFhjkiFsgZ97kjpBAhCUxv+
tq459txLhQJBAN3EO2vRgNOUp5SzGDE/UOp2D66jEtYeGF6Xwqao4WAuH2peVNTv
vb5c8mPUL7XmaOEroTD6M5i2qPunuJI5g5MCQQCpVJLdJKGT8Brlafa/QYVx4g2F
Bc/mDwYjPNRHvlL0Sw9cpih6J+wLa9zEvMgjt5CImUw/H7zve9mVhal6tyYBAkEA
k0IAqyGcx+JIPSeHgvwmQOpQk4hZs7CcQgPID17I+VLnLXyiHBtuBYA2vC9j1we+
0PZlvN4HcPqpzyGaIA7s3QJBAIBxJTwBYg/fzNYqeSIuIlVxN+Ao/Qgses7UJvIn
qf7PhVAWrpuX1mo2Pi7QH6+F0Cmj8BEIrfIPe+kqnIBOHFQ=
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIICfzCCAeigAwIBAgIBADANBgkqhkiG9w0BAQQFADA6MQswCQYDVQQGEwJTVjEZ
MBcGA1UEChMQU2lhZyBPZmZpY2UsIEluYzEQMA4GA1UEAxMHc2lhZy5udTAeFw0w
MzAzMTgwODQ4MTRaFw0zMDA4MDMwODQ4MTRaMDoxCzAJBgNVBAYTAlNWMRkwFwYD
VQQKExBTaWFnIE9mZmljZSwgSW5jMRAwDgYDVQQDEwdzaWFnLm51MIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQDKcE9kAiLqzJWQAImFRhC1e6wvfTtd1Gcy+eoP
+NgnqroijeonlV2vsNENsr+AMksRREeRFk4WP14MUZAB2p2iEy5J8jU31iUvFHsw
vWY6IEThwESPbt+3h2buJ6475UgQ3Ww2lJ6jTewBOEEZ/sRuqEmLy33bQEMOwFlS
JcFsXwIDAQABo4GUMIGRMB0GA1UdDgQWBBTiAQBmjX5+5ki5ePNiF61jhmF5xDBi
BgNVHSMEWzBZgBTiAQBmjX5+5ki5ePNiF61jhmF5xKE+pDwwOjELMAkGA1UEBhMC
U1YxGTAXBgNVBAoTEFNpYWcgT2ZmaWNlLCBJbmMxEDAOBgNVBAMTB3NpYWcubnWC
AQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQC2nAZn6MdkmX7xQSP0
5Z3NeMx4BKHzfDZ0/gkcpKEfH4A45Nz6cReGy7WY4vkXM8BCN0X46ViKnfcXByrA
MPuIEETTffZ1qzFvxolfDqJvsZGw7Tz7GvmbOBEk9itTyJ7h0AFiCr6JyoEUwniQ
FD7bVtD5uFKUGksFrzBGdrBNyg==
-----END CERTIFICATE-----
pen-0.32.0/netconv.h 0000644 0001750 0001750 00000000541 12515642340 011126 0000000 0000000 extern int getport(char *, char *);
extern int pen_setport(struct sockaddr_storage *, int);
extern int pen_getport(struct sockaddr_storage *);
extern char *pen_ntoa(struct sockaddr_storage *);
extern void pen_dumpaddr(struct sockaddr_storage *);
extern int pen_ss_size(struct sockaddr_storage *);
extern int pen_aton(char *, struct sockaddr_storage *);
pen-0.32.0/dsr.h 0000644 0001750 0001750 00000000162 12624554430 010244 0000000 0000000 extern int dsr_init(char *, char *);
extern void dsr_frame(int);
extern void dsr_arp(int);
extern int tarpit_acl;
pen-0.32.0/pen_kqueue.h 0000644 0001750 0001750 00000000037 12514666005 011616 0000000 0000000 extern void kqueue_init(void);
pen-0.32.0/idlers.h 0000644 0001750 0001750 00000000136 12515662230 010734 0000000 0000000 extern int idlers, idlers_wanted;
extern void close_idlers(int);
extern int add_idler(void);
pen-0.32.0/pen.spec 0000644 0001750 0001750 00000004000 12507562420 010732 0000000 0000000 # DarContact: Ulric Eriksson
Summary: A load balancer for "simple" tcp based protocols.
Name: pen
Version: 0.11.0
Release: 0
License: GPL
Group: Applications/Internet
URL: http://siag.nu/pen/
Packager: Dag Wieers
Vendor: Dag Apt Repository, http://dag.wieers.com/apt/
Source: ftp://siag.nu/pub/pen/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/root-%{name}-%{version}
Prefix: %{_prefix}
%description
Pen is a load balancer for "simple" tcp based protocols such as http or smtp.
It allows several servers to appear as one to the outside and automatically
detects servers that are down and distributes clients among the available
servers. This gives high availability and scalable performance.
%prep
%setup
### FIXME: Add a default pen.conf for Apache. (Please fix upstream)
%{__cat} <%{name}.conf
ScriptAlias /pen/ %{_localstatedir}/www/pen/
DirectoryIndex penctl.cgi
Options ExecCGI
order deny,allow
deny from all
allow from 127.0.0.1
EOF
%build
%configure
%{__make} %{?_smp_mflags}
%install
%{__rm} -rf %{buildroot}
%makeinstall
%{__install} -d -m0755 %{buildroot}%{_localstatedir}/www/pen/ \
%{buildroot}%{_sysconfdir}/httpd/conf.d/
%{__install} -m0755 penctl.cgi %{buildroot}%{_localstatedir}/www/pen/
%{__install} -m0644 pen.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/
%post
if [ -f %{_sysconfdir}/httpd/conf/httpd.conf ]; then
if ! grep -q "Include .*/pen.conf" %{_sysconfdir}/httpd/conf/httpd.conf; then
echo -e "\n# Include %{_sysconfdir}/httpd/conf.d/pen.conf" >> %{_sysconfdir}/httpd/conf/httpd.conf
# /sbin/service httpd restart
fi
fi
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-, root, root, 0755)
%doc AUTHORS ChangeLog COPYING HOWTO NEWS README TODO
%doc %{_mandir}/man?/*
%config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
%{_bindir}/*
%{_localstatedir}/www/pen/
%changelog
* Tue Sep 23 2003 Dag Wieers - 0.11.0-0
- Initial package. (using DAR)
pen-0.32.0/conn.h 0000644 0001750 0001750 00000003154 12531320303 010400 0000000 0000000 #include
#ifdef HAVE_LIBSSL
#include
#include
#endif
#include
#define CONNECTIONS_MAX 500 /* max simultaneous connections */
/* Connection states, as used in struct conn */
#define CS_UNUSED (0) /* not connected, unused slot */
#define CS_IN_PROGRESS (1) /* connection in progress */
#define CS_CONNECTED (2) /* successfully connected */
#define CS_CLOSED_UP (4) /* we read eof from upfd */
#define CS_CLOSED_DOWN (8) /* we read eof from downfd */
#define CS_CLOSED (CS_CLOSED_UP | CS_CLOSED_DOWN)
typedef struct {
int state; /* as per above */
time_t t; /* time of connection attempt */
int downfd, upfd;
unsigned char *downb, *downbptr, *upb, *upbptr;
int downn, upn; /* pending bytes */
unsigned long ssx, srx; /* server total sent, received */
unsigned long csx, crx; /* client total sent, received */
int client; /* client index */
int initial; /* first server tried */
int server; /* server index */
int pend; /* node in pending_list */
#ifdef HAVE_LIBSSL
SSL *ssl;
time_t reneg; /* last time client requested renegotiation */
#endif
} connection;
extern connection *conns;
extern int idle_timeout;
extern int pending_list;
extern int pending_queue;
extern int pending_max;
extern int connections_max;
extern int connections_used;
extern int connections_last;
extern int tracking_time;
extern void fd2conn_set(int, int);
extern int fd2conn_get(int);
extern int closing_time(int);
#ifdef HAVE_LIBSSL
int store_conn(int, SSL *, int);
#else
int store_conn(int, int);
#endif
extern int idler(int);
extern void close_conn(int);
extern void expand_conntable(size_t);
pen-0.32.0/TODO 0000644 0001750 0001750 00000000000 12507562420 007760 0000000 0000000 pen-0.32.0/X64/ 0000755 0001750 0001750 00000000000 12624555212 007744 5 0000000 0000000 pen-0.32.0/X64/Makefile 0000644 0001750 0001750 00000000101 12507562420 011313 0000000 0000000
VPATH=..
CC=x86_64-w64-mingw32-gcc -m64
include ../Makefile.win
pen-0.32.0/COPYING 0000644 0001750 0001750 00000044407 12507562420 010346 0000000 0000000 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.
In addition, as a special exception, the copyright holders give
permission to link the code of portions of this program with the
OpenSSL library under certain conditions as described in each
individual source file, and distribute linked combinations
including the two.
You must obey the GNU General Public License in all respects
for all of the code used other than OpenSSL. If you modify
file(s) with this exception, you may extend this exception to your
version of the file(s), but you are not obligated to do so. If you
do not wish to do so, delete this exception statement from your
version. If you delete this exception statement from all source
files in the program, then also delete it here.
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
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
pen-0.32.0/server.h 0000644 0001750 0001750 00000002644 12604733030 010762 0000000 0000000 #include
#ifndef WINDOWS
#include
#else
#include
#endif
#define ALG_HASH_VALID 1
#define ALG_ROUNDROBIN 2
#define ALG_WEIGHT 4
#define ALG_PRIO 8
#define ALG_HASH 16
#define ALG_STUBBORN 32
#define EMERGENCY_SERVER (-1)
#define ABUSE_SERVER (-2)
#define NO_SERVER (-3)
#define BLACKLIST_TIME 30 /* how long to shun a server that is down */
#define WEIGHT_FACTOR 256 /* to make weight kick in earlier */
typedef struct {
int status; /* last failed connection attempt */
int acl; /* which clients can use this server */
struct sockaddr_storage addr;
uint8_t hwaddr[6];
int c; /* connections */
int weight; /* default 1 */
int prio;
int maxc; /* max connections, soft limit */
int hard; /* max connections, hard limit */
uint64_t sx, rx; /* bytes sent, received */
} server;
extern int nservers; /* number of servers */
extern server *servers;
extern int current;
extern int emerg_server;
extern int abuse_server;
extern int blacklist_time;
extern int server_alg;
extern char *e_server;
extern char *a_server;
extern void setaddress(int, char *, int, char *);
extern void blacklist_server(int);
extern int unused_server_slot(int);
extern int server_is_blacklisted(int);
extern int server_is_unavailable(int);
extern int server_by_roundrobin(void);
extern int initial_server(int);
extern int failover_server(int);
extern int try_server(int, int);
extern void expand_servertable(int);
pen-0.32.0/windows.c 0000644 0001750 0001750 00000022276 12526327460 011155 0000000 0000000 #include "diag.h"
#include "pen.h"
#include "windows.h"
int sigaction(int signum, const struct sigaction *act,
struct sigaction *oldact)
{
return 0;
}
uid_t getuid(void)
{
return 0;
}
#if 0
static int sigemptyset(sigset_t *set)
{
return 0;
}
static int getrlimit(int resource, struct rlimit *rlim)
{
return 0;
}
static int setrlimit(int resource, const struct rlimit *rlim)
{
return 0;
}
static struct passwd *getpwnam(const char *name)
{
static struct passwd p;
p.pw_uid = 0;
p.pw_gid = 0;
return &p;
}
static int chroot(const char *path)
{
return 0;
}
static int setgid(gid_t gid)
{
return 0;
}
static int setuid(uid_t uid)
{
return 0;
}
#endif
int inet_aton(const char *cp, struct in_addr *addr)
{
addr->s_addr = inet_addr(cp);
return (addr->s_addr == INADDR_NONE) ? 0 : 1;
}
#if 0
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
{
struct sockaddr_in sa;
memset(&sa, 0, sizeof sa);
memcpy(&sa.sin_addr, src, sizeof sa.sin_addr);
sa.sin_family = af;
if (WSAAddressToString((struct sockaddr *)&sa, sizeof sa, 0, dst, (LPDWORD)&size) != 0) {
DWORD rv = WSAGetLastError();
debug("WSAAddressToString returns %d", rv);
return NULL;
}
return dst;
}
#endif
void make_nonblocking(int fd)
{
int i;
u_long mode = 1;
if ((i = ioctlsocket(fd, FIONBIO, &mode)) != NO_ERROR)
error("Can't ioctlsocket, error = %d", i);
}
static WSADATA wsaData;
static int ws_started = 0;
int start_winsock(void)
{
int n;
DEBUG(1, "start_winsock()");
if (!ws_started) {
n = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (n != NO_ERROR) {
error("Error at WSAStartup() [%d]", WSAGetLastError());
} else {
DEBUG(2, "Winsock started");
ws_started = 1;
}
}
return ws_started;
}
void stop_winsock(void)
{
WSACleanup();
ws_started = 0;
}
static SERVICE_STATUS ServiceStatus;
static SERVICE_STATUS_HANDLE ServiceStatusHandle;
static VOID WINAPI ServiceCtrlHandler (DWORD opcode);
static VOID WINAPI ServiceStart (DWORD argc, LPTSTR *argv);
static DWORD ServiceInitialization (DWORD argc, LPTSTR *argv, DWORD *specificError);
static void DeletePenService(SC_HANDLE schSCManager, char *service_name)
{
SC_HANDLE schService;
schService = OpenService(schSCManager, service_name, SERVICE_ALL_ACCESS);
if (schService == NULL) {
debug("Can't open service (%d)", (int)GetLastError());
return;
}
if (!DeleteService(schService)) {
debug("Can't delete service (%d)", (int)GetLastError());
}
CloseServiceHandle(schService);
}
int delete_service(char *service_name)
{
SC_HANDLE schSCManager;
debug("delete_service()", 0);
// Open a handle to the SC Manager database.
schSCManager = OpenSCManager(
NULL, // local machine
NULL, // ServicesActive database
SC_MANAGER_ALL_ACCESS); // full access rights
if (NULL == schSCManager) {
debug("OpenSCManager failed (%d)", (int)GetLastError());
return 0;
}
DeletePenService(schSCManager, service_name);
return 1;
}
static BOOL CreatePenService(SC_HANDLE schSCManager, char *service_name, char *display_name)
{
TCHAR szPath[MAX_PATH];
SC_HANDLE schService;
if( !GetModuleFileName( NULL, szPath, MAX_PATH ) ) {
debug("GetModuleFileName failed (%d)", (int)GetLastError());
return FALSE;
}
schService = CreateService(
schSCManager, // SCManager database
service_name, // name of service
display_name, // service name to display
SERVICE_ALL_ACCESS, // desired access
SERVICE_WIN32_OWN_PROCESS, // service type
SERVICE_AUTO_START, // start type
SERVICE_ERROR_NORMAL, // error control type
szPath, // path to service's binary
NULL, // no load ordering group
NULL, // no tag identifier
NULL, // no dependencies
NULL, // LocalSystem account
NULL); // no password
if (schService == NULL) {
debug("CreateService failed (%d)", (int)GetLastError());
return FALSE;
} else {
CloseServiceHandle(schService);
return TRUE;
}
}
int install_service(char *service_name)
{
SC_HANDLE schSCManager;
// Open a handle to the SC Manager database.
debug("install_service()", 0);
schSCManager = OpenSCManager(
NULL, // local machine
NULL, // ServicesActive database
SC_MANAGER_ALL_ACCESS); // full access rights
if (NULL == schSCManager)
debug("OpenSCManager failed (%d)", (int)GetLastError());
if (CreatePenService(schSCManager, service_name, service_name)) {
debug("Success");
} else {
debug("Failure");
}
return 0;
}
int service_main(int argc, char **argv)
{
SERVICE_TABLE_ENTRY DispatchTable[] = {
/* http://msdn.microsoft.com/en-us/library/ms686001(VS.85).aspx
If the service is installed with the SERVICE_WIN32_OWN_PROCESS service type,
this member is ignored, but cannot be NULL.
This member can be an empty string ("").
*/
{ /*SERVICE_NAME*/"", ServiceStart },
{ NULL, NULL }
};
debug("service_main(%d, %p)", argc, argv);
if (!StartServiceCtrlDispatcher( DispatchTable)) {
debug(" [PEN] StartServiceCtrlDispatcher (%d)\n",
GetLastError());
}
return 0;
}
static void WINAPI ServiceStart (DWORD argc, LPTSTR *argv)
{
DWORD status;
DWORD specificError;
debug("ServiceStart()");
ServiceStatus.dwServiceType = SERVICE_WIN32;
ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
ServiceStatus.dwControlsAccepted =
SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE;
ServiceStatus.dwWin32ExitCode = 0;
ServiceStatus.dwServiceSpecificExitCode = 0;
ServiceStatus.dwCheckPoint = 0;
ServiceStatus.dwWaitHint = 0;
ServiceStatusHandle = RegisterServiceCtrlHandler(
/* http://msdn.microsoft.com/en-us/library/ms685054(VS.85).aspx
If the service type is SERVICE_WIN32_OWN_PROCESS, the function does not
verify that the specified name is valid, because there is only one
registered service in the process. */
"", // SERVICE_NAME
ServiceCtrlHandler);
if (ServiceStatusHandle == (SERVICE_STATUS_HANDLE)0) {
debug(" [PEN] RegisterServiceCtrlHandler failed %d\n", GetLastError());
return;
}
// Initialization code goes here.
status = ServiceInitialization(argc,argv, &specificError);
// Handle error condition
if (status != NO_ERROR) {
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
ServiceStatus.dwCheckPoint = 0;
ServiceStatus.dwWaitHint = 0;
ServiceStatus.dwWin32ExitCode = status;
ServiceStatus.dwServiceSpecificExitCode = specificError;
SetServiceStatus (ServiceStatusHandle, &ServiceStatus);
return;
}
// Initialization complete - report running status.
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
ServiceStatus.dwCheckPoint = 0;
ServiceStatus.dwWaitHint = 0;
if (!SetServiceStatus (ServiceStatusHandle, &ServiceStatus)) {
status = GetLastError();
debug(" [PEN] SetServiceStatus error %ld\n",status);
}
// This is where the service does its work.
debug(" [PEN] Returning the Main Thread \n",0);
mainloop();
return;
}
// Stub initialization function.
static DWORD ServiceInitialization(DWORD argc, LPTSTR *argv, DWORD *specificError)
{
return(0);
}
static VOID WINAPI ServiceCtrlHandler (DWORD Opcode)
{
DWORD status;
switch(Opcode) {
case SERVICE_CONTROL_PAUSE:
// Do whatever it takes to pause here.
ServiceStatus.dwCurrentState = SERVICE_PAUSED;
break;
case SERVICE_CONTROL_CONTINUE:
// Do whatever it takes to continue here.
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
break;
case SERVICE_CONTROL_STOP:
// Do whatever it takes to stop here.
stop_winsock();
ServiceStatus.dwWin32ExitCode = 0;
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
ServiceStatus.dwCheckPoint = 0;
ServiceStatus.dwWaitHint = 0;
if (!SetServiceStatus (ServiceStatusHandle, &ServiceStatus)) {
status = GetLastError();
debug(" [PEN] SetServiceStatus error %ld\n", status);
}
debug(" [PEN] Leaving Service \n",0);
return;
case SERVICE_CONTROL_INTERROGATE:
// Fall through to send current status.
break;
default:
debug(" [PEN] Unrecognized opcode %ld\n", Opcode);
}
// Send current status.
if (!SetServiceStatus (ServiceStatusHandle, &ServiceStatus)) {
status = GetLastError();
debug(" [PEN] SetServiceStatus error %ld\n", status);
}
return;
}
pen-0.32.0/penctl.1 0000644 0001750 0001750 00000021115 12622372561 010654 0000000 0000000 .TH PENCTL 1 LOCAL
.SH NAME
penctl - control a running pen load balancer
.SH SYNOPSIS
.B penctl
host:port|/path/to/socket command
.SH EXAMPLE
penctl lbhost:8888 roundrobin
Turns off client tracking on the load balancer running on lbhost.
penctl /var/run/pen/tmp/ctrl status
Prints status information in html format.
.SH DESCRIPTION
.I Penctl
connects to the optional control socket on a pen load balancer.
It reads commands from the command line, performs minimal syntax
checking and sends them to pen. Replies, if any, are printed on stdout.
The program can also be used through the cgi script penctl.cgi,
which allows pen to be controlled from any web browser.
.SH OPTIONS
.TP
\fIhost:port\fR
Specifies a control port where the load balancer listens for commands.
.SH COMMANDS
.TP
\fIabort_on_error\fR
Call abort() when a fatal error is encountered. This will create a core file which allows further troubleshooting. Disabled by default.
.TP
\fIno abort_on_error\fR
Exit normally on fatal error with an error code which indicates failure.
.TP
\fIacl N permit|deny sourceip4 [mask]\fR
Adds an entry to access list N, where N is a number from 0 to 9. The source and mask addresses are in the usual dotted quad notation. If mask is omitted, it defaults to 255.255.255.255.
.TP
\fIacl N permit|deny sourceip6[/length]\fR
If the source address contains the character ':', the address is interpreted as
IPv6. Unlike IPv4 access entries, a length is used to indicate the mask. If
length is omitted, it defaults to 128.
.TP
\fIacl N permit|deny country NN\fR
If the source address is the special word "country", a two-letter country
code can be used to restrict access to the load balancer. For this to work,
pen must be built with geoip support.
.TP
\fIno acl N\fR
Deletes all entries from access list N. The resulting access list
permits all traffic.
.TP
\fIascii\fR
Communication dumps in ascii format (cf option -a).
.TP
\fIno ascii\fR
Communication dumps in hex format.
.TP
\fIblacklist\fR
Return current blacklist time in seconds.
.TP
\fIblacklist T\fR
Set the blacklist time in seconds.
.TP
\fIblock\fR
Do not make sockets nonblocking. This is obsolete as of 0.26.0 and does nothing.
.TP
\fIno block\fR
Make sockets nonblocking.
.TP
\fIclient_acl N\fR
Check connecting clients against access list N (default 0).
.TP
\fIclients_max [N]\fR
With argument, increase the maximum number of known clients. Returns max number of clients.
.TP
\fIclose N\fR
Close connection N
.TP
\fIconnection N\fR
Display some basic information about connection N.
.TP
\fIconn_max [N]\fR
With argument, increase the max number of simultaneous connections. Returns max number.
.TP
\fIcontrol\fR
Return address and port where pen listens for control connections.
.TP
\fIcontrol_acl N\fR
Check accesses to the control port against access list N (default 0).
.TP
\fIdebug\fR
Return current debug level.
.TP
\fIdebug N\fR
Set debug level to N.
.TP
\fIdelayed_forward\fR
Always wait for the next round of the main loop before forwarding data. Normally pen tries to do that immediately. This is obsolete as of 0.26.0 and does nothing.
.TP
\fIno delayed_forward\fR
Try to forward data immediately, to avoid the overhead of copying it to a temporary buffer and waiting for the next main loop round.
.TP
\fIdsr_if IF\fR
Use IF as the interface for Direct Server Return.
.TP
\fIdummy\fR
Act as a dummy web server with very limited functionality but high performance. Only useful for testing. Disabled by default.
.TP
\fIno dummy\fR
Do not act as a dummy web server.
.TP
\fIepoll\fR
Use epoll for event management (Linux).
This is the default on Linux.
.TP
\fIexit\fR
Exit. Only available if pen was started with the -X option.
.TP
\fIhash\fR
Use a hash on the client IP address for initial server selection.
.TP
\fIno hash\fR
Do not use a hash.
.TP
\fIhttp\fR
Add X-Forwarded-For headers to http requests.
.TP
\fIno http\fR
Do not add X-Forwarded-For headers.
.TP
\fIidle_timeout N\fR
Close connections that have been inactive for N seconds. Default 0 = never close.
.TP
\fIidlers [N]\fR
Create N reliable idle connections to the backend servers. Without argument, display the current/requested number of reliable idlers.
.TP
\fIinclude FILE\fR
Read commands from file.
.TP
\fIkqueue\fR
Use kqueue for event management (FreeBSD, NetBSD, OpenBSD).
This is the default on the systems that have it.
.TP
\fIlisten\fR
Return local address and port pen listens to for incoming client connections.
.TP
\fIlisten [address:]:port
Close the listening socket and reopen using specified address (optional) and port.
.TP
\fIlog\fR
Show where pen is logging, if anywhere.
.TP
\fIlog FILE\fR
Log to FILE.
.TP
\fImode\fR
Write a summary of the current mode of operation. The listed modes are block, delayed_forward, hash, roundrobin, stubborn.
.TP
\fIno log\fR
Turn off logging.
.TP
\fIpending_max N\fR
Max allowed number of pending nonblocking connections. Default 100, minimum 1.
.TP
\fIpid\fR
Return the process id of the running daemon.
.TP
\fIpoll\fR
Use poll for event management.
.TP
\fIprio\fR
Use the priority based algorithm.
.TP
\fIno prio\fR
Do not use the priority based algorithm.
.TP
\fIrecent [N]\fR
Shows which clients have connected in the last N seconds (default 300).
.TP
\fIroundrobin\fR
Use round-robin server selection without client tracking
.TP
\fIno roundrobin\fR
.TP
\fIselect\fR
Use select for event management.
.TP
\fIserver N [ acl A | address A | port P | max M | hard H | blacklist T | weight W | prio P ]\fR
Change acl, address, port, weight, priority and/or max connections for server N, or blacklist it for T seconds.
.TP
\fIservers\fR
List address, port, weight, priority and max number of simultaneous connections for each remote server.
.TP
\fIsocket N\fR
Show to which connection socket N belongs.
.TP
\fIssl_ciphers CIPHERS\fR
Choose list of available SSL ciphers, specified in the format described in https://www.openssl.org/docs/apps/ciphers.html.
.TP
\fIssl_client_renegotiation_interval S\fR
Allowing the client to request renegotiation is a potential denial of service vector. This command specifies the minimum number of seconds the client has to wait between requests for renegotiation requests. Default 3600 = effectively disabled.
.TP
\fIssl_ocsp_response FILENAME\fR
Specifies the location of a file containing a pre-fetched OCSP response. The file must be refreshed regularly by a cron job or similar and the ssl_ocsp_response command repeated to make Pen re-read the file..
.TP
\fIssl_option OPTION\fR
Manipulate SSL options. The available options are no_sslv2, no_sslv3, no_tlsv1, no_tlsv1.1, no_tlsv1.2, cipher_server_preference. Use the command multiple times to specify multiple options.
.TP
\fIssl_sni_path PATH\fR
This command enables the Server Name Indication TLS extension by specifying a directory where domain.key, domain.crt and domain.ca files can be found.
.TP
\fIstatus\fR
Print status information in html format.
.TP
\fIstubborn\fR
If the initial server selection is unavailable, close the client connection without trying another
.TP
\fIno stubborn\fR
.TP
\fItarpit_acl [N]\fR
Used in DSR mode. If N is an existing access list, Pen will reply to ARP requests for IP addresses that match the access list, and reply with SYN+ACK to TCP SYN requests to these addresses. The result is that someone trying to scan a network will be slowed down by a large number of false positives.
.TP
\fItcp_fastclose up|down|both|off\fR
Close both sockets to upstream and downstream if one of them closes theirs. Default = off.
.TP
\fItcp_nodelay\fR
Set TCP_NODELAY on sockets, effectively turning off the Nagle algorithm.
.TP
\fIno tcp_nodelay\fR
Do not set TCP_NODELAY on sockets. This is the default.
.TP
\fItimeout\fR
Return current connect timeout in seconds.
.TP
\fItimeout N\fR
Set connect timeout to N seconds.
.TP
\fItracking N\fR
Set tracking time, i.e. how long clients will be remembered. The default 0 will never expire clients based on time.
.TP
\fItransparent\fR
On compatible platforms, use the client's address as source address in the connection to the backend server.
.TP
\fIno transparent\fR
Use Pen's address as source address in the connection to the backend server.
.TP
\fIweb_stats\fR
Return file name of html status reports, if any.
.TP
\fIweb_stats FILE\fR
Set the name of html status reports.
.TP
\fIno web_stats\fR
Do not generate html status reports.
.TP
\fIweight\fR
Use weight for server selection.
.TP
\fIno weight\fR
Do not use weight for server selection.
.TP
\fIwrite [FILE]\fR
Write the current configuration into a file which can be used to start pen. If FILE is omitted, the configuration is written into pen's original configuration file.
.SH SEE ALSO
pen(1)
.SH AUTHOR
Copyright (C) 2002-2015 Ulric Eriksson, .
pen-0.32.0/penctl.c 0000644 0001750 0001750 00000010606 12526564112 010737 0000000 0000000 /*
Copyright (C) 2000-2015 Ulric Eriksson
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
//#include
#include
#include
#include
#include
#include
#ifdef TIME_WITH_SYS_TIME
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "config.h"
static void error(char *fmt, ...)
{
char b[4096];
va_list ap;
va_start(ap, fmt);
vsnprintf(b, sizeof b, fmt, ap);
fprintf(stderr, "%s\n", b);
va_end(ap);
exit(EXIT_FAILURE);
}
static void alarm_handler(int dummy)
{
;
}
static void usage(void)
{
printf("usage: penctl host:port command\n");
exit(0);
}
static int open_unix_socket(char *path)
{
int n, fd;
struct sockaddr_un serv_addr;
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0) error("error opening socket");
memset(&serv_addr, 0, sizeof serv_addr);
serv_addr.sun_family = AF_UNIX;
snprintf(serv_addr.sun_path, sizeof serv_addr.sun_path, "%s", path);
n = connect(fd, (struct sockaddr *)&serv_addr, sizeof serv_addr);
if (n == -1) {
error("error connecting to server");
}
return fd;
}
static int open_socket(char *addr, char *port)
{
int fd = -1;
#if 0
struct sockaddr_in serv_addr;
struct hostent *h;
struct in_addr a;
struct servent *s;
#else
struct addrinfo *ai;
struct addrinfo hints;
struct addrinfo *runp;
#endif
int n;
#if 0
h = gethostbyname(addr);
if (h == NULL) error("unknown or invalid address %s\n", addr);
memcpy(&a, h->h_addr, h->h_length);
s = getservbyname(port, "tcp");
if (s == NULL) po = atoi(port);
else po = ntohs(s->s_port);
fd = socket(AF_INET, SOCK_STREAM, 0);
#else
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
n = getaddrinfo(addr, port, &hints, &ai);
if (n != 0) {
error("getaddrinfo: %s", gai_strerror(n));
}
runp = ai;
/* only using first result; should try all */
fd = socket(runp->ai_family, runp->ai_socktype, runp->ai_protocol);
#endif
if (fd < 0) error("error opening socket");
#if 0
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = a.s_addr;
serv_addr.sin_port = htons(po);
#endif
signal(SIGALRM, alarm_handler);
#if 0
n = connect(fd, (struct sockaddr *)&serv_addr, sizeof serv_addr);
#else
n = connect(fd, runp->ai_addr, runp->ai_addrlen);
#endif
alarm(0);
if (n == -1) {
error("error connecting to server");
}
return fd;
}
int main(int argc, char **argv)
{
int i, fd, n;
char b[1024], *p;
if (argc < 3) {
usage();
}
if (strchr(argv[1], '/')) {
fd = open_unix_socket(argv[1]);
} else {
n = 1+strlen(argv[1]); /* one for \0 */
if (n > sizeof b) error("Overlong arg '%s'", argv[1]);
snprintf(b, sizeof b, "%s", argv[1]);
/* We need the *last* : to allow such arguments as ::1:10080
if pen's control port is ipv6 localhost:10080 */
p = strrchr(b, ':');
if (p == NULL) error("no port given");
*p++ = '\0';
fd = open_socket(b, p);
}
n = 0;
for (i = 2; argv[i]; i++) {
for (p = argv[i]; *p; p++) {
if (n >= (sizeof b)-1) error("Overlong argument list");
b[n++] = *p;
}
b[n++] = ' ';
}
if (n >= (sizeof b)-1) error("Overlong argument list");
b[--n] = '\n'; /* replace last ' ' */
b[++n] = '\0'; /* terminate string */
n = write(fd, b, strlen(b));
if (n == -1) error("error writing to socket");
for (;;) {
n = read(fd, b, sizeof b);
if (n == 0) break;
if (n == -1) error("error reading from socket");
n = write(1, b, n);
if (n == -1) error("error writing to stdout");
}
close(fd);
return 0;
}
pen-0.32.0/ssl.h 0000644 0001750 0001750 00000001312 12510711333 010242 0000000 0000000 #ifdef HAVE_LIBSSL
#include
#include
#define SRV_SSL_V23 0
#define SRV_SSL_V2 1
#define SRV_SSL_V3 2
#define SRV_SSL_TLS1 3
#define OCSP_RESP_MAX 10000
extern char ssl_compat;
extern char require_peer_cert;
extern char ssl_protocol;
extern char *certfile;
extern char *keyfile;
extern char *cacert_dir;
extern char *cacert_file;
extern char *ssl_sni_path;
extern SSL_CTX *ssl_context;
extern long ssl_options;
extern char *ssl_ciphers;
extern int ssl_session_id_context;
extern int ssl_client_renegotiation_interval;
extern unsigned char ocsp_resp_data[OCSP_RESP_MAX];
extern long ocsp_resp_len;
extern char *ocsp_resp_file;
extern int ssl_init(void);
#endif /* HAVE_LIBSSL */
pen-0.32.0/event.c 0000644 0001750 0001750 00000001030 12524651724 010566 0000000 0000000 #include "config.h"
#include "event.h"
#include "pen_epoll.h"
#include "pen_kqueue.h"
#include "pen_poll.h"
#include "pen_select.h"
int timeout = TIMEOUT;
void (*event_add)(int, int);
void (*event_arm)(int, int);
void (*event_delete)(int);
void (*event_wait)(void);
int (*event_fd)(int *);
#if defined HAVE_KQUEUE
void (*event_init)(void) = kqueue_init;
#elif defined HAVE_EPOLL
void (*event_init)(void) = epoll_init;
#elif defined HAVE_POLL
void (*event_init)(void) = poll_init;
#else
void (*event_init)(void) = select_init;
#endif
pen-0.32.0/pen_select.h 0000644 0001750 0001750 00000000037 12514665746 011611 0000000 0000000 extern void select_init(void);
pen-0.32.0/mergelogs.1 0000644 0001750 0001750 00000004256 12527416526 011366 0000000 0000000 .TH MERGELOGS 1 LOCAL
.SH NAME
mergelogs - merge and consolidate web server logs
.SH SYNOPSIS
.B mergelogs
-p penlog [-c] [-d] [-j jitter] [-t seconds] server1:logfile1 [server2:logfile2 ...]
.SH EXAMPLES
mergelogs -p pen.log 10.0.0.1:access_log.1 10.0.0.2:access_log.2
mergelogs -p pen.log 10.0.18.6:access_log-10.0.18.6 10.0.18.8:access_log-10.0.18.8
.SH DESCRIPTION
When pen is used to load balance web servers, the web server log file
lists all accesses as coming from the host running pen. This makes it
more difficult to analyze the log file.
To solve this, pen creates its own log file, which contains the real
client address, the time of the access, the target server address
and the first few bytes of the requests.
Mergelogs reads pen's log file and the log files of all load balanced
web servers, compares each entry and creates a combined log file
that looks as if the web server cluster were a single physical server.
Client addresses are replaced with the real client addresses.
In the event that no matching client address can be found in
the pen log, the server address is used instead. This should never
happen, and is meant as a debugging tool. A large number of these
indicates that the server system date needs to be set, or that
the jitter value is too small.
You probably don't want to use this program. Penlog is a much more
elegant and functional solution.
.SH OPTIONS
.TP
-c
Do not cache pen log entries. The use of this option is not recommended,
as it will make mergelogs search the
entire pen log for every line in the web server logs.
.TP
-d
Debugging (repeat for more).
.TP
-p \fIpenlog\fR
Log file from pen.
.TP
-j \fIjitter\fR
Jitter in seconds (default 600). This is the maximum variation in time
stamps in the pen and web server log files. A smaller value will result
in a smaller pen log cache and faster processing, at the risk of
missed entries.
.TP
-t \fIseconds\fR
The difference in seconds between the time on the pen server and UTC.
For example, this is 7200 (two hours) in Finland.
.TP
server:logfile
Web server address and name of log file.
.SH AUTHOR
Copyright (C) 2001-2015 Ulric Eriksson, .
.SH SEE ALSO
pen(1), webresolve(1), penlog(1), penlogd(1)
pen-0.32.0/penstats 0000755 0001750 0001750 00000000456 12507562420 011076 0000000 0000000 #!/bin/sh
PENHOME=/home/ulric/Projekt/pen
PIDFILE=$PENHOME/pid
WEBFILE=$PENHOME/webstats.html
# This will make pen save its stats
kill -USR1 `cat $PIDFILE`
# We don't know how long it will take; wait a few seconds
sleep 2
# And display the results
echo "Content-type: text/html"
echo
cat $WEBFILE
pen-0.32.0/Makefile.am 0000644 0001750 0001750 00000001763 12526565372 011357 0000000 0000000
bin_PROGRAMS = pen mergelogs penctl penlog penlogd
noinst_HEADERS = pen.h dlist.h ssl.h dsr.h memory.h diag.h settings.h acl.h event.h pen_select.h pen_poll.h pen_kqueue.h pen_epoll.h netconv.h windows.h server.h client.h conn.h idlers.h
pen_SOURCES = pen.c select.c poll.c kqueue.c epoll.c dlist.c ssl.c dsr.c memory.c diag.c settings.c acl.c event.c netconv.c server.c client.c conn.c idlers.c
mergelogs_SOURCES = mergelogs.c memory.c diag.c settings.c
penctl_SOURCES = penctl.c
penlog_SOURCES = penlog.c diag.c settings.c
penlogd_SOURCES = penlogd.c diag.c settings.c
doc_DATA = penstats HOWTO AUTHORS README ChangeLog COPYING
man_MANS = pen.1 mergelogs.1 penctl.1 penlog.1 penlogd.1
EXTRA_DIST = $(man_MANS) $(doc_DATA) penctl.cgi pen.spec siag.pem \
Makefile.win X86/Makefile X64/Makefile windows.c config.h.win \
pen-ocsp.sh
tgz:
rm -rf tmpinst
mkdir tmpinst
make clean
./configure --prefix=/usr
make
make install-strip prefix=tmpinst/usr
(cd tmpinst && makepkg pen.tgz && mv pen.tgz ..)
pen-0.32.0/poll.c 0000644 0001750 0001750 00000005264 12516404572 010426 0000000 0000000 #include "config.h"
#include
#include
#include
#include
//#include "pen.h"
#include "diag.h"
#include "event.h"
#include "memory.h"
#ifdef HAVE_POLL
#include
static struct pollfd *poll_ufds;
static int poll_nfds, poll_count, poll_nfds_max;
static int pindex;
/* Making a sparse pollfd table, using fd as the index seems most efficient. */
/* Need to make sure to grow the table as necessary. */
static void poll_event_ctl(int fd, int events)
{
int pollevents = 0;
DEBUG(2, "poll_event_ctl(fd=%d, events=%d)", fd, events);
if (fd >= poll_nfds_max) {
int i, new_max = fd+10000;
DEBUG(2, "expanding poll_ufds to %d entries", new_max);
poll_ufds = pen_realloc(poll_ufds, new_max * sizeof *poll_ufds);
for (i = poll_nfds_max; i < new_max; i++) {
poll_ufds[i].fd = -1;
poll_ufds[i].events = 0;
}
poll_nfds_max = new_max;
}
if (events & EVENT_READ) pollevents |= POLLIN;
if (events & EVENT_WRITE) pollevents |= POLLOUT;
poll_ufds[fd].fd = fd;
poll_ufds[fd].events = pollevents;
if (fd >= poll_nfds) poll_nfds = fd+1;
}
static void poll_event_add(int fd, int events)
{
DEBUG(2, "poll_event_add(fd=%d, events=%d)", fd, events);
poll_event_ctl(fd, events);
}
static void poll_event_arm(int fd, int events)
{
DEBUG(2, "poll_event_arm(fd=%d, events=%d)", fd, events);
poll_event_ctl(fd, events);
}
static void poll_event_delete(int fd)
{
DEBUG(2, "poll_event_delete(fd=%d)", fd);
poll_ufds[fd].fd = -1; /* ignore events */
poll_ufds[fd].events = 0;
}
static void poll_event_wait(void)
{
DEBUG(2, "poll_event_wait()");
pindex = -1;
poll_count = poll(poll_ufds, poll_nfds, 1000*timeout);
DEBUG(2, "poll returns %d", poll_count);
if (poll_count < 0 && errno != EINTR) {
error("Error on poll: %s", strerror(errno));
}
}
static int poll_event_fd(int *revents)
{
int events = 0;
DEBUG(2, "poll_event_fd(revents=%p)", revents);
for (pindex++; pindex < poll_nfds; pindex++) {
DEBUG(3, "\tpoll_ufds[%d] = {fd=%d, revents=%d}", pindex, poll_ufds[pindex].fd, poll_ufds[pindex].revents);
if (poll_ufds[pindex].revents & POLLIN) events |= EVENT_READ;
if (poll_ufds[pindex].revents & POLLOUT) events |= EVENT_WRITE;
if (events) {
*revents = events;
return poll_ufds[pindex].fd;
}
}
return -1;
}
void poll_init(void)
{
DEBUG(2, "poll_init()");
poll_nfds = poll_nfds_max = 0;
poll_ufds = NULL;
event_add = poll_event_add;
event_arm = poll_event_arm;
event_delete = poll_event_delete;
event_wait = poll_event_wait;
event_fd = poll_event_fd;
}
#else
void poll_init(void)
{
debug("You don't have poll");
exit(EXIT_FAILURE);
}
#endif
pen-0.32.0/server.c 0000644 0001750 0001750 00000030527 12616170264 010765 0000000 0000000 #include "config.h"
#include
#include
#include
#include
#include
#ifndef WINDOWS
#include
#endif
#ifdef HAVE_LIBSSL
#include
#include
#endif
#include "acl.h"
#include "client.h"
#include "conn.h"
#include "diag.h"
#include "dlist.h"
#include "event.h"
#include "memory.h"
#include "netconv.h"
#include "pen.h"
#include "server.h"
#include "settings.h"
#include "windows.h"
#ifndef WINDOWS
#define CONNECT_IN_PROGRESS (EINPROGRESS)
#endif
int nservers = 0;
server *servers = NULL;
int current; /* current server */
int emerg_server = NO_SERVER; /* server of last resort */
static int emergency = 0; /* are we using the emergency server? */
int abuse_server = NO_SERVER; /* server for naughty clients */
int blacklist_time = BLACKLIST_TIME;
int server_alg;
char *e_server = NULL;
char *a_server = NULL;
static int pen_hash(struct sockaddr_storage *a)
{
struct sockaddr_in *si;
struct sockaddr_in6 *si6;
unsigned char *u;
int hash;
switch (a->ss_family) {
case AF_INET:
si = (struct sockaddr_in *)a;
if (server_alg & ALG_ROUNDROBIN) {
hash = (si->sin_addr.s_addr ^ si->sin_port) % (nservers?nservers:1);
} else {
hash = si->sin_addr.s_addr % (nservers?nservers:1);
}
DEBUG(2, "Hash: %d", hash);
return hash;
case AF_INET6:
si6 = (struct sockaddr_in6 *)a;
u = (unsigned char *)(&si6->sin6_addr);
return u[15] % (nservers?nservers:1);
default:
return 0;
}
}
/* Introduce the new format "[address]:port:maxc:hard:weight:prio"
in addition to the old one.
*/
void setaddress(int server, char *s, int dp, char *proto)
{
char address[1024], pno[100];
int n;
char *format;
int port;
if (s[0] == '[') {
format = "[%999[^]]]:%99[^:]:%d:%d:%d:%d";
} else {
format = "%999[^:]:%99[^:]:%d:%d:%d:%d";
}
n = sscanf(s, format, address, pno,
&servers[server].maxc, &servers[server].hard,
&servers[server].weight, &servers[server].prio);
if (n > 1) port = getport(pno, proto);
else port = dp;
if (n < 3) servers[server].maxc = 0;
if (n < 4) servers[server].hard = 0;
if (n < 5) servers[server].weight = 0;
if (n < 6) servers[server].prio = 0;
DEBUG(2, "n = %d, address = %s, pno = %d, maxc1 = %d, hard = %d, weight = %d, prio = %d, proto = %s ", \
n, address, port, servers[server].maxc, \
servers[server].hard, servers[server].weight, \
servers[server].prio, proto);
if (pen_aton(address, &servers[server].addr) == 0) {
error("unknown or invalid address [%s]", address);
}
memset(servers[server].hwaddr, 0, 6);
pen_setport(&servers[server].addr, port);
}
void blacklist_server(int server)
{
servers[server].status = now;
}
int unused_server_slot(int i)
{
struct sockaddr_storage *a = &servers[i].addr;
if (a->ss_family == AF_INET) {
struct sockaddr_in *si = (struct sockaddr_in *)a;
if (si->sin_addr.s_addr == 0) return i;
}
return 0;
}
int server_is_blacklisted(int i)
{
return (now-servers[i].status < blacklist_time);
}
int server_is_unavailable(int i)
{
return unused_server_slot(i) || server_is_blacklisted(i);
}
static int server_by_weight(void)
{
int best_server = NO_SERVER;
int best_load = -1;
int i, load;
DEBUG(2, "server_by_weight()");
for (i = 0; i < nservers; i++) {
if (server_is_unavailable(i)) continue;
if (servers[i].weight == 0) continue;
load = (WEIGHT_FACTOR*servers[i].c)/servers[i].weight;
if (best_server == NO_SERVER || load < best_load) {
DEBUG(2, "Server %d has load %d", i, load);
best_load = load;
best_server = i;
}
}
DEBUG(2, "Least loaded server = %d", best_server);
return best_server;
}
static int server_by_prio(void)
{
int best_server = NO_SERVER;
int best_prio = -1;
int i, prio;
DEBUG(2, "server_by_prio()");
for (i = 0; i < nservers; i++) {
if (server_is_unavailable(i)) continue;
prio = servers[i].prio;
if (best_server == NO_SERVER || prio < best_prio) {
DEBUG(2, "Server %d has prio %d", i, prio);
best_prio = prio;
best_server = i;
}
}
DEBUG(2, "Best prio server = %d", best_server);
return best_server;
}
int server_by_roundrobin(void)
{
static int last_server = 0;
int i = last_server;
if (nservers == 0) return NO_SERVER;
do {
i = (i+1) % (nservers?nservers:1);
DEBUG(3, "server_by_roundrobin considering server %d", i);
if (!server_is_unavailable(i)) return (last_server = i);
DEBUG(3, "server %d is unavailable, try next one", i);
} while (i != last_server);
return NO_SERVER;
}
/* Suggest a server for the initial field of the connection.
Return NO_SERVER if none available.
*/
int initial_server(int conn)
{
int pd = match_acl(client_acl, &clients[conns[conn].client].addr);
if (!pd) {
DEBUG(1, "initial_server: denied by acl");
return abuse_server;
/* returning abuse_server is correct even if it is not set
because it defaults to NO_SERVER */
}
if (!(server_alg & ALG_ROUNDROBIN)) {
// Load balancing with memory == No roundrobin
int server = clients[conns[conn].client].server;
/* server may be NO_SERVER if this is a new client */
if (server != NO_SERVER && server != emerg_server && server != abuse_server) {
DEBUG(2, "Will try previous server %d for client %d", server, conns[conn].client);
return server;
}
}
if (server_alg & ALG_PRIO) return server_by_prio();
if (server_alg & ALG_WEIGHT) return server_by_weight();
if (server_alg & ALG_HASH) return pen_hash(&clients[conns[conn].client].addr);
return server_by_roundrobin();
}
/* Returns 1 if a failover server candidate is available.
Close connection and return 0 if none was found.
*/
int failover_server(int conn)
{
int server = conns[conn].server;
DEBUG(2, "failover_server(%d): server = %d", conn, server);
if (server_alg & ALG_STUBBORN) {
DEBUG(2, "Won't failover because we are stubborn");
close_conn(conn);
return 0;
}
if (server == ABUSE_SERVER) {
DEBUG(2, "Won't failover from abuse server (%d)", abuse_server);
close_conn(conn);
return 0;
}
if (server == EMERGENCY_SERVER) {
DEBUG(2, "Already using emergency server (%d), won't fail over", emerg_server);
close_conn(conn);
return 0;
}
if (conns[conn].upfd != -1) {
close(conns[conn].upfd);
conns[conn].upfd = -1;
}
/* there needs to be at least two regular servers in order to fail over to something else */
/* and if we couldn't find a candidate for initial_server, we're not going to find one now */
if (nservers > 1 && server != NO_SERVER) {
DEBUG(2, "Trying to find failover server. server = %d, initial = %d, nservers = %d", server, conns[conn].initial, nservers);
do {
server = (server+1) % nservers;
DEBUG(2, "Intend to try server %d", server);
if (try_server(server, conn)) return 1;
} while (server != conns[conn].initial);
}
DEBUG(1, "using emergency server, remember to reset flag");
emergency = 1;
if (try_server(emerg_server, conn)) return 1;
close_conn(conn);
return 0;
}
/* Using os-specific, similar but incompatible techniques, attempt to be transparent by
setting our local upstream address to the client's address */
static void spoof_bind(int server, int conn, int upfd)
{
#if defined(IP_TRANSPARENT) /* Linux */
#define SOL_TRANSPARENCY SOL_IP
#define PEN_TRANSPARENCY IP_TRANSPARENT
#elif defined(SO_BINDANY) /* OpenBSD */
#define SOL_TRANSPARENCY SOL_SOCKET
#define PEN_TRANSPARENCY SO_BINDANY
#elif defined(IP_BINDANY) /* FreeBSD */
#define SOL_TRANSPARENCY IPPROTO_IP
#define PEN_TRANSPARENCY IP_BINDANY
#else
#undef PEN_TRANSPARENCY
#endif
#ifdef PEN_TRANSPARENCY
int client = conns[conn].client;
int n;
int one = 1;
struct sockaddr_storage *sss = &servers[server].addr;
struct sockaddr_storage *css = &clients[client].addr;
struct sockaddr_in *caddr, addr;
DEBUG(1, "spoof_bind(server = %d, conn = %d, upfd = %d)", server, conn, upfd);
DEBUG(1, "client = %d", client);
if (sss->ss_family != AF_INET || css->ss_family != AF_INET) {
DEBUG(1, "server family = %d", sss->ss_family);
DEBUG(1, "client family = %d", css->ss_family);
debug("No transparency for incompatible families");
return;
}
n = setsockopt(upfd, SOL_TRANSPARENCY, PEN_TRANSPARENCY, &one, sizeof one);
if (n == -1) {
DEBUG(1, "upfd = %d", upfd);
debug("setsockopt: %s", strerror(errno));
return;
}
caddr = (struct sockaddr_in *)css;
addr.sin_family = caddr->sin_family;
addr.sin_port = 0;
addr.sin_addr.s_addr = caddr->sin_addr.s_addr;
n = bind(upfd, (struct sockaddr *)&addr, sizeof addr);
if (n == -1) {
DEBUG(1, "upfd = %d", upfd);
debug("bind: %s", strerror(errno));
return;
}
#else
debug("You are trying to be transparent, but it is not supported");
#endif
}
/* Initiate connection to server 'index' and populate upfd field in connection */
/* return 1 for (potential) success, 0 for failure */
int try_server(int index, int conn)
{
int upfd;
int client = conns[conn].client;
int n = 0, err;
int optval = 1;
struct sockaddr_storage *addr = &servers[index].addr;
/* The idea is that a client should be able to connect again to the same server
even if the server is close to its configured connection limit */
int sticky = ((client != -1) && (index == clients[client].server));
if (index == NO_SERVER) {
DEBUG(2, "Won't try to connect to NO_SERVER");
return 0; /* out of bounds */
}
DEBUG(2, "Trying server %d for connection %d at time %d", index, conn, now);
if (pen_getport(addr) == 0) {
DEBUG(1, "No port for you!");
return 0;
}
if (now-servers[index].status < blacklist_time) {
DEBUG(1, "Server %d is blacklisted", index);
return 0;
}
if (servers[index].maxc != 0 &&
(servers[index].c >= servers[index].maxc) &&
(sticky == 0 || servers[index].c >= servers[index].hard)) {
DEBUG(1, "Server %d is overloaded: sticky=%d, maxc=%d, hard=%d", \
index, sticky, servers[index].maxc, servers[index].hard);
return 0;
}
if ((client != -1) && !match_acl(servers[index].acl, &(clients[client].addr))) {
DEBUG(1, "try_server: denied by acl");
return 0;
}
upfd = socket_nb(addr->ss_family, protoid, 0);
if (keepalive) {
setsockopt(upfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&optval, sizeof optval);
}
if (debuglevel > 1) {
debug("Connecting to %s", pen_ntoa(addr));
pen_dumpaddr(addr);
}
conns[conn].t = now;
if (transparent) spoof_bind(index, conn, upfd);
n = connect(upfd, (struct sockaddr *)addr, pen_ss_size(addr));
err = socket_errno;
DEBUG(2, "connect (upfd = %d) returns %d, errno = %d, socket_errno = %d",
upfd, n, errno, err);
/* A new complication is that we don't know yet if the connect will succeed. */
if (n == 0) { /* connection completed */
conns[conn].state = CS_CONNECTED;
if (conns[conn].downfd == -1) {
/* idler */
conns[conn].state |= CS_CLOSED_DOWN;
}
event_add(upfd, EVENT_READ);
if (!udp) event_add(conns[conn].downfd, EVENT_READ);
servers[index].c++;
if (servers[index].status) {
servers[index].status = 0;
DEBUG(1, "Server %d ok", index);
}
DEBUG(2, "Successful connect to server %d\n" \
"conns[%d].client = %d\n" \
"conns[%d].server = %d", \
index, conn, conns[conn].client, conn, conns[conn].server);
} else if (err == CONNECT_IN_PROGRESS) { /* may potentially succeed */
conns[conn].state = CS_IN_PROGRESS;
pending_list = dlist_insert(pending_list, conn);
conns[conn].pend = pending_list;
pending_queue++;
event_add(upfd, EVENT_WRITE);
DEBUG(2, "Pending connect to server %d\n" \
"conns[%d].client = %d\n" \
"conns[%d].server = %d", \
index, conn, conns[conn].client, conn, conns[conn].server);
} else { /* failed definitely */
if (servers[index].status == 0) {
debug("Server %d failed, retry in %d sec: %d",
index, blacklist_time, socket_errno);
}
debug("blacklisting server %d because connect error %d", index, err);
blacklist_server(index);
close(upfd);
return 0;
}
conns[conn].server = index;
DEBUG(2, "Setting server %d for client %d", index, client);
clients[client].server = index;
current = index;
conns[conn].upfd = upfd;
fd2conn_set(upfd, conn);
return 1;
}
/* we want size server slots plus two for abuse and emergency */
void expand_servertable(int size)
{
static server *server_storage = NULL;
static int real_size = 0;
int new_size = size+2; /* for emergency and abuse servers */
if (new_size <= real_size) return; /* nothing to expand here */
server_storage = pen_realloc(server_storage, new_size*sizeof *server_storage);
memset(&server_storage[real_size], 0, (new_size-real_size)*sizeof server_storage[0]);
servers = &server_storage[2]; /* making server[0] the first regular server */
real_size = new_size;
if (size > nservers) nservers = size;
}
pen-0.32.0/configure 0000755 0001750 0001750 00000557316 12624554543 011241 0000000 0000000 #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for pen 0.32.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
if (eval "$as_required") 2>/dev/null; then :
as_have_required=yes
else
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
as_found=:
case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir/$as_base
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
CONFIG_SHELL=$as_shell as_have_required=yes
if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
break 2
fi
fi
done;;
esac
as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
$as_echo "$0: This script requires a shell more modern than all"
$as_echo "$0: the shells that I found on your system."
if test x${ZSH_VERSION+set} = xset ; then
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
fi
exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
as_lineno_1=$LINENO as_lineno_1a=$LINENO
as_lineno_2=$LINENO as_lineno_2a=$LINENO
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
test -n "$DJDIR" || exec 7<&0 &1
# Name of the host.
# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pen'
PACKAGE_TARNAME='pen'
PACKAGE_VERSION='0.32.0'
PACKAGE_STRING='pen 0.32.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
ac_unique_file="pen.c"
# Factoring default headers for most tests.
ac_includes_default="\
#include
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#ifdef HAVE_SYS_STAT_H
# include
#endif
#ifdef STDC_HEADERS
# include
# include
#else
# ifdef HAVE_STDLIB_H
# include
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
# include
# endif
# include
#endif
#ifdef HAVE_STRINGS_H
# include
#endif
#ifdef HAVE_INTTYPES_H
# include
#endif
#ifdef HAVE_STDINT_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif"
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
EGREP
GREP
CPP
LN_S
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
am__nodep
AMDEPBACKSLASH
AMDEP_FALSE
AMDEP_TRUE
am__quote
am__include
DEPDIR
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
AM_V
am__untar
am__tar
AMTAR
am__leading_dot
SET_MAKE
AWK
mkdir_p
MKDIR_P
INSTALL_STRIP_PROGRAM
STRIP
install_sh
MAKEINFO
AUTOHEADER
AUTOMAKE
AUTOCONF
ACLOCAL
VERSION
PACKAGE
CYGPATH_W
am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_silent_rules
enable_dependency_tracking
enable_profiling
enable_debugging
with_daemon
with_poll
with_epoll
with_kqueue
with_fd_setsize
with_ssl
with_geoip
with_dsr
with_docdir
'
ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
# Check all directory arguments for consistency.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
case $ac_val in
*/ )
ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
eval $ac_var=\$ac_val;;
esac
# Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_myself" : 'X\(//\)[^/]' \| \
X"$as_myself" : 'X\(//\)$' \| \
X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_myself" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures pen 0.32.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/pen]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of pen 0.32.0:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
--enable-dependency-tracking
do not reject slow dependency extractors
--disable-dependency-tracking
speeds up one-time build
--enable-profiling enable profiling
--enable-debugging enable debugging messages
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-daemon use daemon() if available
--with-poll use poll() if available
--with-epoll use epoll if available
--with-kqueue use kqueue() if available
--with-fd_setsize=N set FD_SETSIZE to N (see INSTALL)
--with-ssl use SSL (default /usr/local/ssl)
--with-geoip use libgeoip
--with-dsr enable direct server return
--with-docdir=DIR install docs in DIR [PREFIX/doc/pen]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
_ACEOF
ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d "$ac_dir" ||
{ cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# Check for guested configure.
if test -f "$ac_srcdir/configure.gnu"; then
echo &&
$SHELL "$ac_srcdir/configure.gnu" --help=recursive
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
pen configure 0.32.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
## ------------------------ ##
## Autoconf initialization. ##
## ------------------------ ##
# ac_fn_c_try_compile LINENO
# --------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
# ac_fn_c_try_cpp LINENO
# ----------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_cpp ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
# ac_fn_c_try_run LINENO
# ----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
# that executables *can* be run.
ac_fn_c_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then :
ac_retval=0
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_header_compiler=yes
else
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
ac_header_preproc=yes
else
ac_header_preproc=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
# variable VAR accordingly.
ac_fn_c_check_type ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof ($2))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
if (sizeof (($2)))
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
eval "$3=yes"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case declares $2.
For example, HP-UX 11i declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer to if __STDC__ is defined, since
exists even on freestanding compilers. */
#ifdef __STDC__
# include
#else
# include
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by pen $as_me 0.32.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
_ACEOF
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
$as_echo "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
{ ac_configure_args0=; unset ac_configure_args0;}
{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
$as_echo "## ---------------- ##
## Cache variables. ##
## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
$as_echo "## ----------------- ##
## Output variables. ##
## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
$as_echo "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
$as_echo "## ----------- ##
## confdefs.h. ##
## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
$as_echo "$as_me: caught signal $ac_signal"
$as_echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
$as_echo "/* confdefs.h */" > confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_URL "$PACKAGE_URL"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
# We do not want a PATH search for config.site.
case $CONFIG_SITE in #((
-*) ac_site_file1=./$CONFIG_SITE;;
*/*) ac_site_file1=$CONFIG_SITE;;
*) ac_site_file1=./$CONFIG_SITE;;
esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
else
ac_site_file1=$ac_default_prefix/share/config.site
ac_site_file2=$ac_default_prefix/etc/config.site
fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file" \
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
See \`config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special files
# actually), so we avoid doing that. DJGPP emulates it as a regular file.
if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
# differences in whitespace do not lead to failure.
ac_old_val_w=`echo x $ac_old_val`
ac_new_val_w=`echo x $ac_new_val`
if test "$ac_old_val_w" != "$ac_new_val_w"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
ac_cache_corrupted=:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
eval $ac_var=\$ac_old_val
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h"
am__api_version='1.14'
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
# Reject install programs that cannot install multiple files.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
case $as_dir/ in #((
./ | .// | /[cC]/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
rm -rf conftest.one conftest.two conftest.dir
echo one > conftest.one
echo two > conftest.two
mkdir conftest.dir
if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
test -s conftest.one && test -s conftest.two &&
test -s conftest.dir/conftest.one &&
test -s conftest.dir/conftest.two
then
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
fi
done
done
;;
esac
done
IFS=$as_save_IFS
rm -rf conftest.one conftest.two conftest.dir
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. Don't cache a
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
$as_echo "$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
$as_echo_n "checking whether build environment is sane... " >&6; }
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
'
case `pwd` in
*[\\\"\#\$\&\'\`$am_lf]*)
as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
esac
# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
am_has_slept=no
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$*" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
if test "$*" != "X $srcdir/configure conftest.file" \
&& test "$*" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
alias in your environment" "$LINENO" 5
fi
if test "$2" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$2" = conftest.file
)
then
# Ok.
:
else
as_fn_error $? "newly created file is older than distributed files!
Check your system clock" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
rm -f conftest.file
test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
program_transform_name="s&\$&$program_suffix&;$program_transform_name"
# Double any \ or $.
# By default was `s,x,x', remove it if useless.
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING "
else
am_missing_run=
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
if test x"${install_sh}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
*)
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
# Installed binaries are usually stripped using 'strip' when the user
# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the 'STRIP' environment variable to overrule this program.
if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
$as_echo "$STRIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
$as_echo "$ac_ct_STRIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_STRIP" = x; then
STRIP=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
STRIP=$ac_ct_STRIP
fi
else
STRIP="$ac_cv_prog_STRIP"
fi
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
if ${ac_cv_path_mkdir+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir (GNU coreutils) '* | \
'mkdir (coreutils) '* | \
'mkdir (fileutils) '4.1*)
ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
break 3;;
esac
done
done
done
IFS=$as_save_IFS
fi
test -d ./--version && rmdir ./--version
if test "${ac_cv_path_mkdir+set}" = set; then
MKDIR_P="$ac_cv_path_mkdir -p"
else
# As a last resort, use the slow shell script. Don't cache a
# value for MKDIR_P within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
MKDIR_P="$ac_install_sh -d"
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
$as_echo "$MKDIR_P" >&6; }
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
$as_echo "$AWK" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$AWK" && break
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
$as_echo_n "(cached) " >&6
else
cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
*)
eval ac_cv_prog_make_${ac_make}_set=no;;
esac
rm -f conftest.make
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
SET_MAKE=
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
# Check whether --enable-silent-rules was given.
if test "${enable_silent_rules+set}" = set; then :
enableval=$enable_silent_rules;
fi
case $enable_silent_rules in # (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=1;;
esac
am_make=${MAKE-make}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
if ${am_cv_make_support_nested_variables+:} false; then :
$as_echo_n "(cached) " >&6
else
if $as_echo 'TRUE=$(BAR$(V))
BAR0=false
BAR1=true
V=1
am__doit:
@$(TRUE)
.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
am_cv_make_support_nested_variables=yes
else
am_cv_make_support_nested_variables=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
$as_echo "$am_cv_make_support_nested_variables" >&6; }
if test $am_cv_make_support_nested_variables = yes; then
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AM_BACKSLASH='\'
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
am__isrc=' -I$(srcdir)'
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
# Define the identity of the package.
PACKAGE='pen'
VERSION='0.32.0'
cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
_ACEOF
# Some tools Automake needs.
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
#
#
mkdir_p='$(MKDIR_P)'
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AMTAR='$${TAR-tar}'
# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar pax cpio none'
am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard:
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: .
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
if { { ac_try="$ac_link_default"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
# so that the user can short-circuit this test for compilers unknown to
# Autoconf.
for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
# We set ac_cv_exeext here because the later test for it is not
# safe: cross compilers may not add the suffix if given an `-o'
# argument, so we may need to know it at that point already.
# Even if this section looks crufty: it has the advantage of
# actually working.
break;;
* )
break;;
esac
done
test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
if test -z "$ac_file"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
See \`config.log' for more details" "$LINENO" 5; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
$as_echo_n "checking for C compiler default output file name... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
FILE *f = fopen ("conftest.out", "w");
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
ac_clean_files="$ac_clean_files conftest.out"
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
$as_echo_n "checking whether we are cross compiling... " >&6; }
if test "$cross_compiling" != yes; then
{ { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
if { ac_try='./conftest$ac_cv_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
$as_echo "$cross_compiling" >&6; }
rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
$as_echo "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
if ${am_cv_prog_cc_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
# Make sure it works both with $CC and with simple cc.
# Following AC_PROG_CC_C_O, we do the test twice because some
# compilers refuse to overwrite an existing .o file with -o,
# though they will create one.
am_cv_prog_cc_c_o=yes
for am_i in 1 2; do
if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } \
&& test -f conftest2.$ac_objext; then
: OK
else
am_cv_prog_cc_c_o=no
break
fi
done
rm -f core conftest*
unset am_i
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
$as_echo "$am_cv_prog_cc_c_o" >&6; }
if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles"
am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo this is the am__doit target
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
$as_echo_n "checking for style of include used by $am_make... " >&6; }
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
$as_echo "$_am_result" >&6; }
rm -f confinc confmf
# Check whether --enable-dependency-tracking was given.
if test "${enable_dependency_tracking+set}" = set; then :
enableval=$enable_dependency_tracking;
fi
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
am__nodep='_no'
fi
if test "x$enable_dependency_tracking" != xno; then
AMDEP_TRUE=
AMDEP_FALSE='#'
else
AMDEP_TRUE='#'
AMDEP_FALSE=
fi
depcc="$CC" am_compiler_list=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
$as_echo_n "checking dependency style of $depcc... " >&6; }
if ${am_cv_CC_dependencies_compiler_type+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named 'D' -- because '-MD' means "put the output
# in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_CC_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
fi
am__universal=false
case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 10 /bin/sh.
echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_CC_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_CC_dependencies_compiler_type=none
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
if
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
am__fastdepCC_TRUE=
am__fastdepCC_FALSE='#'
else
am__fastdepCC_TRUE='#'
am__fastdepCC_FALSE=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
$as_echo_n "checking whether ln -s works... " >&6; }
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
$as_echo "no, using $LN_S" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5
$as_echo_n "checking for library containing strerror... " >&6; }
if ${ac_cv_search_strerror+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char strerror ();
int
main ()
{
return strerror ();
;
return 0;
}
_ACEOF
for ac_lib in '' cposix; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_strerror=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_strerror+:} false; then :
break
fi
done
if ${ac_cv_search_strerror+:} false; then :
else
ac_cv_search_strerror=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5
$as_echo "$ac_cv_search_strerror" >&6; }
ac_res=$ac_cv_search_strerror
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lsocket" >&5
$as_echo_n "checking for main in -lsocket... " >&6; }
if ${ac_cv_lib_socket_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return main ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_socket_main=yes
else
ac_cv_lib_socket_main=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_main" >&5
$as_echo "$ac_cv_lib_socket_main" >&6; }
if test "x$ac_cv_lib_socket_main" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSOCKET 1
_ACEOF
LIBS="-lsocket $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5
$as_echo_n "checking for main in -lnsl... " >&6; }
if ${ac_cv_lib_nsl_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnsl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return main ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_nsl_main=yes
else
ac_cv_lib_nsl_main=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_main" >&5
$as_echo "$ac_cv_lib_nsl_main" >&6; }
if test "x$ac_cv_lib_nsl_main" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBNSL 1
_ACEOF
LIBS="-lnsl $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5
$as_echo_n "checking for inet_aton in -lresolv... " >&6; }
if ${ac_cv_lib_resolv_inet_aton+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lresolv $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char inet_aton ();
int
main ()
{
return inet_aton ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_resolv_inet_aton=yes
else
ac_cv_lib_resolv_inet_aton=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5
$as_echo "$ac_cv_lib_resolv_inet_aton" >&6; }
if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBRESOLV 1
_ACEOF
LIBS="-lresolv $LIBS"
fi
ac_header_dirent=no
for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
if eval \${$as_ac_Header+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include <$ac_hdr>
int
main ()
{
if ((DIR *) 0)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$as_ac_Header=yes"
else
eval "$as_ac_Header=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$as_ac_Header
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
_ACEOF
ac_header_dirent=$ac_hdr; break
fi
done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
$as_echo_n "checking for library containing opendir... " >&6; }
if ${ac_cv_search_opendir+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char opendir ();
int
main ()
{
return opendir ();
;
return 0;
}
_ACEOF
for ac_lib in '' dir; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_opendir=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_opendir+:} false; then :
break
fi
done
if ${ac_cv_search_opendir+:} false; then :
else
ac_cv_search_opendir=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
$as_echo "$ac_cv_search_opendir" >&6; }
ac_res=$ac_cv_search_opendir
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
$as_echo_n "checking for library containing opendir... " >&6; }
if ${ac_cv_search_opendir+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char opendir ();
int
main ()
{
return opendir ();
;
return 0;
}
_ACEOF
for ac_lib in '' x; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_opendir=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_opendir+:} false; then :
break
fi
done
if ${ac_cv_search_opendir+:} false; then :
else
ac_cv_search_opendir=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
$as_echo "$ac_cv_search_opendir" >&6; }
ac_res=$ac_cv_search_opendir
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
$as_echo_n "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
done
ac_cv_prog_CPP=$CPP
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
$as_echo "$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
ac_path_GREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
ac_path_GREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_GREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
$as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
if test -z "$EGREP"; then
ac_path_EGREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
ac_path_EGREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_EGREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
$as_echo "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5
$as_echo_n "checking whether sys/types.h defines makedev... " >&6; }
if ${ac_cv_header_sys_types_h_makedev+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
return makedev(0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_header_sys_types_h_makedev=yes
else
ac_cv_header_sys_types_h_makedev=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5
$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; }
if test $ac_cv_header_sys_types_h_makedev = no; then
ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_mkdev_h" = xyes; then :
$as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h
fi
if test $ac_cv_header_sys_mkdev_h = no; then
ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then :
$as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h
fi
fi
fi
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
if test "x$ac_cv_type_size_t" = xyes; then :
else
cat >>confdefs.h <<_ACEOF
#define size_t unsigned int
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
if ${ac_cv_header_time+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
int
main ()
{
if ((struct tm *) 0)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_time=yes
else
ac_cv_header_time=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
$as_echo "$ac_cv_header_time" >&6; }
if test $ac_cv_header_time = yes; then
$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
if ${ac_cv_struct_tm+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
struct tm tm;
int *p = &tm.tm_sec;
return !p;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_struct_tm=time.h
else
ac_cv_struct_tm=sys/time.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
$as_echo "$ac_cv_struct_tm" >&6; }
if test $ac_cv_struct_tm = sys/time.h; then
$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
fi
if test "$GCC" = "yes"; then
CFLAGS="-Wall $CFLAGS"
fi
ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
if test "x$ac_cv_func_getaddrinfo" = xyes; then :
$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "accept4" "ac_cv_func_accept4"
if test "x$ac_cv_func_accept4" = xyes; then :
$as_echo "#define HAVE_ACCEPT4 1" >>confdefs.h
fi
for ac_header in sys/select.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_select_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_SELECT_H 1
_ACEOF
fi
done
# Check whether --enable-profiling was given.
if test "${enable_profiling+set}" = set; then :
enableval=$enable_profiling; if test "$withval" != "no"; then
CFLAGS="$CFLAGS -pg"
fi
fi
# Check whether --enable-debugging was given.
if test "${enable_debugging+set}" = set; then :
enableval=$enable_debugging;
fi
if test "$enable_debugging" != "no"; then :
CFLAGS="$CFLAGS -DDEBUGGING"
fi
# Check whether --with-daemon was given.
if test "${with_daemon+set}" = set; then :
withval=$with_daemon; if test "$withval" != "no"; then
ac_fn_c_check_func "$LINENO" "daemon" "ac_cv_func_daemon"
if test "x$ac_cv_func_daemon" = xyes; then :
$as_echo "#define HAVE_DAEMON 1" >>confdefs.h
fi
fi
fi
# Check whether --with-poll was given.
if test "${with_poll+set}" = set; then :
withval=$with_poll;
fi
if test "$with_poll" != "no"; then :
ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll"
if test "x$ac_cv_func_poll" = xyes; then :
$as_echo "#define HAVE_POLL 1" >>confdefs.h
fi
fi
# Check whether --with-epoll was given.
if test "${with_epoll+set}" = set; then :
withval=$with_epoll;
fi
if test "$with_epoll" != "no"; then :
ac_fn_c_check_func "$LINENO" "epoll_create1" "ac_cv_func_epoll_create1"
if test "x$ac_cv_func_epoll_create1" = xyes; then :
$as_echo "#define HAVE_EPOLL 1" >>confdefs.h
fi
fi
# Check whether --with-kqueue was given.
if test "${with_kqueue+set}" = set; then :
withval=$with_kqueue;
fi
if test "$with_kqueue" != "no"; then :
ac_fn_c_check_func "$LINENO" "kqueue" "ac_cv_func_kqueue"
if test "x$ac_cv_func_kqueue" = xyes; then :
$as_echo "#define HAVE_KQUEUE 1" >>confdefs.h
fi
fi
# Check whether --with-fd_setsize was given.
if test "${with_fd_setsize+set}" = set; then :
withval=$with_fd_setsize; if test "$withval" != "no"; then
cat >>confdefs.h <<_ACEOF
#define FD_SETSIZE $withval
_ACEOF
fi
fi
# Check whether --with-ssl was given.
if test "${with_ssl+set}" = set; then :
withval=$with_ssl;
fi
if test "$with_ssl" != "no"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcrypto" >&5
$as_echo_n "checking for main in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return main ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_crypto_main=yes
else
ac_cv_lib_crypto_main=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_main" >&5
$as_echo "$ac_cv_lib_crypto_main" >&6; }
if test "x$ac_cv_lib_crypto_main" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
LIBS="-lcrypto $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lssl" >&5
$as_echo_n "checking for main in -lssl... " >&6; }
if ${ac_cv_lib_ssl_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lssl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return main ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ssl_main=yes
else
ac_cv_lib_ssl_main=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_main" >&5
$as_echo "$ac_cv_lib_ssl_main" >&6; }
if test "x$ac_cv_lib_ssl_main" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSSL 1
_ACEOF
LIBS="-lssl $LIBS"
fi
fi
ac_fn_c_check_func "$LINENO" "EC_KEY_new_by_curve_name" "ac_cv_func_EC_KEY_new_by_curve_name"
if test "x$ac_cv_func_EC_KEY_new_by_curve_name" = xyes; then :
$as_echo "#define HAVE_EC_KEY 1" >>confdefs.h
fi
# Check whether --with-geoip was given.
if test "${with_geoip+set}" = set; then :
withval=$with_geoip;
fi
if test "$with_geoip" != "no"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GeoIP_country_code_by_addr in -lGeoIP" >&5
$as_echo_n "checking for GeoIP_country_code_by_addr in -lGeoIP... " >&6; }
if ${ac_cv_lib_GeoIP_GeoIP_country_code_by_addr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lGeoIP $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char GeoIP_country_code_by_addr ();
int
main ()
{
return GeoIP_country_code_by_addr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_GeoIP_GeoIP_country_code_by_addr=yes
else
ac_cv_lib_GeoIP_GeoIP_country_code_by_addr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GeoIP_GeoIP_country_code_by_addr" >&5
$as_echo "$ac_cv_lib_GeoIP_GeoIP_country_code_by_addr" >&6; }
if test "x$ac_cv_lib_GeoIP_GeoIP_country_code_by_addr" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBGEOIP 1
_ACEOF
LIBS="-lGeoIP $LIBS"
fi
fi
# Check whether --with-dsr was given.
if test "${with_dsr+set}" = set; then :
withval=$with_dsr;
fi
if test "$with_dsr" != "no"; then :
for ac_header in linux/if_packet.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "linux/if_packet.h" "ac_cv_header_linux_if_packet_h" "$ac_includes_default"
if test "x$ac_cv_header_linux_if_packet_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LINUX_IF_PACKET_H 1
_ACEOF
fi
done
for ac_header in net/netmap_user.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "net/netmap_user.h" "ac_cv_header_net_netmap_user_h" "$ac_includes_default"
if test "x$ac_cv_header_net_netmap_user_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_NET_NETMAP_USER_H 1
_ACEOF
fi
done
fi
docdir='${prefix}/doc/pen'
# Check whether --with-docdir was given.
if test "${with_docdir+set}" = set; then :
withval=$with_docdir; if test "$withval" != "yes" && test "$withval" != "no"; then
docdir=$withval
fi
fi
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes: double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
) |
sed '
/^ac_cv_env_/b end
t clear
:clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
if test ! -f "$cache_file" || test -h "$cache_file"; then
cat confcache >"$cache_file"
else
case $cache_file in #(
*/* | ?:*)
mv -f confcache "$cache_file"$$ &&
mv -f "$cache_file"$$ "$cache_file" ;; #(
*)
mv -f confcache "$cache_file" ;;
esac
fi
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
$as_echo_n "checking that generated files are newer than configure... " >&6; }
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
$as_echo "done" >&6; }
if test -n "$EXEEXT"; then
am__EXEEXT_TRUE=
am__EXEEXT_FALSE='#'
else
am__EXEEXT_TRUE='#'
am__EXEEXT_FALSE=
fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
as_fn_error $? "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
as_write_fail=0
cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
_ASEOF
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by pen $as_me 0.32.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
_ACEOF
case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_commands="$ac_config_commands"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration. Unless the files
and actions are specified as TAGs, all are instantiated by default.
Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
--config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Configuration commands:
$config_commands
Report bugs to the package provider."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
pen config.status 0.32.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
MKDIR_P='$MKDIR_P'
AWK='$AWK'
test -n "\$AWK" || AWK=awk
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
--config | --confi | --conf | --con | --co | --c )
$as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
'') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
export CONFIG_SHELL
exec "\$@"
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
$as_echo "$ac_log"
} >&5
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp= ac_tmp=
trap 'exit_status=$?
: "${ac_tmp:=$tmp}"
{ test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
eval ac_cr=\$\'\\r\'
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
{
echo "cat >conf$$subs.awk <<_ACEOF" &&
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
s/^/S["/; s/!.*/"]=/
p
g
s/^[^!]*!//
:repl
t repl
s/'"$ac_delim"'$//
t delim
:nl
h
s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
n
b repl
:more1
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t nl
:delim
h
s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
b
:more2
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t delim
' >$CONFIG_STATUS || ac_write_fail=1
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
}
{
line = $ 0
nfields = split(line, field, "@")
substed = 0
len = length(field[1])
for (i = 2; i < nfields; i++) {
key = field[i]
keylen = length(key)
if (S_is_set[key]) {
value = S[key]
line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
len += length(value) + length(field[++i])
substed = 1
} else
len += 1 + keylen
}
print line
}
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
h
s///
s/^/:/
s/[ ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
s/:*$//
x
s/\(=[ ]*\).*/\1/
G
s/\n//
s/^[^=]*=[ ]*$//
}'
fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' >$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
shift
for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input='Generated from '`
$as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
`' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
$as_echo "$as_me: creating $ac_file" >&6;}
fi
# Neutralize special characters interpreted by sed in replacement strings.
case $configure_input in #(
*\&* | *\|* | *\\* )
ac_sed_conf_input=`$as_echo "$configure_input" |
sed 's/[\\\\&|]/\\\\&/g'`;; #(
*) ac_sed_conf_input=$configure_input;;
esac
case $ac_tag in
*:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:F)
#
# CONFIG_FILE
#
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
ac_MKDIR_P=$MKDIR_P
case $MKDIR_P in
[\\/$]* | ?:[\\/]* ) ;;
*/*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
esac
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
ac_sed_dataroot='
/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p'
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
"$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&2;}
rm -f "$ac_tmp/stdin"
case $ac_file in
-) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
*) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
# Compute "$ac_file"'s index in $config_headers.
_am_arg="$ac_file"
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$_am_arg" : 'X\(//\)[^/]' \| \
X"$_am_arg" : 'X\(//\)$' \| \
X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$_am_arg" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`/stamp-h$_am_stamp_count
;;
:C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
$as_echo "$as_me: executing $ac_file commands" >&6;}
;;
esac
case $ac_file$ac_mode in
"depfiles":C) test x"$AMDEP_TRUE" != x"" || {
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
shift
for mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`$as_dirname -- "$mf" ||
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(//\)$' \| \
X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir=$dirpart/$fdir; as_fn_mkdir_p
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
}
;;
esac
done # for ac_tag
as_fn_exit 0
_ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
pen-0.32.0/aclocal.m4 0000644 0001750 0001750 00000121661 12624554542 011157 0000000 0000000 # generated automatically by aclocal 1.14.1 -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.14'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.14.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.14.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ([2.52])dnl
m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
m4_define([_AM_COND_VALUE_$1], [$2])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
[$1], [CXX], [depcc="$CXX" am_compiler_list=],
[$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
[$1], [UPC], [depcc="$UPC" am_compiler_list=],
[$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named 'D' -- because '-MD' means "put the output
# in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
am__universal=false
m4_case([$1], [CC],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac],
[CXX],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac])
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 10 /bin/sh.
echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE([dependency-tracking], [dnl
AS_HELP_STRING(
[--enable-dependency-tracking],
[do not reject slow dependency extractors])
AS_HELP_STRING(
[--disable-dependency-tracking],
[speeds up one-time build])])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
am__nodep='_no'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[{
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
shift
for mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each '.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])
[_AM_PROG_CC_C_O
])
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[AC_DIAGNOSE([obsolete],
[$0: two- and three-arguments forms are deprecated.])
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
[ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
AM_MISSING_PROG([AUTOCONF], [autoconf])
AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
AM_MISSING_PROG([AUTOHEADER], [autoheader])
AM_MISSING_PROG([MAKEINFO], [makeinfo])
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
#
#
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES([CC])],
[m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES([CXX])],
[m4_define([AC_PROG_CXX],
m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES([OBJC])],
[m4_define([AC_PROG_OBJC],
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[_AM_DEPENDENCIES([OBJCXX])],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard:
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: .
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
fi
])
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
*)
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo this is the am__doit target
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it is modern enough.
# If it is, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING "
else
am_missing_run=
AC_MSG_WARN(['missing' script is too old or missing])
fi
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
# _AM_SET_OPTIONS(OPTIONS)
# ------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_CC_C_O
# ---------------
# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
# to automatically call this.
AC_DEFUN([_AM_PROG_CC_C_O],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
AC_LANG_PUSH([C])dnl
AC_CACHE_CHECK(
[whether $CC understands -c and -o together],
[am_cv_prog_cc_c_o],
[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
# Make sure it works both with $CC and with simple cc.
# Following AC_PROG_CC_C_O, we do the test twice because some
# compilers refuse to overwrite an existing .o file with -o,
# though they will create one.
am_cv_prog_cc_c_o=yes
for am_i in 1 2; do
if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
&& test -f conftest2.$ac_objext; then
: OK
else
am_cv_prog_cc_c_o=no
break
fi
done
rm -f core conftest*
unset am_i])
if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_RUN_LOG(COMMAND)
# -------------------
# Run COMMAND, save the exit status in ac_status, and log it.
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
AC_DEFUN([AM_RUN_LOG],
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
(exit $ac_status); }])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
'
case `pwd` in
*[[\\\"\#\$\&\'\`$am_lf]]*)
AC_MSG_ERROR([unsafe absolute working directory name]);;
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac
# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
am_has_slept=no
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
if test "$[2]" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT([yes])
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
AC_CONFIG_COMMANDS_PRE(
[AC_MSG_CHECKING([that generated files are newer than configure])
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
AC_MSG_RESULT([done])])
rm -f conftest.file
])
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SILENT_RULES([DEFAULT])
# --------------------------
# Enable less verbose build rules; with the default set to DEFAULT
# ("yes" being less verbose, "no" or empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
[AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING(
[--enable-silent-rules],
[less verbose build output (undo: "make V=1")])
AS_HELP_STRING(
[--disable-silent-rules],
[verbose build output (undo: "make V=0")])dnl
])
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
esac
dnl
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions.
dnl See automake bug#9928 and bug#10237.
am_make=${MAKE-make}
AC_CACHE_CHECK([whether $am_make supports nested variables],
[am_cv_make_support_nested_variables],
[if AS_ECHO([['TRUE=$(BAR$(V))
BAR0=false
BAR1=true
V=1
am__doit:
@$(TRUE)
.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
am_cv_make_support_nested_variables=yes
else
am_cv_make_support_nested_variables=no
fi])
if test $am_cv_make_support_nested_variables = yes; then
dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor 'install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in "make install-strip", and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using 'strip' when the user
# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the 'STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of 'v7', 'ustar', or 'pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
#
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
m4_if([$1], [v7],
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1],
[ustar],
[# The POSIX 1988 'ustar' format is defined with fixed-size fields.
# There is notably a 21 bits limit for the UID and the GID. In fact,
# the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
# and bug#13588).
am_max_uid=2097151 # 2^21 - 1
am_max_gid=$am_max_uid
# The $UID and $GID variables are not portable, so we need to resort
# to the POSIX-mandated id(1) utility. Errors in the 'id' calls
# below are definitely unexpected, so allow the users to see them
# (that is, avoid stderr redirection).
am_uid=`id -u || echo unknown`
am_gid=`id -g || echo unknown`
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
if test $am_uid -le $am_max_uid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
fi
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
if test $am_gid -le $am_max_gid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
fi],
[pax],
[],
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Go ahead even if we have the value already cached. We do so because we
# need to set the values for the 'am__tar' and 'am__untar' variables.
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
for _am_tool in $_am_tools; do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar; do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works.
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar /dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
pen-0.32.0/pen.1 0000644 0001750 0001750 00000016604 12621052015 010144 0000000 0000000 .TH PEN 1 LOCAL
.SH NAME
pen - Load balancer for udp and tcp based protocols
.SH SYNOPSIS
.B pen
.na
[-b sec] [-c N] [-e host:port] [-t sec] [-x N] [-j dir] [-u user] [-F cfgfile] [-l logfile] [-p file ] [-w file] [-C port|/path/to/socket] [-T sec] [-UHWXadfhrs] [-o option] [-E certfile] [-K keyfile] [-G cacertfile] [-A cacertdir] [-Z] [-R] [-L protocol] [host:]port|/path/to/socket h1[:p1[:maxc1[:hard1[:weight1[:prio1]]]]] [h2[:p2[:maxc2[:hard2[:weight2[:prio2]]]]]] ...
.ad
Windows only:
.B pen
-i service_name
.B pen
-u service_name
.SH EXAMPLE
pen 80 www1:8000:10 www2:80:10 www3
Here three servers cooperate in a web server farm. Host www1 runs its
web server on port 8000 and accepts a maximum of 10 simultaneous connections.
Host www2 runs on port 80 and accepts 10 connections. Finally, www3 runs
its web server on port 80 and allows an unlimited number of simultaneous
connections.
.SH DESCRIPTION
.I Pen
is a load balancer for tcp based protocols such as
http or smtp. It allows several servers to appear as one to the
outside and automatically detects servers that are down and distributes
clients among the available servers. This gives high availability and
scalable performance.
The load balancing algorithm keeps track of clients and will try to
send them back to the server they visited the last time. The client
table has a number of slots (default 2048, settable through command-line
arguments). When the table is full, the least recently used one will
be thrown out to make room for the new one.
This is superior to a simple round-robin algorithm, which sends a client
that connects repeatedly to different servers. Doing so breaks
applications that maintain state between connections in the server,
including most modern web applications.
When pen detects that a server is unavailable, it scans for another
starting with the server after the most recently used one. That way
we get load balancing and "fair" failover for free.
Correctly configured, pen can ensure that a server farm is always
available, even when individual servers are brought down for maintenance
or reconfiguration. The final single point of failure, pen itself,
can be eliminated by running pen on several servers, using vrrp to
decide which is active.
Sending pen a USR1 signal will make it print some useful statistics on stderr,
even if debugging is disabled. If pen is running in the background (i.e.
without the -f option), syslog is used rather than stderr. If the
-w option is used, the statistics is saved in HTML format in the
given file.
Sending pen a HUP signal will make it close and reopen the logfile,
if logging is enabled, and reload the configuration file.
Rotate the log like this (assuming pen.log
is the name of the logfile):
mv pen.log pen.log.1
kill -HUP `cat `
where is the file containing pen's process id, as written by the -p option.
Sending pen a TERM signal will make it exit cleanly, closing the
log file and all open sockets.
.SH OPTIONS
.TP
-C \fIport|/path/to/socket\fR
Specifies a control port where the load balancer listens for commands. See penctl.1 for a list of the commands available. The protocol is unauthenticated and the administrator is expected to restrict access using an access control list (for connections over a network) or Unix file permissions (for a Unix domain socket). Pen will normally refuse to open the control port if running as root; see -u option. If you still insist that you want to run pen as root with a control port, use "-u root".
.TP
-F \fIcfgfile\fR
Names a configuration file with commands in penctl format (see penctl.1). The file is read after processing all command line arguments, and also after receiving a HUP signal.
.TP
-H
Adds X-Forwarded-For header to http requests.
.TP
-U
Use udp protocol support
.TP
-O command
Allows most penctl commands to be used on the Pen command line.
.TP
-P
Use poll() for event notification.
.TP
-Q
Use kqueue() for event notification (BSD).
.TP
-W
Use weight for server selection.
.TP
-X
Adds an exit command to the control interface.
.TP
-a
Used in conjunction with -dd to get communication dumps in ascii
rather than hexadecimal format.
.TP
-b \fIsec\fR
Servers that do not respond are blacklisted, i.e. excluded from the
server selection algorithm, for the specified number of seconds (default 30).
.TP
-T \fIsec\fR
Clients are tracked for the specified number of seconds so they can be sent to the same server as the last time (default 0 = never expire clients).
.TP
-c \fIN\fR
Max number of clients (default 2048).
.TP
-d
Debugging (repeat -d for more). The output goes to stderr if we are running
in the foreground (see -f) and to syslog (facility user, priority
debug) otherwise.
.TP
-e \fIhost:port\fR
host:port specifies the emergency server to contact if all regular
servers become unavailable.
.TP
-f
Stay in foreground.
.TP
-h
Use a hash on the client IP address for the initial server selection.
This makes it more predictable where clients will be connected.
.TP
-i \fIservice_name\fR
Windows only. Install pen as a service.
.TP
-j \fIdir\fR
Run in a chroot environment.
.TP
-l \fIfile\fR
Turn on logging.
.TP
-m \fImulti_accept\fR
Accept up to \fImulti_accept\fR incoming connections at a time.
.TP
-p \fIfile\fR
Write the pid of the running daemon to \fIfile\fR.
.TP
-q \fIbacklog\fR
Allow the queue of pending incoming connections to grow up to a maximum of \fIbacklog\fR entries.
.TP
-r
Go straight into round-robin server selection without looking up
which server a client used the last time.
.TP
-s
Stubborn server selection: if the initial choice is unavailable, the
client connection is closed without trying another server.
.TP
-t \fIsec\fR
Connect timeout in seconds (default 5).
.TP
-u \fIuser\fR
Posix only. Run as a different user.
.TP
-u \fIservice_name\fR
Windows only. Uninstall the service.
.TP
-x \fIN\fR
Max number of simultaneous connections (default 500).
.TP
-w \fIfile\fR
File for status reports in HTML format.
.TP
-o \fIoption\fR
Use option in penctl format.
.TP
-E \fIcertfile\fR
Use the given certificate in PEM format.
.TP
-K \fIkeyfile\fR
Use the given key in PEM format (may be contained in cert).
.TP
-G \fIcacertfile\fR
File containing the CA's certificate.
.TP
-A \fIcacertdir\fR
Directory containing CA certificates in hashed format.
.TP
-Z
Use SSL compatibility mode.
.TP
-R
Require valid peer certificate.
.TP
-L \fIprotocol\fR
ssl23 (default), ssl3 or tls1.
.TP
[host:]port OR /path/to/socket
The local address and port pen listens to. By default pen listens to
all local addresses. Pen can also use a Unix domain socket as the local
listening address.
.TP
h1:p1:soft:hard:weight:prio
The address, port and maximum number of simultaneous connections for
a remote server. By default, the port is the same as the local port,
and the soft limit on the number of connections is unlimited. The hard
limit is used for clients which have accessed the server before.
The weight and prio are used for the weight- and priority-based
server selection algorithms.
.SH LIMITATIONS
Pen runs in a single process, and opens two sockets for each connection.
Depending on kernel configuration, pen can run out of file descriptors.
SSL support is available if pen was built with the --with-ssl option.
GeoIP support is available if pen was built with the --with-geoip option.
.SH SEE ALSO
penctl(1), dwatch(1), mergelogs(1), webresolve(1)
.SH AUTHOR
Copyright (C) 2001-2015 Ulric Eriksson, .
.SH ACKNOWLEDGEMENTS
In part inspired by balance by Thomas Obermair.
pen-0.32.0/AUTHORS 0000644 0001750 0001750 00000000114 12507562420 010346 0000000 0000000 Ulric Eriksson
UDP support contributed by the Zen project.
pen-0.32.0/dlist.h 0000644 0001750 0001750 00000000302 12507562420 010565 0000000 0000000 /* dlist.c */
extern int dlist_insert(int, int);
extern int dlist_remove(int);
extern void dlist_free(int);
extern int dlist_next(int);
extern int dlist_value(int);
extern void dlist_init(int);
pen-0.32.0/Makefile.win 0000644 0001750 0001750 00000001270 12526327460 011542 0000000 0000000 CFLAGS=-Wall -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ggdb -DWINDOWS -D_WIN32_WINNT=0x0600 -DDEBUGGING
OBJ=pen.o select.o poll.o kqueue.o epoll.o dlist.o ssl.o dsr.o memory.o diag.o settings.o acl.o event.o netconv.o server.o client.o conn.o idlers.o windows.o
LIB=-lws2_32 -lpsapi -lole32 -loleaut32 -luuid
all:
cp config.h.win config.h
$(MAKE) -C X86 pen32.exe
$(MAKE) -C X64 pen64.exe
pen32.exe: $(OBJ)
$(CC) -o pen32.exe $(OBJ) $(LIB)
pen64.exe: $(OBJ)
$(CC) -o pen64.exe $(OBJ) $(LIB)
pen.o: pen.c
select.o: select.c
poll.o: poll.c
kqueue.o: kqueue.c
epoll.o: epoll.c
windows.o: windows.c
dlist.o: dlist.c
$(OBJ): pen.h config.h
clean:
rm -f X86/*.o X64/*.o
pen-0.32.0/diag.h 0000644 0001750 0001750 00000001140 12516364761 010363 0000000 0000000 #include
#ifdef DEBUGGING
#define DEBUG(lvl, ...) \
if (debuglevel >= lvl) { \
debug(__VA_ARGS__); \
}
#define DEBUG_ERRNO(lvl, ...) \
if (debuglevel >= lvl) { \
err = socket_errno; \
debug(__VA_ARGS__); \
}
#define SPAM \
if (debuglevel >= 2) \
debug("File %s, line %d, function %s", \
__FILE__, __LINE__, __func__);
#else
#define DEBUG(lvl, ...)
#define DEBUG_ERRNO(lvl, ...)
#define SPAM
#endif
#ifdef WINDOWS
#define socket_errno WSAGetLastError()
#else
#define socket_errno errno
#endif
extern int debuglevel;
extern void debug(char *, ...);
extern void error(char *, ...);
pen-0.32.0/pen_epoll.h 0000644 0001750 0001750 00000000036 12514666022 011430 0000000 0000000 extern void epoll_init(void);
pen-0.32.0/memory.c 0000644 0001750 0001750 00000001100 12514661127 010750 0000000 0000000 #include
#include
#include "diag.h"
void *pen_malloc(size_t n)
{
void *q = malloc(n);
if (!q) error("Can't malloc %ld bytes", (long)n);
return q;
}
void *pen_calloc(size_t n, size_t s)
{
void *q = calloc(n, s);
if (!q) error("Can't calloc %ld bytes", (long)n*s);
return q;
}
void *pen_realloc(void *p, size_t n)
{
void *q = realloc(p, n);
if (!q) error("Can't realloc %ld bytes", (long)n);
return q;
}
char *pen_strdup(const char *p)
{
size_t len = strlen(p);
char *b = pen_malloc(len+1);
memcpy(b, p, len);
b[len] = '\0';
return b;
}
pen-0.32.0/windows.h 0000644 0001750 0001750 00000002740 12526327460 011154 0000000 0000000 #ifdef WINDOWS
#include
#include
#define SHUT_WR SD_SEND /* for shutdown */
#define LOG_CONS 0
#define LOG_USER 0
#define LOG_ERR 0
#define LOG_DEBUG 0
#define CONNECT_IN_PROGRESS (WSAEWOULDBLOCK)
#define WOULD_BLOCK(err) (err == WSAEWOULDBLOCK)
#define SIGHUP 0
#define SIGUSR1 0
#define SIGPIPE 0
#define SIGCHLD 0
#ifndef ENOTCONN
#define ENOTCONN WSAENOTCONN
#endif
typedef int sigset_t;
typedef int siginfo_t;
struct sigaction {
void (*sa_handler)(int);
void (*sa_sigaction)(int, siginfo_t *, void *);
sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)(void);
};
typedef int rlim_t;
struct rlimit {
rlim_t rlim_cur;
rlim_t rlim_max;
};
#define RLIMIT_CORE 0
typedef int uid_t;
typedef int gid_t;
struct passwd {
uid_t pw_uid;
gid_t pw_gid;
};
extern int delete_service(char *);
extern int install_service(char *);
extern int service_main(int, char **);
/* misc kludges */
extern int sigaction(int, const struct sigaction *, struct sigaction *);
extern uid_t getuid(void);
extern int inet_aton(const char *, struct in_addr *addr);
#if 0
extern const char *inet_ntop(int, const void *, char *, socklen_t);
#endif
extern void make_nonblocking(int);
extern int start_winsock(void);
#if 0
/* stuff that exists in Windows that MinGW doesn't know about */
const char *inet_ntop(int af, const void *src,
char *dst, socklen_t size);
int inet_pton(int af, const char *src, void *dst);
#endif
#endif /* WINDOWS */
pen-0.32.0/penlog.1 0000644 0001750 0001750 00000001367 12527416571 010666 0000000 0000000 .TH PENLOG 1 LOCAL
.SH NAME
penlog - pipe Apache logs to penlogd
.SH SYNOPSIS
.B penlog
server_ip server_port [my_ip]
.SH EXAMPLE
penlog lbhost:10000
.SH DESCRIPTION
.I Penlog
reads webserver log entries from stdin and sends them using UDP to
penlogd. It is intended for Apache's "reliable piped logs".
To use penlog from Apache, add a command
like this to the web server's httpd.conf:
CustomLog "|/usr/local/bin/penlog somehost 10000" common
The optional third argument is used if the server has several addresses.
Penlogd uses the source address to identify the server, and it must be
identical to the address configured in the command line to Pen.
.SH SEE ALSO
pen(1), penlogd(1)
.SH AUTHOR
Copyright (C) 2002-2015 Ulric Eriksson, .
pen-0.32.0/INSTALL 0000644 0001750 0001750 00000026422 12521654064 010343 0000000 0000000
Installing Pen
==============
Option 1. Installing from a source tarball
To compile and install using all defaults, type:
./configure
make
make install
See also https://github.com/UlricE/pen/wiki/Building-Pen-from-Source
Option 2. Installing from Git
./bootstrap.sh
./configure
make
make install
See also https://github.com/UlricE/pen/wiki/Building-Pen-from-Git
Options
-------
TL;DR: ./configure without options is usually sufficient to figure out
what is available and use the best combination.
Most of the "generic" options are verbosely described below. Options
that are specific to Pen include:
--enable-profiling enable profiling
Enable profiling with gprof. Most people have no interest in this.
Disabled by default.
--enable-debugging enable debugging messages
With this enabled, more detailed diagnostics are built into Pen.
Most people should have an interest in this, should something
go wrong. Enabled by default.
--with-geoip use libgeoip
Build Pen with support for the GeoIP library. This provides access
control lists that use country codes to permit or deny access.
Built by default if available.
--with-ssl=DIR use SSL (default /usr/local/ssl)
Build Pen with SSL support. Built by default if available.
--with-daemon use daemon() if available
The --with-daemon option specifies how Pen puts itself in the background.
Some operating systems have a function called daemon() which does this;
with this option, the function will be used. Built by default if available.
--with-poll use poll() if available
Normally Pen uses the best available function to get notification
when a socket is ready for reading or writing. On *BSD that is kqueue;
on Linux it is epoll; on other Unix it is poll; on Windows it is select.
This option enables using the poll() function.
Built by default if available.
--with-kqueue use kqueue() if available
The kqueue interface for event notification is available on *bsd
and offers better performance than either select() or poll().
Used by default if available.
--with-epoll use epoll if available
The epoll interface serves the same purpose on Linux as kqueue on BSD
and is used by default if available.
--with-fd_setsize=N set FD_SETSIZE to N
(This is only relevant if you use select() as the event notification
mechanism. You will probably use something else, except on Windows
where only select() is available. If not on Windows, consider this
section irrelevant.)
To use Pen with a very large number of simultaneous connections, the
preprocessing macro FD_SETSIZE must be increased. The default value varies
between operating systems, as does the maximum supported. Pen will try to
catch attempts to run out of spec.
The select() used by Linux is broken in this respect, and doesn't
allow FD_SETSIZE to be changed from the default. The solution is
to not use Linux, or to change the #defines in the relevant include
files: and . Look for lines
like this:
#define __FD_SETSIZE 1024
and change them to what you really want, such as:
#define __FD_SETSIZE 16384
You probably want to change them back afterwards.
The resulting max number of simultaneous connections will be:
(FD_SETSIZE-10)/2
10 is for stdin, stdout, stderr "and then some".
2 is because each connection uses two file descriptors.
The default FD_SETSIZE on Windows is very low, only 64. Fortunately,
this value isn't cast in stone like it is on Linux. Just do:
./configure --with-fd_setsize=1024
This will allow 507 simultaneous connections.
---------------------------------------------------------------------
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
pen-0.32.0/X86/ 0000755 0001750 0001750 00000000000 12624555212 007750 5 0000000 0000000 pen-0.32.0/X86/Makefile 0000644 0001750 0001750 00000000077 12507562420 011333 0000000 0000000
VPATH=..
CC=i686-w64-mingw32-gcc -m32
include ../Makefile.win
pen-0.32.0/dlist.c 0000644 0001750 0001750 00000004573 12570064223 010574 0000000 0000000 #include
#include "memory.h"
/* circular doubly linked lists, used for pending and closing connections */
struct node {
int value; /* index into connection table */
int prev; /* back pointer */
int next; /* forward pointer */
};
static struct node *nodes;
static int nodes_max;
/* This finishes in almost-constant time if there are plenty of free nodes */
static int alloc_node(void)
{
static int last_node = 0;
int start = last_node;
do {
if (nodes[last_node].value == -1) return last_node;
last_node = (last_node+1)%nodes_max;
} while (last_node != start);
return -1; /* all nodes used */
}
/* Insert value into a new node. Return the resulting list. */
int dlist_insert(int list, int value)
{
int new_node = alloc_node();
if (new_node == -1) return -1;
if (list == -1) { /* empty */
nodes[new_node].prev = new_node;
nodes[new_node].next = new_node;
} else {
int prev = nodes[list].prev;
nodes[prev].next = new_node;
nodes[new_node].prev = prev;
nodes[new_node].next = list;
nodes[list].prev = new_node;
}
nodes[new_node].value = value;
return new_node;
}
/* Remove a node from its list. Return the resulting list. */
int dlist_remove(int node)
{
int prev, next;
if (node == -1) return -1;
nodes[node].value = -1; /* mark as unused */
if (nodes[node].next == node) { /* last node */
return -1; /* empty list */
}
prev = nodes[node].prev;
next = nodes[node].next;
nodes[prev].next = next;
nodes[next].prev = prev;
return next;
}
/* Free an entire list by marking all nodes as unused. */
void dlist_free(int list)
{
int start = list;
if (list == -1) return;
do {
nodes[list].value = -1;
list = (list+1)%nodes_max;
} while (list != start);
}
/* Return next node in the list. Valid even for freed nodes. */
int dlist_next(int node)
{
return nodes[node].next;
}
int dlist_value(int node)
{
return nodes[node].value;
}
/* Allocate enough nodes for all the doubly linked lists we'll ever need. */
void dlist_init(int size)
{
int i;
nodes_max = size;
nodes = pen_malloc(nodes_max * sizeof *nodes);
for (i = 0; i < size; i++) {
nodes[i].value = -1; /* unused */
}
}
pen-0.32.0/pen.c 0000644 0001750 0001750 00000200226 12622545152 010233 0000000 0000000 /*
Copyright (C) 2000-2015 Ulric Eriksson
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#include "config.h"
#include
#include
#include
#include
#include
#include
#ifndef WINDOWS
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#endif
#include
#include
#include
#include
#include
#ifdef TIME_WITH_SYS_TIME
#include
#endif
#include
#include
#include
#include
#include "ssl.h"
#include "pen.h"
#include "acl.h"
#include "client.h"
#include "conn.h"
#include "diag.h"
#include "dlist.h"
#include "dsr.h"
#include "event.h"
#include "idlers.h"
#include "memory.h"
#include "netconv.h"
#include "pen_epoll.h"
#include "pen_kqueue.h"
#include "pen_poll.h"
#include "pen_select.h"
#include "server.h"
#include "settings.h"
#include "windows.h"
#define BUFFER_MAX (32*1024)
#define KEEP_MAX 100 /* how much to keep from the URI */
#define DUMMY_MSG "Ulric was here."
static int dummy = 0; /* use pen as a test target */
time_t now;
static int tcp_nodelay = 0;
static int listen_queue = CONNECTIONS_MAX;
static int asciidump;
static int loopflag;
static int exit_enabled = 0;
static int hupcounter = 0;
#ifndef WINDOWS
static int stats_flag = 0;
static int restart_log_flag = 0;
#endif
static int http = 0;
static char *cfgfile = NULL;
static char *logfile = NULL;
static FILE *logfp = NULL;
static struct sockaddr_in logserver;
static int logsock = -1;
static char *pidfile = NULL;
static FILE *pidfp = NULL;
static char *webfile = NULL;
static char listenport[1000];
static int port;
static int control_acl;
static char *ctrlport = NULL;
int listenfd;
static int ctrlfd = -1;
static char *jail = NULL;
static char *user = NULL;
static char *proto = "tcp";
static char *dsr_if, *dsr_ip;
#ifdef WINDOWS
/* because Windows scribbles over errno in an uncalled-for manner */
static int saved_errno;
#define SAVE_ERRNO (saved_errno = socket_errno)
#define USE_ERRNO (saved_errno)
#else /* not windows */
#define WOULD_BLOCK(err) (err == EAGAIN || err == EWOULDBLOCK)
#ifndef HAVE_ACCEPT4
static void make_nonblocking(int fd)
{
int fl;
DEBUG(2, "make_nonblocking(%d)", fd);
if ((fl = fcntl(fd, F_GETFL, 0)) == -1)
error("Can't fcntl, errno = %d", errno);
if (fl & O_NONBLOCK) {
DEBUG(3, "fd %d is already nonblocking", fd);
} else {
DEBUG(4, "fd %d is not nonblocking", fd);
if (fcntl(fd, F_SETFL, fl | O_NONBLOCK) == -1) {
error("Can't fcntl, errno = %d", errno);
}
}
}
#endif
#define SAVE_ERRNO
#define USE_ERRNO (socket_errno)
#endif
/* enable/disable with "tcp_nodelay/no tcp_nodelay" */
static void tcp_nodelay_on(int s)
{
#ifdef TCP_NODELAY
int one = 1;
int n = setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *)&one, sizeof one);
DEBUG(2, "setsockopt(%d, %d, %d, %p, %d) returns %d",
s, IPPROTO_TCP, TCP_NODELAY, &one, sizeof one, n);
#else
debug("You don't have TCP_NODELAY");
#endif
}
/* save a few syscalls for modern Linux and BSD */
int socket_nb(int domain, int type, int protocol)
{
#ifdef SOCK_NONBLOCK
int s = socket(domain, type|SOCK_NONBLOCK, protocol);
SAVE_ERRNO;
DEBUG(2, "socket returns %d, socket_errno=%d", s, USE_ERRNO);
if (s == -1) error("Error opening socket: %s", strerror(USE_ERRNO));
#else
int s = socket(domain, type, protocol);
SAVE_ERRNO;
DEBUG(2, "socket returns %d, socket_errno=%d", s, USE_ERRNO);
if (s == -1) error("Error opening socket: %s", strerror(USE_ERRNO));
make_nonblocking(s);
#endif
if (tcp_nodelay) tcp_nodelay_on(s);
return s;
}
/* and a few more */
extern int accept4(int, struct sockaddr *, socklen_t *, int);
static int accept_nb(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
{
#ifdef HAVE_ACCEPT4
return accept4(sockfd, addr, addrlen, SOCK_NONBLOCK);
#else
int s = accept(sockfd, addr, addrlen);
if (s != -1) make_nonblocking(sockfd);
return s;
#endif
if (tcp_nodelay) tcp_nodelay_on(sockfd);
}
#ifndef WINDOWS
static struct sigaction alrmaction, hupaction, termaction, usr1action, usr2action;
#endif
static int pen_strncasecmp(const char *p, const char *q, size_t n)
{
size_t i = 0;
int c = 0;
while ((i < n) && !(c = toupper((unsigned char)*p)-toupper((unsigned char)*q)) && *p) {
p++;
q++;
i++;
}
return c;
}
static char *pen_strcasestr(const char *haystack, const char *needle)
{
char *p = (char *)haystack;
int n = strlen(needle);
while (*p) {
if (!pen_strncasecmp(p, needle, n)) return p;
p++;
}
return NULL;
}
static int webstats(void)
{
FILE *fp;
int i;
time_t now;
struct tm *nowtm;
char nowstr[80];
if (webfile == NULL) {
debug("Don't know where to write web stats; see -w option");
return 0;
}
fp = fopen(webfile, "w");
if (fp == NULL) {
debug("Can't write to %s", webfile);
return 0;
}
now=time(NULL);
nowtm = localtime(&now);
strftime(nowstr, sizeof(nowstr), "%Y-%m-%d %H:%M:%S", nowtm);
fprintf(fp,
"\n"
"\n"
"