#!/bin/sh
#
# Do not edit!
# This file was generated from configure.in by BSDBuild 3.2.
#
# To regenerate this file, get the latest BSDBuild release from
# http://hypertriton.com/bsdbuild/, and use the command:
#
# $ cat configure.in | mkconfigure > configure
#
# Copyright (c) 2001-2012 Hypertriton, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
PACKAGE="Untitled"
VERSION=""
RELEASE=""
optarg=
for arg
do
case "$arg" in
-*=*)
optarg=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'`
;;
*)
optarg=
;;
esac
case "$arg" in
--build=*)
build_arg=$optarg
;;
--host=*)
host_arg=$optarg
;;
--target=*)
target=$optarg
;;
--emul-os=*)
PROJ_TARGET=$optarg
;;
--byte-order=*)
byte_order=$optarg
;;
--prefix=*)
prefix=$optarg
;;
--exec-prefix=*)
exec_prefix=$optarg
;;
--sysconfdir=*)
sysconfdir=$optarg
;;
--bindir=*)
bindir=$optarg
;;
--libdir=*)
libdir=$optarg
;;
--moduledir=*)
moduledir=$optarg
;;
--libexecdir=*)
libexecdir=$optarg
;;
--datadir=*)
datadir=$optarg
;;
--statedir=* | --localstatedir=*)
statedir=$optarg
;;
--localedir=*)
localedir=$optarg
;;
--mandir=*)
mandir=$optarg
;;
--infodir=* | --datarootdir=* | --docdir=* | --htmldir=* | --dvidir=* | --pdfdir=* | --psdir=* | --sharedstatedir=* | --sbindir=*)
;;
--enable-*)
option=`echo $arg | sed -e 's/--enable-//' -e 's/=.*//'`
option=`echo $option | sed 's/-/_/g'`
case "$arg" in
*=*)
eval "enable_${option}='$optarg'"
eval "prefix_${option}='$optarg'"
;;
*)
eval "enable_${option}=yes"
;;
esac
;;
--disable-*)
option=`echo $arg | sed -e 's/--disable-//'`;
option=`echo $option | sed 's/-/_/g'`
eval "enable_${option}=no"
;;
--with-*)
option=`echo $arg | sed -e 's/--with-//' -e 's/=.*//'`
option=`echo $option | sed 's/-/_/g'`
case "$arg" in
*=*)
eval "with_${option}='$optarg'"
eval "prefix_${option}='$optarg'"
;;
*)
eval "with_${option}=yes"
;;
esac
;;
--without-*)
option=`echo $arg | sed -e 's/--without-//'`;
option=`echo $option | sed 's/-/_/g'`
eval "with_${option}=no"
;;
--help)
show_help=yes
;;
--version)
show_version=yes
;;
--srcdir=*)
srcdir=$optarg
;;
--testdir=*)
testdir=$optarg
;;
--cache=*)
cache=$optarg
;;
--includes=*)
includes=$optarg
;;
--cache-file=*)
;;
--config-cache | -C)
;;
*)
echo "invalid argument: $arg"
echo "try ./configure --help"
exit 1
;;
esac
done
if [ -e "/bin/echo" ]; then
/bin/echo -n ""
if [ $? = 0 ]; then
ECHO_N="/bin/echo -n"
else
ECHO_N="echo -n"
fi
else
ECHO_N="echo -n"
fi
PERL=""
for path in `echo $PATH | sed 's/:/ /g'`; do
if [ -x "${path}/perl" ]; then
PERL="${path}/perl"
break
fi
done
PKGCONFIG=""
for path in `echo $PATH | sed 's/:/ /g'`; do
if [ -x "${path}/pkg-config" ]; then
PKGCONFIG="${path}/pkg-config"
break
fi
done
if [ "${prefix}" != "" ]; then
PREFIX="$prefix"
else
PREFIX="/usr/local"
fi
if [ "${exec_prefix}" != "" ]; then
EXEC_PREFIX="$exec_prefix"
else
EXEC_PREFIX="${PREFIX}"
fi
if [ "${srcdir}" != "" ]; then
if [ "${PERL}" = "" ]; then
echo "*"
echo "* Separate build (--srcdir) requires perl, but there is"
echo "* no perl interpreter to be found in your PATH."
echo "*"
exit 1
fi
SRC=${srcdir}
else
SRC=`pwd`
fi
BLD=`pwd`
SRCDIR="${SRC}"
BLDDIR="${BLD}"
if [ "${testdir}" != "" ]; then
echo "Configure tests will be executed in ${testdir}"
if [ ! -e "${testdir}" ]; then
echo "Creating ${testdir}"
mkdir ${testdir}
fi
else
testdir="."
fi
if [ "${includes}" = "" ]; then
includes="yes"
fi
case "${includes}" in
yes|no)
;;
link)
if [ "${with_proj_generation}" ]; then
echo "Cannot use --includes=link with --with-proj-generation!"
exit 1
fi
;;
*)
echo "Usage: --includes [yes|no|link]"
exit 1
;;
esac
if [ "${srcdir}" = "" ]; then
cat << EOT > configure.dep.pl
#!/usr/bin/perl
# Public domain.
# Scan Makefiles for "include .depend" and generate empty ".depend" files,
# such that make can be run prior to an initial "make depend".
#
my %V = ();
sub MakefileIncludesDepend (\$\$)
{
my \$path = shift;
my \$cwd = shift;
if (!open(MF, \$path)) {
return (0);
}
my @lines = ();
foreach \$_ () {
chop;
if (/^(.+)\\\\\$/) { # Expansion
\$line .= \$1;
} else { # New line
if (\$line) {
push @lines, \$line . \$_;
\$line = '';
} else {
push @lines, \$_;
}
}
}
foreach \$_ (@lines) {
if (/^\\s*#/) { next; }
if (/^\\t/) { next; }
s/\\\$\\{(\\w+)\\}/\$V{\$1}/g;
if (/^\\s*(\\w+)\\s*=\\s*"(.+)"\$/ ||
/^\\s*(\\w+)\\s*=\\s*(.+)\$/) {
\$V{\$1} = \$2;
} elsif (/^\\s*(\\w+)\\s*\\+=\\s*"(.+)"\$/ ||
/^\\s*(\\w+)\\s*\\+=\\s*(.+)\$/) {
if (exists(\$V{\$1}) && \$V{\$1} ne '') {
\$V{\$1} .= ' '.\$2;
} else {
\$V{\$1} = \$2;
}
}
if (/^\\s*include\\s+(.+)\$/) {
if (\$1 eq '.depend' ||
MakefileIncludesDepend(\$cwd.'/'.\$1, \$cwd)) {
return (1);
}
}
}
close(MF);
return (0);
}
sub Scan (\$)
{
my \$dir = shift;
unless (opendir(CWD, \$dir)) {
print STDERR "\$dir: opendir: \$!; ignoring\\n";
return;
}
%V = ();
if (-e \$dir.'/Makefile' &&
MakefileIncludesDepend("\$dir/Makefile", \$dir)) {
if (open(OUT, ">\$dir/.depend")) {
close(OUT);
} else {
print STDERR "\$dir/.depend: \$!; ignoring\\n";
}
}
foreach my \$ent (readdir(CWD)) {
my \$file = \$dir.'/'.\$ent;
if (\$ent =~ /^\\./) {
next;
}
if (-d \$file) {
Scan(\$file);
next;
}
}
closedir(CWD);
}
if (@ARGV < 1) {
print STDERR "Usage: gen-dotdepend.pl [directory]\\n";
exit(1);
}
Scan(\$ARGV[0]);
EOT
if [ "${PERL}" != "" ]; then
${PERL} configure.dep.pl .
rm -f configure.dep.pl
else
echo "*"
echo "* Warning: No perl was found. Perl is required for automatic"
echo "* generation of .depend files. You may need to create empty"
echo "* .depend files where it is required."
echo "*"
fi
fi
if [ "${show_help}" = "yes" ]; then
echo "This configure script was generated by BSDBuild 3.2."
echo ""
echo ""
echo "Usage: ./configure [options]"
echo ""
echo "Standard build options:"
echo " --bindir=DIR Executables for common users [PREFIX/bin]"
echo " --build=STRING Host environment for build [auto-detect]"
echo " --byte-order=STRING Byte order for build (LE|BE) [auto-detect]"
echo " --cache=DIR Cache ./configure results in directory [none]"
echo " --datadir=DIR|NONE Data files for program use [PREFIX/share]"
echo " --enable-nls Multi-language support [no]"
echo " --exec-prefix=DIR Machine-dependent installation base [PREFIX]"
echo " --host=STRING Cross-compile for target environment [BUILD]"
echo " --includes=STRING Preprocess C headers (yes|no|link) [yes]"
echo " --libdir=DIR System libraries [PREFIX/lib]"
echo " --libexecdir=DIR Executables for program use [PREFIX/libexec]"
echo " --localedir=DIR Multi-language support locales [DATADIR/locale]"
echo " --mandir=DIR Manual page documentation [PREFIX/man]"
echo " --moduledir=DIR|NONE Dynamically loaded modules [PREFIX/lib]"
echo " --prefix=DIR Installation base [/usr/local]"
echo " --srcdir=DIR Source directory for concurrent build [.]"
echo " --statedir=DIR|NONE Modifiable single-machine data [PREFIX/var]"
echo " --sysconfdir=DIR|NONE System configuration files [PREFIX/etc]"
echo " --testdir=DIR Execute all tests in this directory [.]"
echo " --with-catman Install cat files for manual pages [auto-detect]"
echo " --with-ctags Generate ctags(1) tag files [no]"
echo " --with-docs Generate printable documentation [no]"
echo " --with-gettext Use gettext for multi-language [auto-detect]"
echo " --with-libtool Specify path to libtool [bundled]"
echo " --with-manlinks Add manual entries for every function [no]"
echo " --with-manpages Generate Unix manual pages [yes]"
echo ""
echo "Options specific to PerCGI:"
echo " --enable-warnings Suggested compiler warnings [default: no]"
echo " --with-fastcgi FastCGI support [default: check]"
echo " --with-charsets[=LIST] Character sets [default: utf-8 and iso-8859-1]"
exit 1
fi;
if [ "${show_version}" = "yes" ]; then
echo "BSDBuild 3.2"
exit 0
fi;
if [ "${srcdir}" != "" ]; then
build_guessed=`sh ${srcdir}/mk/config.guess`
else
build_guessed=`sh mk/config.guess`
fi
if [ $? != 0 ]; then
echo "mk/config.guess failed"
exit 1
fi
if [ "${build_arg}" != "" ]; then
build="${build_arg}"
else
build="${build_guessed}"
fi
if [ "${host_arg}" != "" ]; then
host="${host_arg}"
else
host="${build}"
fi
if [ "${host}" != "${build_guessed}" ]; then
CROSS_COMPILING="yes"
else
CROSS_COMPILING="no"
fi
echo "BSDBuild 3.2 (http://bsdbuild.hypertriton.com)"
echo "#!/bin/sh" > config.status
echo "# Generated by configure script (BSDBuild 3.2)." >> config.status
echo "Generated by configure script (BSDBuild 3.2)." > config.log
if [ -e "Makefile.config" ]; then
echo "* Overwriting existing Makefile.config"
fi
echo "# Generated by configure script (BSDBuild 3.2)." > Makefile.config
echo "" >> Makefile.config
echo "BUILD=${build}" >> Makefile.config
echo "HOST=${host}" >> Makefile.config
echo "CROSS_COMPILING=${CROSS_COMPILING}" >> Makefile.config
echo "SRCDIR=${SRC}" >> Makefile.config
echo "BLDDIR=${BLD}" >> Makefile.config
$ECHO_N "./configure" >> config.log
$ECHO_N "./configure" >> config.status
for arg
do
$ECHO_N " $arg" >> config.log
$ECHO_N " $arg" >> config.status
done
echo "" >> config.log
echo "" >> config.status
if [ -e "$BLD/include/percgi/config" ]; then
echo "* Overwriting $BLD/include/percgi/config directory"
rm -fR "$BLD/include/percgi/config"
fi
mkdir -p "$BLD/include/percgi/config"
if [ $? != 0 ]; then
echo "Could not create $BLD/include/percgi/config directory."
exit 1
fi
cat << EOT > conftest.1
.\" COMMENT
.Dd
.Dd NOVEMBER 23, 2009
.Dt TEST 1
.Os
.ds vT Test
.ds oS Test 1.0
.Sh NAME
.Nm test
.Nd Test document
.Sh DESCRIPTION
EOT
HAVE_MANDOC="no"
MANDOC=""
for path in `echo $PATH | sed 's/:/ /g'`; do
if [ -x "${path}/mandoc" ]; then
cat conftest.1 | ${path}/mandoc -Tascii >/dev/null
if [ "$?" = "0" ]; then
HAVE_MANDOC="yes"
MANDOC="${path}/mandoc"
break;
fi
elif [ -x "${path}/nroff" ]; then
cat conftest.1 | ${path}/nroff -Tmandoc >/dev/null
if [ "$?" = "0" ]; then
HAVE_MANDOC="yes"
MANDOC="${path}/nroff -Tmandoc"
break;
fi
fi
done
rm -f conftest.1
if [ "${HAVE_MANDOC}" = "no" ]; then
if [ "${with_manpages}" = "yes" ]; then
echo "*"
echo "* --with-manpages was requested, but either the"
echo "* nroff(1)/mandoc(1) utility or the mdoc(7) macro"
echo "* package were not found."
echo "*"
exit 1
fi
echo "HAVE_MANDOC=no" >> Makefile.config
echo "NOMAN=yes" >> Makefile.config
echo "NOMANLINKS=yes" >> Makefile.config
else
echo "HAVE_MANDOC=yes" >> Makefile.config
echo "MANDOC=${MANDOC}" >> Makefile.config
if [ "${with_catman}" = "no" ]; then
echo "NOCATMAN=yes" >> Makefile.config
else
if [ "${with_catman}" = "yes" ]; then
echo "NOCATMAN=no" >> Makefile.config
else
case "${host}" in
*-*-freebsd*)
echo "NOCATMAN=yes" >> Makefile.config
;;
*)
echo "NOCATMAN=no" >> Makefile.config
;;
esac
fi
fi
if [ "${with_manpages}" = "no" ]; then
echo "NOMAN=yes" >> Makefile.config
echo "NOMANLINKS=yes" >> Makefile.config
else
if [ "${with_manlinks}" != "yes" ]; then
echo "NOMANLINKS=yes" >> Makefile.config
fi
fi
fi
if [ "${with_docs}" = "no" ]; then
echo "NODOC=yes" >> Makefile.config
fi
if [ "${enable_nls}" = "yes" ]; then
ENABLE_NLS="yes"
echo "#ifndef ENABLE_NLS" > $BLD/include/percgi/config/enable_nls.h
echo "#define ENABLE_NLS \"$ENABLE_NLS\"" >> $BLD/include/percgi/config/enable_nls.h
echo "#endif" >> $BLD/include/percgi/config/enable_nls.h
echo "hdefs[\"ENABLE_NLS\"] = \"$ENABLE_NLS\"" >>configure.lua
msgfmt=""
for path in `echo $PATH | sed 's/:/ /g'`; do
if [ -x "${path}/msgfmt" ]; then
msgfmt=${path}/msgfmt
break
fi
done
if [ "${msgfmt}" != "" ]; then
HAVE_GETTEXT="yes"
else
HAVE_GETTEXT="no"
fi
echo "#ifndef ENABLE_NLS" > $BLD/include/percgi/config/enable_nls.h
echo "#define ENABLE_NLS \"$ENABLE_NLS\"" >> $BLD/include/percgi/config/enable_nls.h
echo "#endif" >> $BLD/include/percgi/config/enable_nls.h
echo "hdefs[\"ENABLE_NLS\"] = \"$ENABLE_NLS\"" >>configure.lua
else
ENABLE_NLS="no"
HAVE_GETTEXT="no"
echo "#undef ENABLE_NLS" >$BLD/include/percgi/config/enable_nls.h
echo "hdefs[\"ENABLE_NLS\"] = nil" >>configure.lua
fi;
CTAGS=""
if [ "${with_ctags}" = "yes" ]; then
for path in `echo $PATH | sed 's/:/ /g'`; do
if [ -x "${path}/ectags" ]; then
CTAGS="${path}/ectags"
break
fi
done
if [ "${CTAGS}" = "" ]; then
for path in `echo $PATH | sed 's/:/ /g'`; do
if [ -x "${path}/ctags" ]; then
CTAGS="${path}/ctags"
break
fi
done
fi
fi
echo "CTAGS=${CTAGS}" >> Makefile.config
if [ "${prefix_libtool}" != "" -a "${prefix_libtool}" != "bundled" ]; then
LIBTOOL_BUNDLED="no"
LIBTOOL="${prefix_libtool}"
else
LIBTOOL_BUNDLED="yes"
LIBTOOL=\${TOP}/mk/libtool/libtool
fi
echo "LIBTOOL_BUNDLED=${LIBTOOL_BUNDLED}" >> Makefile.config
echo "LIBTOOL=${LIBTOOL}" >> Makefile.config
echo "PREFIX?=${PREFIX}" >> Makefile.config
echo "#ifndef PREFIX" > $BLD/include/percgi/config/prefix.h
echo "#define PREFIX \"$PREFIX\"" >> $BLD/include/percgi/config/prefix.h
echo "#endif" >> $BLD/include/percgi/config/prefix.h
echo "hdefs[\"PREFIX\"] = \"$PREFIX\"" >>configure.lua
if [ "${bindir}" != "" ]; then
BINDIR="${bindir}"
BINDIR_SPECIFIED="yes"
else
BINDIR="${PREFIX}/bin"
fi
echo "#ifndef BINDIR" > $BLD/include/percgi/config/bindir.h
echo "#define BINDIR \"$BINDIR\"" >> $BLD/include/percgi/config/bindir.h
echo "#endif" >> $BLD/include/percgi/config/bindir.h
echo "hdefs[\"BINDIR\"] = \"$BINDIR\"" >>configure.lua
if [ "${libdir}" != "" ]; then
LIBDIR="${libdir}"
LIBDIR_SPECIFIED="yes"
else
LIBDIR="${PREFIX}/lib"
fi
echo "#ifndef LIBDIR" > $BLD/include/percgi/config/libdir.h
echo "#define LIBDIR \"$LIBDIR\"" >> $BLD/include/percgi/config/libdir.h
echo "#endif" >> $BLD/include/percgi/config/libdir.h
echo "hdefs[\"LIBDIR\"] = \"$LIBDIR\"" >>configure.lua
if [ "${moduledir}" != "" ]; then
MODULEDIR="${moduledir}"
MODULEDIR_SPECIFIED="yes"
else
MODULEDIR="${PREFIX}/lib"
fi
echo "#ifndef MODULEDIR" > $BLD/include/percgi/config/moduledir.h
echo "#define MODULEDIR \"$MODULEDIR\"" >> $BLD/include/percgi/config/moduledir.h
echo "#endif" >> $BLD/include/percgi/config/moduledir.h
echo "hdefs[\"MODULEDIR\"] = \"$MODULEDIR\"" >>configure.lua
if [ "${libexecdir}" != "" ]; then
LIBEXECDIR="${libexecdir}"
LIBEXECDIR_SPECIFIED="yes"
else
LIBEXECDIR="${PREFIX}/libexec"
fi
echo "#ifndef LIBEXECDIR" > $BLD/include/percgi/config/libexecdir.h
echo "#define LIBEXECDIR \"$LIBEXECDIR\"" >> $BLD/include/percgi/config/libexecdir.h
echo "#endif" >> $BLD/include/percgi/config/libexecdir.h
echo "hdefs[\"LIBEXECDIR\"] = \"$LIBEXECDIR\"" >>configure.lua
if [ "${datadir}" != "" ]; then
DATADIR="${datadir}"
DATADIR_SPECIFIED="yes"
else
DATADIR="${PREFIX}/share"
fi
echo "#ifndef DATADIR" > $BLD/include/percgi/config/datadir.h
echo "#define DATADIR \"$DATADIR\"" >> $BLD/include/percgi/config/datadir.h
echo "#endif" >> $BLD/include/percgi/config/datadir.h
echo "hdefs[\"DATADIR\"] = \"$DATADIR\"" >>configure.lua
if [ "${statedir}" != "" ]; then
STATEDIR="${statedir}"
STATEDIR_SPECIFIED="yes"
else
STATEDIR="${PREFIX}/var"
fi
echo "#ifndef STATEDIR" > $BLD/include/percgi/config/statedir.h
echo "#define STATEDIR \"$STATEDIR\"" >> $BLD/include/percgi/config/statedir.h
echo "#endif" >> $BLD/include/percgi/config/statedir.h
echo "hdefs[\"STATEDIR\"] = \"$STATEDIR\"" >>configure.lua
if [ "${sysconfdir}" != "" ]; then
SYSCONFDIR="${sysconfdir}"
SYSCONFDIR_SPECIFIED="yes"
else
SYSCONFDIR="${PREFIX}/etc"
fi
echo "#ifndef SYSCONFDIR" > $BLD/include/percgi/config/sysconfdir.h
echo "#define SYSCONFDIR \"$SYSCONFDIR\"" >> $BLD/include/percgi/config/sysconfdir.h
echo "#endif" >> $BLD/include/percgi/config/sysconfdir.h
echo "hdefs[\"SYSCONFDIR\"] = \"$SYSCONFDIR\"" >>configure.lua
if [ "${localedir}" != "" ]; then
LOCALEDIR="${localedir}"
LOCALEDIR_SPECIFIED="yes"
else
LOCALEDIR="${DATADIR}/locale"
fi
echo "#ifndef LOCALEDIR" > $BLD/include/percgi/config/localedir.h
echo "#define LOCALEDIR \"$LOCALEDIR\"" >> $BLD/include/percgi/config/localedir.h
echo "#endif" >> $BLD/include/percgi/config/localedir.h
echo "hdefs[\"LOCALEDIR\"] = \"$LOCALEDIR\"" >>configure.lua
if [ "${mandir}" != "" ]; then
MANDIR="${mandir}"
MANDIR_SPECIFIED="yes"
else
MANDIR="${PREFIX}/man"
fi
echo "#ifndef MANDIR" > $BLD/include/percgi/config/mandir.h
echo "#define MANDIR \"$MANDIR\"" >> $BLD/include/percgi/config/mandir.h
echo "#endif" >> $BLD/include/percgi/config/mandir.h
echo "hdefs[\"MANDIR\"] = \"$MANDIR\"" >>configure.lua
PACKAGE="PerCGI"
echo "#ifndef PACKAGE" > $BLD/include/percgi/config/package.h
echo "#define PACKAGE \"$PACKAGE\"" >> $BLD/include/percgi/config/package.h
echo "#endif" >> $BLD/include/percgi/config/package.h
echo "hdefs[\"PACKAGE\"] = \"$PACKAGE\"" >>configure.lua
VERSION="2.0"
echo "#ifndef VERSION" > $BLD/include/percgi/config/version.h
echo "#define VERSION \"$VERSION\"" >> $BLD/include/percgi/config/version.h
echo "#endif" >> $BLD/include/percgi/config/version.h
echo "hdefs[\"VERSION\"] = \"$VERSION\"" >>configure.lua
RELEASE="Demon Child"
echo "#ifndef RELEASE" > $BLD/include/percgi/config/release.h
echo "#define RELEASE \"$RELEASE\"" >> $BLD/include/percgi/config/release.h
echo "#endif" >> $BLD/include/percgi/config/release.h
echo "hdefs[\"RELEASE\"] = \"$RELEASE\"" >>configure.lua
INCLDIR="\${PREFIX}/include/percgi"
INCLDIR="$PREFIX/include/percgi"
echo "#ifndef INCLDIR" > $BLD/include/percgi/config/incldir.h
echo "#define INCLDIR \"$INCLDIR\"" >> $BLD/include/percgi/config/incldir.h
echo "#endif" >> $BLD/include/percgi/config/incldir.h
echo "hdefs[\"INCLDIR\"] = \"$INCLDIR\"" >>configure.lua
LOCALEDIR="\${PREFIX}/share/locale"
LOCALEDIR="$PREFIX/share/locale"
echo "#ifndef LOCALEDIR" > $BLD/include/percgi/config/localedir.h
echo "#define LOCALEDIR \"$LOCALEDIR\"" >> $BLD/include/percgi/config/localedir.h
echo "#endif" >> $BLD/include/percgi/config/localedir.h
echo "hdefs[\"LOCALEDIR\"] = \"$LOCALEDIR\"" >>configure.lua
CFLAGS="$CFLAGS -D_PERCGI_INTERNAL"
CXXFLAGS="$CXXFLAGS -D_PERCGI_INTERNAL"
CFLAGS="$CFLAGS -D_GNU_SOURCE"
CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
CFLAGS="$CFLAGS -I$SRC"
CXXFLAGS="$CXXFLAGS -I$SRC"
$ECHO_N "checking for a C compiler..."
$ECHO_N "checking for a C compiler..." >> config.log
if [ "$CROSS_COMPILING" = "yes" ]; then
CROSSPFX="${host}-"
else
CROSSPFX=""
fi
if [ "$CC" = "" ]; then
for i in `echo $PATH |sed 's/:/ /g'`; do
if [ -x "${i}/${CROSSPFX}cc" ]; then
if [ -f "${i}/${CROSSPFX}cc" ]; then
CC="${i}/${CROSSPFX}cc"
break
fi
elif [ -x "${i}/${CROSSPFX}gcc" ]; then
if [ -f "${i}/${CROSSPFX}gcc" ]; then
CC="${i}/${CROSSPFX}gcc"
break
fi
fi
done
if [ "$CC" = "" ]; then
echo "*"
echo "* Cannot find ${CROSSPFX}cc or ${CROSSPFX}gcc in default PATH."
echo "* You may need to set the CC environment variable."
echo "*"
echo "Cannot find ${CROSSPFX}cc or ${CROSSPFX}gcc in PATH." >> config.log
HAVE_CC="no"
echo "no"
else
HAVE_CC="yes"
echo "yes, ${CC}"
echo "yes, ${CC}" >> config.log
fi
else
HAVE_CC="yes"
echo "using ${CC}"
fi
if [ "${HAVE_CC}" = "yes" ]; then
$ECHO_N "checking whether the C compiler works..."
$ECHO_N "checking whether the C compiler works..." >> config.log
cat << 'EOT' > conftest.c
int main(int argc, char *argv[]) { return (0); }
EOT
$CC -o conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "no"
echo "no (test failed to compile)" >> config.log
HAVE_CC="no"
else
HAVE_CC="yes"
fi
if [ "${HAVE_CC}" = "yes" ]; then
if [ "${EXECSUFFIX}" = "" ]; then
EXECSUFFIX=""
for OUTFILE in conftest.exe conftest conftest.*; do
if [ -f $OUTFILE ]; then
case $OUTFILE in
*.c | *.cc | *.m | *.o | *.obj | *.bb | *.bbg | *.d | *.pdb | *.tds | *.xcoff | *.dSYM | *.xSYM )
;;
*.* )
EXECSUFFIX=`expr "$OUTFILE" : '[^.]*\(\..*\)'`
break ;;
* )
break ;;
esac;
fi
done
if [ "$EXECSUFFIX" != "" ]; then
echo "yes (it outputs $EXECSUFFIX files)"
echo "yes (it outputs $EXECSUFFIX files)" >> config.log
else
echo "yes"
echo "yes" >> config.log
fi
echo "#ifndef EXECSUFFIX" > $BLD/include/percgi/config/execsuffix.h
echo "#define EXECSUFFIX \"$EXECSUFFIX\"" >> $BLD/include/percgi/config/execsuffix.h
echo "#endif" >> $BLD/include/percgi/config/execsuffix.h
echo "hdefs[\"EXECSUFFIX\"] = \"$EXECSUFFIX\"" >>configure.lua
else
echo "yes"
echo "yes" >> config.log
fi
fi
rm -f conftest.c conftest$EXECSUFFIX
TEST_CFLAGS=""
fi
if [ "${HAVE_CC}" = "yes" ]; then
$ECHO_N "cc: checking for compiler warning options..."
$ECHO_N "cc: checking for compiler warning options..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int main(int argc, char *argv[]) { return (0); }
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_CC_WARNINGS="yes"
echo "#ifndef HAVE_CC_WARNINGS" > $BLD/include/percgi/config/have_cc_warnings.h
echo "#define HAVE_CC_WARNINGS \"$HAVE_CC_WARNINGS\"" >> $BLD/include/percgi/config/have_cc_warnings.h
echo "#endif" >> $BLD/include/percgi/config/have_cc_warnings.h
echo "hdefs[\"HAVE_CC_WARNINGS\"] = \"$HAVE_CC_WARNINGS\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_CC_WARNINGS="no"
echo "#undef HAVE_CC_WARNINGS" >$BLD/include/percgi/config/have_cc_warnings.h
echo "hdefs[\"HAVE_CC_WARNINGS\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
if [ "${HAVE_CC_WARNINGS}" = "yes" ]; then
TEST_CFLAGS="-Wall -Werror"
fi;
$ECHO_N "cc: checking for long double..."
$ECHO_N "cc: checking for long double..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
long double ld = 0.1;
printf("%Lf", ld);
return (ld == 1.0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_LONG_DOUBLE="yes"
echo "#ifndef HAVE_LONG_DOUBLE" > $BLD/include/percgi/config/have_long_double.h
echo "#define HAVE_LONG_DOUBLE \"$HAVE_LONG_DOUBLE\"" >> $BLD/include/percgi/config/have_long_double.h
echo "#endif" >> $BLD/include/percgi/config/have_long_double.h
echo "hdefs[\"HAVE_LONG_DOUBLE\"] = \"$HAVE_LONG_DOUBLE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_LONG_DOUBLE="no"
echo "#undef HAVE_LONG_DOUBLE" >$BLD/include/percgi/config/have_long_double.h
echo "hdefs[\"HAVE_LONG_DOUBLE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "cc: checking for long long..."
$ECHO_N "cc: checking for long long..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int
main(int argc, char *argv[])
{
long long ll = -1;
unsigned long long ull = 1;
return (ll != -1 || ull != 1);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_LONG_LONG="yes"
echo "#ifndef HAVE_LONG_LONG" > $BLD/include/percgi/config/have_long_long.h
echo "#define HAVE_LONG_LONG \"$HAVE_LONG_LONG\"" >> $BLD/include/percgi/config/have_long_long.h
echo "#endif" >> $BLD/include/percgi/config/have_long_long.h
echo "hdefs[\"HAVE_LONG_LONG\"] = \"$HAVE_LONG_LONG\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_LONG_LONG="no"
echo "#undef HAVE_LONG_LONG" >$BLD/include/percgi/config/have_long_long.h
echo "hdefs[\"HAVE_LONG_LONG\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "cc: checking for cygwin environment..."
$ECHO_N "cc: checking for cygwin environment..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
#include
int
main(int argc, char *argv[]) {
struct stat sb;
DWORD rv;
rv = GetFileAttributes("foo");
stat("foo", &sb);
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -mcygwin -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -mcygwin -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_CYGWIN="yes"
echo "#ifndef HAVE_CYGWIN" > $BLD/include/percgi/config/have_cygwin.h
echo "#define HAVE_CYGWIN \"$HAVE_CYGWIN\"" >> $BLD/include/percgi/config/have_cygwin.h
echo "#endif" >> $BLD/include/percgi/config/have_cygwin.h
echo "hdefs[\"HAVE_CYGWIN\"] = \"$HAVE_CYGWIN\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_CYGWIN="no"
echo "#undef HAVE_CYGWIN" >$BLD/include/percgi/config/have_cygwin.h
echo "hdefs[\"HAVE_CYGWIN\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "cc: checking for -mwindows option..."
$ECHO_N "cc: checking for -mwindows option..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[]) {
return GetFileAttributes("foo") ? 0 : 1;
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -mwindows -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -mwindows -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_CC_MWINDOWS="yes"
echo "#ifndef HAVE_CC_MWINDOWS" > $BLD/include/percgi/config/have_cc_mwindows.h
echo "#define HAVE_CC_MWINDOWS \"$HAVE_CC_MWINDOWS\"" >> $BLD/include/percgi/config/have_cc_mwindows.h
echo "#endif" >> $BLD/include/percgi/config/have_cc_mwindows.h
echo "hdefs[\"HAVE_CC_MWINDOWS\"] = \"$HAVE_CC_MWINDOWS\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_CC_MWINDOWS="no"
echo "#undef HAVE_CC_MWINDOWS" >$BLD/include/percgi/config/have_cc_mwindows.h
echo "hdefs[\"HAVE_CC_MWINDOWS\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
if [ "${HAVE_CC_MWINDOWS}" = "yes" ]; then
PROG_GUI_FLAGS="-mwindows"
else
PROG_GUI_FLAGS=""
fi;
$ECHO_N "cc: checking for -mconsole option..."
$ECHO_N "cc: checking for -mconsole option..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[]) {
return GetFileAttributes("foo") ? 0 : 1;
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -mconsole -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -mconsole -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_CC_MCONSOLE="yes"
echo "#ifndef HAVE_CC_MCONSOLE" > $BLD/include/percgi/config/have_cc_mconsole.h
echo "#define HAVE_CC_MCONSOLE \"$HAVE_CC_MCONSOLE\"" >> $BLD/include/percgi/config/have_cc_mconsole.h
echo "#endif" >> $BLD/include/percgi/config/have_cc_mconsole.h
echo "hdefs[\"HAVE_CC_MCONSOLE\"] = \"$HAVE_CC_MCONSOLE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_CC_MCONSOLE="no"
echo "#undef HAVE_CC_MCONSOLE" >$BLD/include/percgi/config/have_cc_mconsole.h
echo "hdefs[\"HAVE_CC_MCONSOLE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
if [ "${HAVE_CC_MCONSOLE}" = "yes" ]; then
PROG_CLI_FLAGS="-mconsole"
else
PROG_CLI_FLAGS=""
fi;
case "${host}" in
*-*-cygwin* | *-*-mingw32*)
$ECHO_N "cc: checking for linker -no-undefined option..."
$ECHO_N "cc: checking for linker -no-undefined option..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int main(int argc, char *argv[]) { return (0); }
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -Wl,--no-undefined -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -Wl,--no-undefined -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_LD_NO_UNDEFINED="yes"
echo "#ifndef HAVE_LD_NO_UNDEFINED" > $BLD/include/percgi/config/have_ld_no_undefined.h
echo "#define HAVE_LD_NO_UNDEFINED \"$HAVE_LD_NO_UNDEFINED\"" >> $BLD/include/percgi/config/have_ld_no_undefined.h
echo "#endif" >> $BLD/include/percgi/config/have_ld_no_undefined.h
echo "hdefs[\"HAVE_LD_NO_UNDEFINED\"] = \"$HAVE_LD_NO_UNDEFINED\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_LD_NO_UNDEFINED="no"
echo "#undef HAVE_LD_NO_UNDEFINED" >$BLD/include/percgi/config/have_ld_no_undefined.h
echo "hdefs[\"HAVE_LD_NO_UNDEFINED\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
if [ "${HAVE_LD_NO_UNDEFINED}" = "yes" ]; then
LIBTOOLOPTS_SHARED="${LIBTOOLOPTS_SHARED} -no-undefined -Wl,--no-undefined"
fi;
$ECHO_N "cc: checking for linker -static-libgcc option..."
$ECHO_N "cc: checking for linker -static-libgcc option..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int main(int argc, char *argv[]) { return (0); }
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -static-libgcc -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -static-libgcc -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_LD_STATIC_LIBGCC="yes"
echo "#ifndef HAVE_LD_STATIC_LIBGCC" > $BLD/include/percgi/config/have_ld_static_libgcc.h
echo "#define HAVE_LD_STATIC_LIBGCC \"$HAVE_LD_STATIC_LIBGCC\"" >> $BLD/include/percgi/config/have_ld_static_libgcc.h
echo "#endif" >> $BLD/include/percgi/config/have_ld_static_libgcc.h
echo "hdefs[\"HAVE_LD_STATIC_LIBGCC\"] = \"$HAVE_LD_STATIC_LIBGCC\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_LD_STATIC_LIBGCC="no"
echo "#undef HAVE_LD_STATIC_LIBGCC" >$BLD/include/percgi/config/have_ld_static_libgcc.h
echo "hdefs[\"HAVE_LD_STATIC_LIBGCC\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
if [ "${HAVE_LD_STATIC_LIBGCC}" = "yes" ]; then
LIBTOOLOPTS_SHARED="${LIBTOOLOPTS_SHARED} -XCClinker -static-libgcc"
fi;
;;
esac
fi;
$ECHO_N "checking for aligned attribute..."
$ECHO_N "checking for aligned attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int main(int argc, char *argv[])
{
struct s1 { int x,y,z; } __attribute__ ((aligned(16)));
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_ALIGNED_ATTRIBUTE="yes"
echo "#ifndef HAVE_ALIGNED_ATTRIBUTE" > $BLD/include/percgi/config/have_aligned_attribute.h
echo "#define HAVE_ALIGNED_ATTRIBUTE \"$HAVE_ALIGNED_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_aligned_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_aligned_attribute.h
echo "hdefs[\"HAVE_ALIGNED_ATTRIBUTE\"] = \"$HAVE_ALIGNED_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_ALIGNED_ATTRIBUTE="no"
echo "#undef HAVE_ALIGNED_ATTRIBUTE" >$BLD/include/percgi/config/have_aligned_attribute.h
echo "hdefs[\"HAVE_ALIGNED_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for __bounded__ attribute..."
$ECHO_N "checking for __bounded__ attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
void foostring(char *, int) __attribute__ ((__bounded__(__string__,1,2)));
void foostring(char *a, int c) { }
void foobuffer(void *, int) __attribute__ ((__bounded__(__buffer__,1,2)));
void foobuffer(void *a, int c) { }
int main(void)
{
char buf[32];
foostring(buf, sizeof(buf));
foobuffer(buf, sizeof(buf));
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_BOUNDED_ATTRIBUTE="yes"
echo "#ifndef HAVE_BOUNDED_ATTRIBUTE" > $BLD/include/percgi/config/have_bounded_attribute.h
echo "#define HAVE_BOUNDED_ATTRIBUTE \"$HAVE_BOUNDED_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_bounded_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_bounded_attribute.h
echo "hdefs[\"HAVE_BOUNDED_ATTRIBUTE\"] = \"$HAVE_BOUNDED_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_BOUNDED_ATTRIBUTE="no"
echo "#undef HAVE_BOUNDED_ATTRIBUTE" >$BLD/include/percgi/config/have_bounded_attribute.h
echo "hdefs[\"HAVE_BOUNDED_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for const attribute..."
$ECHO_N "checking for const attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int foo(int) __attribute__ ((const));
int foo(int x) { return (x*x); }
int main(int argc, char *argv[])
{
int x = foo(1);
return (x);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_CONST_ATTRIBUTE="yes"
echo "#ifndef HAVE_CONST_ATTRIBUTE" > $BLD/include/percgi/config/have_const_attribute.h
echo "#define HAVE_CONST_ATTRIBUTE \"$HAVE_CONST_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_const_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_const_attribute.h
echo "hdefs[\"HAVE_CONST_ATTRIBUTE\"] = \"$HAVE_CONST_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_CONST_ATTRIBUTE="no"
echo "#undef HAVE_CONST_ATTRIBUTE" >$BLD/include/percgi/config/have_const_attribute.h
echo "hdefs[\"HAVE_CONST_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for deprecated attribute..."
$ECHO_N "checking for deprecated attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
void foo(void) __attribute__ ((deprecated));
void foo(void) { }
int main(int argc, char *argv[])
{
/* foo(); */
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_DEPRECATED_ATTRIBUTE="yes"
echo "#ifndef HAVE_DEPRECATED_ATTRIBUTE" > $BLD/include/percgi/config/have_deprecated_attribute.h
echo "#define HAVE_DEPRECATED_ATTRIBUTE \"$HAVE_DEPRECATED_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_deprecated_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_deprecated_attribute.h
echo "hdefs[\"HAVE_DEPRECATED_ATTRIBUTE\"] = \"$HAVE_DEPRECATED_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_DEPRECATED_ATTRIBUTE="no"
echo "#undef HAVE_DEPRECATED_ATTRIBUTE" >$BLD/include/percgi/config/have_deprecated_attribute.h
echo "hdefs[\"HAVE_DEPRECATED_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for __format__ attribute..."
$ECHO_N "checking for __format__ attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
void foo1(char *, ...)
__attribute__((__format__ (printf, 1, 2)));
void foo2(char *, ...)
__attribute__((__format__ (__printf__, 1, 2)))
__attribute__((__nonnull__ (1)));
void foo1(char *a, ...) {}
void foo2(char *a, ...) {}
int main(int argc, char *argv[])
{
foo1("foo %s", "bar");
foo2("foo %d", 1);
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_FORMAT_ATTRIBUTE="yes"
echo "#ifndef HAVE_FORMAT_ATTRIBUTE" > $BLD/include/percgi/config/have_format_attribute.h
echo "#define HAVE_FORMAT_ATTRIBUTE \"$HAVE_FORMAT_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_format_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_format_attribute.h
echo "hdefs[\"HAVE_FORMAT_ATTRIBUTE\"] = \"$HAVE_FORMAT_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_FORMAT_ATTRIBUTE="no"
echo "#undef HAVE_FORMAT_ATTRIBUTE" >$BLD/include/percgi/config/have_format_attribute.h
echo "hdefs[\"HAVE_FORMAT_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for __nonnull__ attribute..."
$ECHO_N "checking for __nonnull__ attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
void foo(char *) __attribute__((__nonnull__ (1)));
void foo(char *a) { }
int main(int argc, char *argv[])
{
foo("foo");
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_NONNULL_ATTRIBUTE="yes"
echo "#ifndef HAVE_NONNULL_ATTRIBUTE" > $BLD/include/percgi/config/have_nonnull_attribute.h
echo "#define HAVE_NONNULL_ATTRIBUTE \"$HAVE_NONNULL_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_nonnull_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_nonnull_attribute.h
echo "hdefs[\"HAVE_NONNULL_ATTRIBUTE\"] = \"$HAVE_NONNULL_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_NONNULL_ATTRIBUTE="no"
echo "#undef HAVE_NONNULL_ATTRIBUTE" >$BLD/include/percgi/config/have_nonnull_attribute.h
echo "hdefs[\"HAVE_NONNULL_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for noreturn attribute..."
$ECHO_N "checking for noreturn attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
void foo(void) __attribute__ ((noreturn));
void foo(void) { _exit(0); }
int main(int argc, char *argv[])
{
foo();
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_NORETURN_ATTRIBUTE="yes"
echo "#ifndef HAVE_NORETURN_ATTRIBUTE" > $BLD/include/percgi/config/have_noreturn_attribute.h
echo "#define HAVE_NORETURN_ATTRIBUTE \"$HAVE_NORETURN_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_noreturn_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_noreturn_attribute.h
echo "hdefs[\"HAVE_NORETURN_ATTRIBUTE\"] = \"$HAVE_NORETURN_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_NORETURN_ATTRIBUTE="no"
echo "#undef HAVE_NORETURN_ATTRIBUTE" >$BLD/include/percgi/config/have_noreturn_attribute.h
echo "hdefs[\"HAVE_NORETURN_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for packed attribute..."
$ECHO_N "checking for packed attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int main(int argc, char *argv[])
{
struct s1 { char c; int x,y,z; } __attribute__ ((packed));
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -Wall -Werror -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_PACKED_ATTRIBUTE="yes"
echo "#ifndef HAVE_PACKED_ATTRIBUTE" > $BLD/include/percgi/config/have_packed_attribute.h
echo "#define HAVE_PACKED_ATTRIBUTE \"$HAVE_PACKED_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_packed_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_packed_attribute.h
echo "hdefs[\"HAVE_PACKED_ATTRIBUTE\"] = \"$HAVE_PACKED_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_PACKED_ATTRIBUTE="no"
echo "#undef HAVE_PACKED_ATTRIBUTE" >$BLD/include/percgi/config/have_packed_attribute.h
echo "hdefs[\"HAVE_PACKED_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for pure attribute..."
$ECHO_N "checking for pure attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int foo(int) __attribute__ ((pure));
int foo(int x) { return (x*x); }
int main(int argc, char *argv[])
{
int x = foo(1);
return (x);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_PURE_ATTRIBUTE="yes"
echo "#ifndef HAVE_PURE_ATTRIBUTE" > $BLD/include/percgi/config/have_pure_attribute.h
echo "#define HAVE_PURE_ATTRIBUTE \"$HAVE_PURE_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_pure_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_pure_attribute.h
echo "hdefs[\"HAVE_PURE_ATTRIBUTE\"] = \"$HAVE_PURE_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_PURE_ATTRIBUTE="no"
echo "#undef HAVE_PURE_ATTRIBUTE" >$BLD/include/percgi/config/have_pure_attribute.h
echo "hdefs[\"HAVE_PURE_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for warn_unused_result attribute..."
$ECHO_N "checking for warn_unused_result attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int foo(void) __attribute__ ((warn_unused_result));
int foo(void) { return (1); }
int main(int argc, char *argv[])
{
int rv = foo();
return (rv);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_WARN_UNUSED_RESULT_ATTRIBUTE="yes"
echo "#ifndef HAVE_WARN_UNUSED_RESULT_ATTRIBUTE" > $BLD/include/percgi/config/have_warn_unused_result_attribute.h
echo "#define HAVE_WARN_UNUSED_RESULT_ATTRIBUTE \"$HAVE_WARN_UNUSED_RESULT_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_warn_unused_result_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_warn_unused_result_attribute.h
echo "hdefs[\"HAVE_WARN_UNUSED_RESULT_ATTRIBUTE\"] = \"$HAVE_WARN_UNUSED_RESULT_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_WARN_UNUSED_RESULT_ATTRIBUTE="no"
echo "#undef HAVE_WARN_UNUSED_RESULT_ATTRIBUTE" >$BLD/include/percgi/config/have_warn_unused_result_attribute.h
echo "hdefs[\"HAVE_WARN_UNUSED_RESULT_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for unused variable attribute..."
$ECHO_N "checking for unused variable attribute..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
int main(int argc, char *argv[])
{
int __attribute__ ((unused)) variable;
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_UNUSED_VARIABLE_ATTRIBUTE="yes"
echo "#ifndef HAVE_UNUSED_VARIABLE_ATTRIBUTE" > $BLD/include/percgi/config/have_unused_variable_attribute.h
echo "#define HAVE_UNUSED_VARIABLE_ATTRIBUTE \"$HAVE_UNUSED_VARIABLE_ATTRIBUTE\"" >> $BLD/include/percgi/config/have_unused_variable_attribute.h
echo "#endif" >> $BLD/include/percgi/config/have_unused_variable_attribute.h
echo "hdefs[\"HAVE_UNUSED_VARIABLE_ATTRIBUTE\"] = \"$HAVE_UNUSED_VARIABLE_ATTRIBUTE\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_UNUSED_VARIABLE_ATTRIBUTE="no"
echo "#undef HAVE_UNUSED_VARIABLE_ATTRIBUTE" >$BLD/include/percgi/config/have_unused_variable_attribute.h
echo "hdefs[\"HAVE_UNUSED_VARIABLE_ATTRIBUTE\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for ..."
$ECHO_N "checking for ..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int main(int argc, char *argv[]) {
size_t len = 1;
len++;
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
_MK_HAVE_SYS_TYPES_H="yes"
echo "#ifndef _MK_HAVE_SYS_TYPES_H" > $BLD/include/percgi/config/_mk_have_sys_types_h.h
echo "#define _MK_HAVE_SYS_TYPES_H \"$_MK_HAVE_SYS_TYPES_H\"" >> $BLD/include/percgi/config/_mk_have_sys_types_h.h
echo "#endif" >> $BLD/include/percgi/config/_mk_have_sys_types_h.h
echo "hdefs[\"_MK_HAVE_SYS_TYPES_H\"] = \"$_MK_HAVE_SYS_TYPES_H\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
_MK_HAVE_SYS_TYPES_H="no"
echo "#undef _MK_HAVE_SYS_TYPES_H" >$BLD/include/percgi/config/_mk_have_sys_types_h.h
echo "hdefs[\"_MK_HAVE_SYS_TYPES_H\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
if [ "${_MK_HAVE_SYS_TYPES_H}" = "yes" ]; then
$ECHO_N "checking for int64_t type..."
$ECHO_N "checking for int64_t type..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
int main(int argc, char *argv[]) {
int64_t i64 = 0;
u_int64_t u64 = 0;
printf("%lld %llu", (long long)i64, (unsigned long long)u64);
return (i64 != 0 || u64 != 0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_INT64_T="yes"
echo "#ifndef HAVE_INT64_T" > $BLD/include/percgi/config/have_int64_t.h
echo "#define HAVE_INT64_T \"$HAVE_INT64_T\"" >> $BLD/include/percgi/config/have_int64_t.h
echo "#endif" >> $BLD/include/percgi/config/have_int64_t.h
echo "hdefs[\"HAVE_INT64_T\"] = \"$HAVE_INT64_T\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_INT64_T="no"
echo "#undef HAVE_INT64_T" >$BLD/include/percgi/config/have_int64_t.h
echo "hdefs[\"HAVE_INT64_T\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for __int64 type..."
$ECHO_N "checking for __int64 type..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
int main(int argc, char *argv[]) {
__int64 i64 = 0;
printf("%lld", (long long)i64);
return (i64 != 0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE___INT64="yes"
echo "#ifndef HAVE___INT64" > $BLD/include/percgi/config/have___int64.h
echo "#define HAVE___INT64 \"$HAVE___INT64\"" >> $BLD/include/percgi/config/have___int64.h
echo "#endif" >> $BLD/include/percgi/config/have___int64.h
echo "hdefs[\"HAVE___INT64\"] = \"$HAVE___INT64\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE___INT64="no"
echo "#undef HAVE___INT64" >$BLD/include/percgi/config/have___int64.h
echo "hdefs[\"HAVE___INT64\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
if [ "${HAVE_INT64_T}" = "yes" ]; then
HAVE_64BIT="yes"
echo "#ifndef HAVE_64BIT" > $BLD/include/percgi/config/have_64bit.h
echo "#define HAVE_64BIT \"$HAVE_64BIT\"" >> $BLD/include/percgi/config/have_64bit.h
echo "#endif" >> $BLD/include/percgi/config/have_64bit.h
echo "hdefs[\"HAVE_64BIT\"] = \"$HAVE_64BIT\"" >>configure.lua
else
if [ "${HAVE___INT64}" = "yes" ]; then
HAVE_64BIT="yes"
echo "#ifndef HAVE_64BIT" > $BLD/include/percgi/config/have_64bit.h
echo "#define HAVE_64BIT \"$HAVE_64BIT\"" >> $BLD/include/percgi/config/have_64bit.h
echo "#endif" >> $BLD/include/percgi/config/have_64bit.h
echo "hdefs[\"HAVE_64BIT\"] = \"$HAVE_64BIT\"" >>configure.lua
else
echo "#undef HAVE_64BIT" >$BLD/include/percgi/config/have_64bit.h
echo "hdefs[\"HAVE_64BIT\"] = nil" >>configure.lua
fi;
fi;
else
echo "#undef HAVE_64BIT" >$BLD/include/percgi/config/have_64bit.h
echo "hdefs[\"HAVE_64BIT\"] = nil" >>configure.lua
fi;
$ECHO_N "checking for the arc4random() random number generator..."
$ECHO_N "checking for the arc4random() random number generator..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
int
main(int argc, char *argv[])
{
u_int32_t i;
i = arc4random();
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_ARC4RANDOM="yes"
echo "#ifndef HAVE_ARC4RANDOM" > $BLD/include/percgi/config/have_arc4random.h
echo "#define HAVE_ARC4RANDOM \"$HAVE_ARC4RANDOM\"" >> $BLD/include/percgi/config/have_arc4random.h
echo "#endif" >> $BLD/include/percgi/config/have_arc4random.h
echo "hdefs[\"HAVE_ARC4RANDOM\"] = \"$HAVE_ARC4RANDOM\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_ARC4RANDOM="no"
echo "#undef HAVE_ARC4RANDOM" >$BLD/include/percgi/config/have_arc4random.h
echo "hdefs[\"HAVE_ARC4RANDOM\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for a gethostname() function..."
$ECHO_N "checking for a gethostname() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
int
main(int argc, char *argv[])
{
char hostname[64];
int rv;
rv = gethostname(hostname, sizeof(hostname));
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_GETHOSTNAME="yes"
echo "#ifndef HAVE_GETHOSTNAME" > $BLD/include/percgi/config/have_gethostname.h
echo "#define HAVE_GETHOSTNAME \"$HAVE_GETHOSTNAME\"" >> $BLD/include/percgi/config/have_gethostname.h
echo "#endif" >> $BLD/include/percgi/config/have_gethostname.h
echo "hdefs[\"HAVE_GETHOSTNAME\"] = \"$HAVE_GETHOSTNAME\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_GETHOSTNAME="no"
echo "#undef HAVE_GETHOSTNAME" >$BLD/include/percgi/config/have_gethostname.h
echo "hdefs[\"HAVE_GETHOSTNAME\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for a getenv() function..."
$ECHO_N "checking for a getenv() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
(void)getenv("PATH");
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_GETENV="yes"
echo "#ifndef HAVE_GETENV" > $BLD/include/percgi/config/have_getenv.h
echo "#define HAVE_GETENV \"$HAVE_GETENV\"" >> $BLD/include/percgi/config/have_getenv.h
echo "#endif" >> $BLD/include/percgi/config/have_getenv.h
echo "hdefs[\"HAVE_GETENV\"] = \"$HAVE_GETENV\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_GETENV="no"
echo "#undef HAVE_GETENV" >$BLD/include/percgi/config/have_getenv.h
echo "hdefs[\"HAVE_GETENV\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for setenv() and unsetenv()..."
$ECHO_N "checking for setenv() and unsetenv()..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
(void)setenv("BSDBUILD_SETENV_TEST", "foo", 1);
unsetenv("BSDBUILD_SETENV_TEST");
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_SETENV="yes"
echo "#ifndef HAVE_SETENV" > $BLD/include/percgi/config/have_setenv.h
echo "#define HAVE_SETENV \"$HAVE_SETENV\"" >> $BLD/include/percgi/config/have_setenv.h
echo "#endif" >> $BLD/include/percgi/config/have_setenv.h
echo "hdefs[\"HAVE_SETENV\"] = \"$HAVE_SETENV\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_SETENV="no"
echo "#undef HAVE_SETENV" >$BLD/include/percgi/config/have_setenv.h
echo "hdefs[\"HAVE_SETENV\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for a strsep() function..."
$ECHO_N "checking for a strsep() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
char foo[32], *pFoo = &foo[0];
char *s;
foo[0] = '\0';
s = strsep(&pFoo, " ");
return (s != NULL);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_STRSEP="yes"
echo "#ifndef HAVE_STRSEP" > $BLD/include/percgi/config/have_strsep.h
echo "#define HAVE_STRSEP \"$HAVE_STRSEP\"" >> $BLD/include/percgi/config/have_strsep.h
echo "#endif" >> $BLD/include/percgi/config/have_strsep.h
echo "hdefs[\"HAVE_STRSEP\"] = \"$HAVE_STRSEP\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_STRSEP="no"
echo "#undef HAVE_STRSEP" >$BLD/include/percgi/config/have_strsep.h
echo "hdefs[\"HAVE_STRSEP\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for a strlcat() function..."
$ECHO_N "checking for a strlcat() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
(void)strlcat(NULL, NULL, 0);
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_STRLCAT="yes"
echo "#ifndef HAVE_STRLCAT" > $BLD/include/percgi/config/have_strlcat.h
echo "#define HAVE_STRLCAT \"$HAVE_STRLCAT\"" >> $BLD/include/percgi/config/have_strlcat.h
echo "#endif" >> $BLD/include/percgi/config/have_strlcat.h
echo "hdefs[\"HAVE_STRLCAT\"] = \"$HAVE_STRLCAT\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_STRLCAT="no"
echo "#undef HAVE_STRLCAT" >$BLD/include/percgi/config/have_strlcat.h
echo "hdefs[\"HAVE_STRLCAT\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for a strlcpy() function..."
$ECHO_N "checking for a strlcpy() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
(void)strlcpy(NULL, NULL, 0);
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_STRLCPY="yes"
echo "#ifndef HAVE_STRLCPY" > $BLD/include/percgi/config/have_strlcpy.h
echo "#define HAVE_STRLCPY \"$HAVE_STRLCPY\"" >> $BLD/include/percgi/config/have_strlcpy.h
echo "#endif" >> $BLD/include/percgi/config/have_strlcpy.h
echo "hdefs[\"HAVE_STRLCPY\"] = \"$HAVE_STRLCPY\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_STRLCPY="no"
echo "#undef HAVE_STRLCPY" >$BLD/include/percgi/config/have_strlcpy.h
echo "hdefs[\"HAVE_STRLCPY\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for an asprintf() function..."
$ECHO_N "checking for an asprintf() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
char *buf;
if (asprintf(&buf, "foo %s", "bar") == 0) {
return (0);
}
return (1);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -D_GNU_SOURCE -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -D_GNU_SOURCE -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_ASPRINTF="yes"
echo "#ifndef HAVE_ASPRINTF" > $BLD/include/percgi/config/have_asprintf.h
echo "#define HAVE_ASPRINTF \"$HAVE_ASPRINTF\"" >> $BLD/include/percgi/config/have_asprintf.h
echo "#endif" >> $BLD/include/percgi/config/have_asprintf.h
echo "hdefs[\"HAVE_ASPRINTF\"] = \"$HAVE_ASPRINTF\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_ASPRINTF="no"
echo "#undef HAVE_ASPRINTF" >$BLD/include/percgi/config/have_asprintf.h
echo "hdefs[\"HAVE_ASPRINTF\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for a vasprintf() function..."
$ECHO_N "checking for a vasprintf() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
int
testprintf(const char *fmt, ...)
{
va_list args;
char *buf;
va_start(args, fmt);
if (vasprintf(&buf, "%s", args) == -1) {
return (-1);
}
va_end(args);
return (0);
}
int
main(int argc, char *argv[])
{
return (testprintf("foo %s", "bar"));
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -D_GNU_SOURCE -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -D_GNU_SOURCE -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_VASPRINTF="yes"
echo "#ifndef HAVE_VASPRINTF" > $BLD/include/percgi/config/have_vasprintf.h
echo "#define HAVE_VASPRINTF \"$HAVE_VASPRINTF\"" >> $BLD/include/percgi/config/have_vasprintf.h
echo "#endif" >> $BLD/include/percgi/config/have_vasprintf.h
echo "hdefs[\"HAVE_VASPRINTF\"] = \"$HAVE_VASPRINTF\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_VASPRINTF="no"
echo "#undef HAVE_VASPRINTF" >$BLD/include/percgi/config/have_vasprintf.h
echo "hdefs[\"HAVE_VASPRINTF\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest
$ECHO_N "checking for the snprintf() function..."
$ECHO_N "checking for the snprintf() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
char buf[16];
(void)snprintf(buf, sizeof(buf), "foo");
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_SNPRINTF="yes"
echo "#ifndef HAVE_SNPRINTF" > $BLD/include/percgi/config/have_snprintf.h
echo "#define HAVE_SNPRINTF \"$HAVE_SNPRINTF\"" >> $BLD/include/percgi/config/have_snprintf.h
echo "#endif" >> $BLD/include/percgi/config/have_snprintf.h
echo "hdefs[\"HAVE_SNPRINTF\"] = \"$HAVE_SNPRINTF\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_SNPRINTF="no"
echo "#undef HAVE_SNPRINTF" >$BLD/include/percgi/config/have_snprintf.h
echo "hdefs[\"HAVE_SNPRINTF\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for the vsnprintf() function..."
$ECHO_N "checking for the vsnprintf() function..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
static void
testfmt(const char *fmt, ...)
{
char buf[16];
va_list ap;
va_start(ap, fmt);
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
}
int
main(int argc, char *argv[])
{
testfmt("foo", 1, 2, 3);
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_VSNPRINTF="yes"
echo "#ifndef HAVE_VSNPRINTF" > $BLD/include/percgi/config/have_vsnprintf.h
echo "#define HAVE_VSNPRINTF \"$HAVE_VSNPRINTF\"" >> $BLD/include/percgi/config/have_vsnprintf.h
echo "#endif" >> $BLD/include/percgi/config/have_vsnprintf.h
echo "hdefs[\"HAVE_VSNPRINTF\"] = \"$HAVE_VSNPRINTF\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_VSNPRINTF="no"
echo "#undef HAVE_VSNPRINTF" >$BLD/include/percgi/config/have_vsnprintf.h
echo "hdefs[\"HAVE_VSNPRINTF\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for the pctr(4) interface..."
$ECHO_N "checking for the pctr(4) interface..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
#include
#include
int
main(int argc, char *argv[])
{
pctrval v;
v = rdtsc();
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_PCTR="yes"
echo "#ifndef HAVE_PCTR" > $BLD/include/percgi/config/have_pctr.h
echo "#define HAVE_PCTR \"$HAVE_PCTR\"" >> $BLD/include/percgi/config/have_pctr.h
echo "#endif" >> $BLD/include/percgi/config/have_pctr.h
echo "hdefs[\"HAVE_PCTR\"] = \"$HAVE_PCTR\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_PCTR="no"
echo "#undef HAVE_PCTR" >$BLD/include/percgi/config/have_pctr.h
echo "hdefs[\"HAVE_PCTR\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for FastCGI (http://fastcgi.com)..."
$ECHO_N "checking for FastCGI (http://fastcgi.com)..." >> config.log
FASTCGI_CFLAGS=""
FASTCGI_LIBS=""
if [ "" != "" ]; then
if [ -e "/include/fcgi_stdio.h" ]; then
FASTCGI_CFLAGS="-I/include"
FASTCGI_LIBS="-L/lib -lfcgi"
fi;
else
if [ -e "/usr/local/include/fcgi_stdio.h" ]; then
FASTCGI_CFLAGS="-I/usr/local/include"
FASTCGI_LIBS="-L/usr/local/lib -lfcgi"
fi;
if [ -e "/usr/include/fcgi_stdio.h" ]; then
FASTCGI_CFLAGS="-I/usr/include"
FASTCGI_LIBS="-L/usr/lib -lfcgi"
fi;
if [ -e "/opt/local/include/fcgi_stdio.h" ]; then
FASTCGI_CFLAGS="-I/opt/local/include"
FASTCGI_LIBS="-L/opt/local/lib -lfcgi"
fi;
if [ -e "/opt/include/fcgi_stdio.h" ]; then
FASTCGI_CFLAGS="-I/opt/include"
FASTCGI_LIBS="-L/opt/lib -lfcgi"
fi;
fi;
if [ "${FASTCGI_LIBS}" != "" ]; then
echo "yes"
echo "yes" >> config.log
$ECHO_N "checking whether fastcgi works..."
$ECHO_N "checking whether fastcgi works..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int
main(int argc, char *argv[])
{
printf("foo\n");
return (0);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS ${FASTCGI_CFLAGS} -o $testdir/conftest conftest.c ${FASTCGI_LIBS}" >>config.log
$CC $CFLAGS $TEST_CFLAGS ${FASTCGI_CFLAGS} -o $testdir/conftest conftest.c ${FASTCGI_LIBS} 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_FASTCGI="yes"
echo "#ifndef HAVE_FASTCGI" > $BLD/include/percgi/config/have_fastcgi.h
echo "#define HAVE_FASTCGI \"$HAVE_FASTCGI\"" >> $BLD/include/percgi/config/have_fastcgi.h
echo "#endif" >> $BLD/include/percgi/config/have_fastcgi.h
echo "hdefs[\"HAVE_FASTCGI\"] = \"$HAVE_FASTCGI\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_FASTCGI="no"
echo "#undef HAVE_FASTCGI" >$BLD/include/percgi/config/have_fastcgi.h
echo "hdefs[\"HAVE_FASTCGI\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
if [ "${HAVE_FASTCGI}" = "yes" ]; then
echo "#ifndef FASTCGI_CFLAGS" > $BLD/include/percgi/config/fastcgi_cflags.h
echo "#define FASTCGI_CFLAGS \"$FASTCGI_CFLAGS\"" >> $BLD/include/percgi/config/fastcgi_cflags.h
echo "#endif" >> $BLD/include/percgi/config/fastcgi_cflags.h
echo "hdefs[\"FASTCGI_CFLAGS\"] = \"$FASTCGI_CFLAGS\"" >>configure.lua
echo "#ifndef FASTCGI_LIBS" > $BLD/include/percgi/config/fastcgi_libs.h
echo "#define FASTCGI_LIBS \"$FASTCGI_LIBS\"" >> $BLD/include/percgi/config/fastcgi_libs.h
echo "#endif" >> $BLD/include/percgi/config/fastcgi_libs.h
echo "hdefs[\"FASTCGI_LIBS\"] = \"$FASTCGI_LIBS\"" >>configure.lua
else
echo "#undef FASTCGI_CFLAGS" >$BLD/include/percgi/config/fastcgi_cflags.h
echo "hdefs[\"FASTCGI_CFLAGS\"] = nil" >>configure.lua
FASTCGI_CFLAGS=""
echo "#undef FASTCGI_LIBS" >$BLD/include/percgi/config/fastcgi_libs.h
echo "hdefs[\"FASTCGI_LIBS\"] = nil" >>configure.lua
FASTCGI_LIBS=""
fi;
else
echo "no"
echo "no" >> config.log
echo "#undef HAVE_FASTCGI" >$BLD/include/percgi/config/have_fastcgi.h
echo "hdefs[\"HAVE_FASTCGI\"] = nil" >>configure.lua
echo "#undef FASTCGI_CFLAGS" >$BLD/include/percgi/config/fastcgi_cflags.h
echo "hdefs[\"FASTCGI_CFLAGS\"] = nil" >>configure.lua
echo "#undef FASTCGI_LIBS" >$BLD/include/percgi/config/fastcgi_libs.h
echo "hdefs[\"FASTCGI_LIBS\"] = nil" >>configure.lua
fi;
$ECHO_N "checking for byte order..."
$ECHO_N "checking for byte order..." >> config.log
if [ "${byte_order}" != "" ]; then
if [ "${byte_order}" = "LE" ]; then
_MK_BYTE_ORDER="LE"
else
if [ "${byte_order}" = "BE" ]; then
_MK_BYTE_ORDER="BE"
else
echo "Usage: --byte-order=[LE|BE]"
exit 1
fi;
fi;
else
cat << EOT > conftest.c
#include
#include
int
main(int argc, char *argv[])
{
#if BYTE_ORDER == BIG_ENDIAN
static volatile char *bo = "BiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiANBiGEnDiAN";
#else
static volatile char *bo = "LiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiANLiTTLeEnDiAN";
#endif
int c = 0;
volatile char *p = bo;
while (*p != '\0') { c *= (int)*p; }
return (c>123?c:456);
}
EOT
echo "$CC $CFLAGS -o $testdir/conftest conftest.c" >>config.log
$CC $CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "Failed to compile test program for byte order ($?)"
echo "Failed to compile test program for byte order ($?)" >> config.log
exit 1
fi
rm -f conftest.c
_MK_BYTE_ORDER=""
_MK_BYTE_ORDER_LESTRING="LiTTLeEnD"
_MK_BYTE_ORDER_BESTRING="BiGEnDiAN"
od -tc $testdir/conftest$EXECSUFFIX | sed 's/ //g' > $testdir/conftest.dump
if grep "$_MK_BYTE_ORDER_LESTRING" $testdir/conftest.dump >/dev/null; then
_MK_BYTE_ORDER="LE"
if grep "$_MK_BYTE_ORDER_BESTRING" $testdir/conftest.dump >/dev/null; then
echo "*"
echo "* Unable to auto-determine host byte order. Please re-run ./configure"
echo "* with --byte-order=LE or --byte-order=BE."
echo "*"
exit 1
fi
else
if grep "$_MK_BYTE_ORDER_BESTRING" $testdir/conftest.dump >/dev/null; then
_MK_BYTE_ORDER="BE"
if grep "$_MK_BYTE_ORDER_LESTRING" $testdir/conftest.dump >/dev/null; then
echo "*"
echo "* Unable to auto-determine host byte order. Please re-run ./configure"
echo "* with --byte-order=LE or --byte-order=BE."
echo "*"
exit 1
fi
fi
fi
rm -f conftest.c $testdir/conftest $testdir/conftest.dump
fi;
if [ "$_MK_BYTE_ORDER" = "LE" ]; then
echo "little-endian"
echo "little-endian" >> config.log
_MK_LITTLE_ENDIAN="yes"
echo "#ifndef _MK_LITTLE_ENDIAN" > $BLD/include/percgi/config/_mk_little_endian.h
echo "#define _MK_LITTLE_ENDIAN \"$_MK_LITTLE_ENDIAN\"" >> $BLD/include/percgi/config/_mk_little_endian.h
echo "#endif" >> $BLD/include/percgi/config/_mk_little_endian.h
echo "hdefs[\"_MK_LITTLE_ENDIAN\"] = \"$_MK_LITTLE_ENDIAN\"" >>configure.lua
echo "#undef _MK_BIG_ENDIAN" >$BLD/include/percgi/config/_mk_big_endian.h
echo "hdefs[\"_MK_BIG_ENDIAN\"] = nil" >>configure.lua
else
echo "big-endian"
echo "big-endian" >> config.log
_MK_BIG_ENDIAN="yes"
echo "#ifndef _MK_BIG_ENDIAN" > $BLD/include/percgi/config/_mk_big_endian.h
echo "#define _MK_BIG_ENDIAN \"$_MK_BIG_ENDIAN\"" >> $BLD/include/percgi/config/_mk_big_endian.h
echo "#endif" >> $BLD/include/percgi/config/_mk_big_endian.h
echo "hdefs[\"_MK_BIG_ENDIAN\"] = \"$_MK_BIG_ENDIAN\"" >>configure.lua
echo "#undef _MK_LITTLE_ENDIAN" >$BLD/include/percgi/config/_mk_little_endian.h
echo "hdefs[\"_MK_LITTLE_ENDIAN\"] = nil" >>configure.lua
fi;
$ECHO_N "checking for (HAVE_SYS_UIO_H)..."
$ECHO_N "checking for (HAVE_SYS_UIO_H)..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int main (int argc, char *argv[]) { return (0); }
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_SYS_UIO_H="yes"
echo "#ifndef HAVE_SYS_UIO_H" > $BLD/include/percgi/config/have_sys_uio_h.h
echo "#define HAVE_SYS_UIO_H \"$HAVE_SYS_UIO_H\"" >> $BLD/include/percgi/config/have_sys_uio_h.h
echo "#endif" >> $BLD/include/percgi/config/have_sys_uio_h.h
echo "hdefs[\"HAVE_SYS_UIO_H\"] = \"$HAVE_SYS_UIO_H\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_SYS_UIO_H="no"
echo "#undef HAVE_SYS_UIO_H" >$BLD/include/percgi/config/have_sys_uio_h.h
echo "hdefs[\"HAVE_SYS_UIO_H\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for (HAVE_SYS_PARAM_H)..."
$ECHO_N "checking for (HAVE_SYS_PARAM_H)..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int main (int argc, char *argv[]) { return (0); }
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_SYS_PARAM_H="yes"
echo "#ifndef HAVE_SYS_PARAM_H" > $BLD/include/percgi/config/have_sys_param_h.h
echo "#define HAVE_SYS_PARAM_H \"$HAVE_SYS_PARAM_H\"" >> $BLD/include/percgi/config/have_sys_param_h.h
echo "#endif" >> $BLD/include/percgi/config/have_sys_param_h.h
echo "hdefs[\"HAVE_SYS_PARAM_H\"] = \"$HAVE_SYS_PARAM_H\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_SYS_PARAM_H="no"
echo "#undef HAVE_SYS_PARAM_H" >$BLD/include/percgi/config/have_sys_param_h.h
echo "hdefs[\"HAVE_SYS_PARAM_H\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for (HAVE_SYSEXITS_H)..."
$ECHO_N "checking for (HAVE_SYSEXITS_H)..." >> config.log
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int main (int argc, char *argv[]) { return (0); }
EOT
echo "$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c " >>config.log
$CC $CFLAGS $TEST_CFLAGS -o $testdir/conftest conftest.c 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_SYSEXITS_H="yes"
echo "#ifndef HAVE_SYSEXITS_H" > $BLD/include/percgi/config/have_sysexits_h.h
echo "#define HAVE_SYSEXITS_H \"$HAVE_SYSEXITS_H\"" >> $BLD/include/percgi/config/have_sysexits_h.h
echo "#endif" >> $BLD/include/percgi/config/have_sysexits_h.h
echo "hdefs[\"HAVE_SYSEXITS_H\"] = \"$HAVE_SYSEXITS_H\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_SYSEXITS_H="no"
echo "#undef HAVE_SYSEXITS_H" >$BLD/include/percgi/config/have_sysexits_h.h
echo "hdefs[\"HAVE_SYSEXITS_H\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
$ECHO_N "checking for a gettext library in libc..."
$ECHO_N "checking for a gettext library in libc..." >> config.log
GETTEXT_CFLAGS=""
GETTEXT_LIBS=""
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int main(int argc, char *argv[])
{
char *s;
bindtextdomain("foo", "/foo");
textdomain("foo");
s = gettext("string");
s = dgettext("foo","string");
return (s != NULL);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS ${GETTEXT_CFLAGS} -o $testdir/conftest conftest.c ${GETTEXT_LIBS}" >>config.log
$CC $CFLAGS $TEST_CFLAGS ${GETTEXT_CFLAGS} -o $testdir/conftest conftest.c ${GETTEXT_LIBS} 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_GETTEXT="yes"
echo "#ifndef HAVE_GETTEXT" > $BLD/include/percgi/config/have_gettext.h
echo "#define HAVE_GETTEXT \"$HAVE_GETTEXT\"" >> $BLD/include/percgi/config/have_gettext.h
echo "#endif" >> $BLD/include/percgi/config/have_gettext.h
echo "hdefs[\"HAVE_GETTEXT\"] = \"$HAVE_GETTEXT\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_GETTEXT="no"
echo "#undef HAVE_GETTEXT" >$BLD/include/percgi/config/have_gettext.h
echo "hdefs[\"HAVE_GETTEXT\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
if [ "${HAVE_GETTEXT}" = "no" ]; then
$ECHO_N "checking for a gettext library in -lintl..."
$ECHO_N "checking for a gettext library in -lintl..." >> config.log
if [ "" != "" ]; then
if [ -e "/include/libintl.h" ]; then
GETTEXT_CFLAGS="-I/include"
GETTEXT_LIBS="-L/lib -lintl"
fi;
else
if [ -e "/include/libintl.h" ]; then
GETTEXT_CFLAGS="-I/include"
GETTEXT_LIBS="-L/lib -lintl"
fi;
if [ -e "/usr/include/libintl.h" ]; then
GETTEXT_CFLAGS="-I/usr/include"
GETTEXT_LIBS="-L/usr/lib -lintl"
fi;
if [ -e "/usr/local/include/libintl.h" ]; then
GETTEXT_CFLAGS="-I/usr/local/include"
GETTEXT_LIBS="-L/usr/local/lib -lintl"
fi;
if [ -e "/opt/include/libintl.h" ]; then
GETTEXT_CFLAGS="-I/opt/include"
GETTEXT_LIBS="-L/opt/lib -lintl"
fi;
if [ -e "/opt/local/include/libintl.h" ]; then
GETTEXT_CFLAGS="-I/opt/local/include"
GETTEXT_LIBS="-L/opt/local/lib -lintl"
fi;
if [ -e "/usr/pkg/include/libintl.h" ]; then
GETTEXT_CFLAGS="-I/usr/pkg/include"
GETTEXT_LIBS="-L/usr/pkg/lib -lintl"
fi;
fi;
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int main(int argc, char *argv[])
{
char *s;
bindtextdomain("foo", "/foo");
textdomain("foo");
s = gettext("string");
s = dgettext("foo","string");
return (s != NULL);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS ${GETTEXT_CFLAGS} -o $testdir/conftest conftest.c ${GETTEXT_LIBS}" >>config.log
$CC $CFLAGS $TEST_CFLAGS ${GETTEXT_CFLAGS} -o $testdir/conftest conftest.c ${GETTEXT_LIBS} 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_GETTEXT="yes"
echo "#ifndef HAVE_GETTEXT" > $BLD/include/percgi/config/have_gettext.h
echo "#define HAVE_GETTEXT \"$HAVE_GETTEXT\"" >> $BLD/include/percgi/config/have_gettext.h
echo "#endif" >> $BLD/include/percgi/config/have_gettext.h
echo "hdefs[\"HAVE_GETTEXT\"] = \"$HAVE_GETTEXT\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_GETTEXT="no"
echo "#undef HAVE_GETTEXT" >$BLD/include/percgi/config/have_gettext.h
echo "hdefs[\"HAVE_GETTEXT\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
if [ "${HAVE_GETTEXT}" = "yes" ]; then
echo "#ifndef GETTEXT_CFLAGS" > $BLD/include/percgi/config/gettext_cflags.h
echo "#define GETTEXT_CFLAGS \"$GETTEXT_CFLAGS\"" >> $BLD/include/percgi/config/gettext_cflags.h
echo "#endif" >> $BLD/include/percgi/config/gettext_cflags.h
echo "hdefs[\"GETTEXT_CFLAGS\"] = \"$GETTEXT_CFLAGS\"" >>configure.lua
echo "#ifndef GETTEXT_LIBS" > $BLD/include/percgi/config/gettext_libs.h
echo "#define GETTEXT_LIBS \"$GETTEXT_LIBS\"" >> $BLD/include/percgi/config/gettext_libs.h
echo "#endif" >> $BLD/include/percgi/config/gettext_libs.h
echo "hdefs[\"GETTEXT_LIBS\"] = \"$GETTEXT_LIBS\"" >>configure.lua
else
$ECHO_N "checking whether -lintl requires -liconv..."
$ECHO_N "checking whether -lintl requires -liconv..." >> config.log
if [ "" != "" ]; then
if [ -e "/include/iconv.h" ]; then
GETTEXT_CFLAGS="${GETTEXT_CFLAGS} -I/include"
GETTEXT_LIBS="${GETTEXT_LIBS} -L/lib -liconv"
fi;
else
if [ -e "/include/iconv.h" ]; then
GETTEXT_CFLAGS="${GETTEXT_CFLAGS} -I/include"
GETTEXT_LIBS="${GETTEXT_LIBS} -L/lib -liconv"
fi;
if [ -e "/usr/include/iconv.h" ]; then
GETTEXT_CFLAGS="${GETTEXT_CFLAGS} -I/usr/include"
GETTEXT_LIBS="${GETTEXT_LIBS} -L/usr/lib -liconv"
fi;
if [ -e "/usr/local/include/iconv.h" ]; then
GETTEXT_CFLAGS="${GETTEXT_CFLAGS} -I/usr/local/include"
GETTEXT_LIBS="${GETTEXT_LIBS} -L/usr/local/lib -liconv"
fi;
if [ -e "/opt/include/iconv.h" ]; then
GETTEXT_CFLAGS="${GETTEXT_CFLAGS} -I/opt/include"
GETTEXT_LIBS="${GETTEXT_LIBS} -L/opt/lib -liconv"
fi;
if [ -e "/opt/local/include/iconv.h" ]; then
GETTEXT_CFLAGS="${GETTEXT_CFLAGS} -I/opt/local/include"
GETTEXT_LIBS="${GETTEXT_LIBS} -L/opt/local/lib -liconv"
fi;
if [ -e "/usr/pkg/include/iconv.h" ]; then
GETTEXT_CFLAGS="${GETTEXT_CFLAGS} -I/usr/pkg/include"
GETTEXT_LIBS="${GETTEXT_LIBS} -L/usr/pkg/lib -liconv"
fi;
fi;
MK_COMPILE_STATUS="OK"
cat << EOT > conftest.c
#include
int main(int argc, char *argv[])
{
char *s;
bindtextdomain("foo", "/foo");
textdomain("foo");
s = gettext("string");
s = dgettext("foo","string");
return (s != NULL);
}
EOT
echo "$CC $CFLAGS $TEST_CFLAGS ${GETTEXT_CFLAGS} -o $testdir/conftest conftest.c ${GETTEXT_LIBS}" >>config.log
$CC $CFLAGS $TEST_CFLAGS ${GETTEXT_CFLAGS} -o $testdir/conftest conftest.c ${GETTEXT_LIBS} 2>>config.log
if [ $? != 0 ]; then
echo "-> failed ($?)" >> config.log
MK_COMPILE_STATUS="FAIL($?)"
fi
if [ "${MK_COMPILE_STATUS}" = "OK" ]; then
echo "yes"
echo "yes" >> config.log
HAVE_GETTEXT="yes"
echo "#ifndef HAVE_GETTEXT" > $BLD/include/percgi/config/have_gettext.h
echo "#define HAVE_GETTEXT \"$HAVE_GETTEXT\"" >> $BLD/include/percgi/config/have_gettext.h
echo "#endif" >> $BLD/include/percgi/config/have_gettext.h
echo "hdefs[\"HAVE_GETTEXT\"] = \"$HAVE_GETTEXT\"" >>configure.lua
else
echo "no"
echo "no" >> config.log
HAVE_GETTEXT="no"
echo "#undef HAVE_GETTEXT" >$BLD/include/percgi/config/have_gettext.h
echo "hdefs[\"HAVE_GETTEXT\"] = nil" >>configure.lua
fi;
rm -f conftest.c $testdir/conftest$EXECSUFFIX
if [ "${HAVE_GETTEXT}" = "yes" ]; then
echo "#ifndef GETTEXT_CFLAGS" > $BLD/include/percgi/config/gettext_cflags.h
echo "#define GETTEXT_CFLAGS \"$GETTEXT_CFLAGS\"" >> $BLD/include/percgi/config/gettext_cflags.h
echo "#endif" >> $BLD/include/percgi/config/gettext_cflags.h
echo "hdefs[\"GETTEXT_CFLAGS\"] = \"$GETTEXT_CFLAGS\"" >>configure.lua
echo "#ifndef GETTEXT_LIBS" > $BLD/include/percgi/config/gettext_libs.h
echo "#define GETTEXT_LIBS \"$GETTEXT_LIBS\"" >> $BLD/include/percgi/config/gettext_libs.h
echo "#endif" >> $BLD/include/percgi/config/gettext_libs.h
echo "hdefs[\"GETTEXT_LIBS\"] = \"$GETTEXT_LIBS\"" >>configure.lua
else
echo "#undef GETTEXT_CFLAGS" >$BLD/include/percgi/config/gettext_cflags.h
echo "hdefs[\"GETTEXT_CFLAGS\"] = nil" >>configure.lua
GETTEXT_CFLAGS=""
echo "#undef GETTEXT_LIBS" >$BLD/include/percgi/config/gettext_libs.h
echo "hdefs[\"GETTEXT_LIBS\"] = nil" >>configure.lua
GETTEXT_LIBS=""
fi;
fi;
else
echo "#undef GETTEXT_CFLAGS" >$BLD/include/percgi/config/gettext_cflags.h
echo "hdefs[\"GETTEXT_CFLAGS\"] = nil" >>configure.lua
echo "#undef GETTEXT_LIBS" >$BLD/include/percgi/config/gettext_libs.h
echo "hdefs[\"GETTEXT_LIBS\"] = nil" >>configure.lua
fi;
if [ "${HAVE_GETTEXT}" = "yes" ]
then
ENABLE_NLS="yes"
ENABLE_NLS="yes"
echo "#ifndef ENABLE_NLS" > $BLD/include/percgi/config/enable_nls.h
echo "#define ENABLE_NLS \"$ENABLE_NLS\"" >> $BLD/include/percgi/config/enable_nls.h
echo "#endif" >> $BLD/include/percgi/config/enable_nls.h
echo "hdefs[\"ENABLE_NLS\"] = \"$ENABLE_NLS\"" >>configure.lua
else
ENABLE_NLS="no"
echo "#undef ENABLE_NLS" >$BLD/include/percgi/config/enable_nls.h
echo "hdefs[\"ENABLE_NLS\"] = nil" >>configure.lua
fi
if [ "${enable_debug}" = "yes" ]
then
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
fi
if [ "${enable_warnings}" = "yes" ]
then
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CXXFLAGS -Wall"
CFLAGS="$CFLAGS -Werror"
CXXFLAGS="$CXXFLAGS -Werror"
CFLAGS="$CFLAGS -Wmissing-prototypes"
CXXFLAGS="$CXXFLAGS -Wmissing-prototypes"
CFLAGS="$CFLAGS -Wno-unused"
CXXFLAGS="$CXXFLAGS -Wno-unused"
fi
if [ "${HAVE_FASTCGI}" != "yes" ]
then
if [ "${with_fastcgi}" != "no" ]
then
echo "*"
echo "* FastCGI library (http://fastcgi.com) not found!"
echo "* If you really want to compile PerCGI without FastCGI"
echo "* support, please use ./configure --without-fastcgi"
echo "*"
exit 1
fi
fi
if [ "${with_charsets}" != "" ]
then
CHARSET_LIST="${with_charsets}"
else
CHARSET_LIST="utf-8,iso-8859-1"
fi
WITH_CHARSETS="${CHARSET_LIST}"
WITH_CHARSETS="${CHARSET_LIST}"
echo "#ifndef WITH_CHARSETS" > $BLD/include/percgi/config/with_charsets.h
echo "#define WITH_CHARSETS \"$WITH_CHARSETS\"" >> $BLD/include/percgi/config/with_charsets.h
echo "#endif" >> $BLD/include/percgi/config/with_charsets.h
echo "hdefs[\"WITH_CHARSETS\"] = \"$WITH_CHARSETS\"" >>configure.lua
if [ ! -e "$BLD/include/percgi" ]; then
mkdir -p "$BLD/include/percgi"
fi
if [ "${includes}" = "link" ]; then
$ECHO_N "* Linking C include files..."
if [ "${SRCDIR}" != "${BLDDIR}" ]; then
(cd ${SRCDIR} && ${PERL} mk/gen-includelinks.pl "${SRCDIR}" "$BLD/include/percgi" 1>>${BLDDIR}/config.log 2>&1)
else
${PERL} mk/gen-includelinks.pl "${SRCDIR}" "$BLD/include/percgi" 1>>config.log 2>&1
fi
if [ $? != 0 ]; then
echo "${PERL} mk/gen-includelinks.pl failed"
exit 1
fi
echo "done"
else
if [ "${PERL}" = "" ]; then
echo "*"
echo "* The --includes=yes option requires perl, but no perl"
echo "* interpreter was found. If perl is unavailable, please"
echo "* please rerun configure with --includes=link instead."
echo "*"
exit 1
fi
$ECHO_N "* Preprocessing C include files..."
if [ "${SRCDIR}" != "${BLDDIR}" ]; then
(cd ${SRCDIR} && ${PERL} mk/gen-includes.pl "$BLD/include/percgi" 1>>${BLDDIR}/config.log 2>&1)
else
${PERL} mk/gen-includes.pl "$BLD/include/percgi" 1>>config.log 2>&1
fi
if [ $? != 0 ]; then
echo "${PERL} mk/gen-includes.pl failed"
exit 1
fi
echo "done"
fi
CFLAGS="$CFLAGS -I$BLD/include"
CXXFLAGS="$CXXFLAGS -I$BLD/include"
CFLAGS="$CFLAGS -I$BLD/include/percgi"
CXXFLAGS="$CXXFLAGS -I$BLD/include/percgi"
config_script_out="percgi-config"
config_script_cflags="-I${INCLDIR} ${FASTCGI_CFLAGS} ${GETTEXT_CFLAGS} -D_GNU_SOURCE"
config_script_libs="-L${LIBDIR} -lpercgi ${FASTCGI_LIBS} ${GETTEXT_LIBS}"
# Avoid breakage with existing trees compiled before BSDBuild 2.8.
if [ -d "$config_script_out" ]; then
echo "rm -fR $config_script_out"
rm -fR $config_script_out
fi
if [ "${SRC}" != "" ]; then
if [ -d "${SRC}/$config_script_out" ]; then
echo "rm -fR ${SRC}/$config_script_out"
rm -fR ${SRC}/$config_script_out
fi
fi
cat << EOT > $config_script_out
#!/bin/sh
# Generated for ${PACKAGE} by BSDBuild 3.2.
#
prefix="${PREFIX}"
exec_prefix="${EXEC_PREFIX}"
exec_prefix_set="no"
libdir="${LIBDIR}"
usage="\
Usage: $config_script_out [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
if test \$# -eq 0; then
echo "\${usage}" 1>&2
exit 1
fi
while test \$# -gt 0; do
case "\$1" in
-*=*)
optarg=\`echo "\$1" | LC_ALL="C" sed 's/[-_a-zA-Z0-9]*=//'\`
;;
*)
optarg=
;;
esac
case \$1 in
--prefix=*)
prefix=\$optarg
if test \$exec_prefix_set = no ; then
exec_prefix=\$optarg
fi
;;
--prefix)
echo "\$prefix"
;;
--exec-prefix=*)
exec_prefix=\$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo "\$exec_prefix"
;;
--version)
echo "${VERSION}"
;;
--cflags)
echo "$config_script_cflags"
;;
--libs | --static-libs)
echo "$config_script_libs"
;;
*)
echo "\${usage}" 1>&2
exit 1
;;
esac
shift
done
EOT
echo "*"
echo "* Configuration successful."
echo "* Use \"make depend all install\" to build and install PerCGI."
echo "*"
echo "WITH_CHARSETS=$WITH_CHARSETS" >>Makefile.config
echo "mdefs[\"WITH_CHARSETS\"] = \"$WITH_CHARSETS\"" >>configure.lua
echo "ENABLE_NLS=$ENABLE_NLS" >>Makefile.config
echo "mdefs[\"ENABLE_NLS\"] = \"$ENABLE_NLS\"" >>configure.lua
echo "EXECSUFFIX=$EXECSUFFIX" >>Makefile.config
echo "mdefs[\"EXECSUFFIX\"] = \"$EXECSUFFIX\"" >>configure.lua
echo "DATADIR=$DATADIR" >>Makefile.config
echo "mdefs[\"DATADIR\"] = \"$DATADIR\"" >>configure.lua
echo "LIBTOOLOPTS_SHARED=$LIBTOOLOPTS_SHARED" >>Makefile.config
echo "mdefs[\"LIBTOOLOPTS_SHARED\"] = \"$LIBTOOLOPTS_SHARED\"" >>configure.lua
echo "HAVE___INT64=$HAVE___INT64" >>Makefile.config
echo "mdefs[\"HAVE___INT64\"] = \"$HAVE___INT64\"" >>configure.lua
echo "HAVE_LD_STATIC_LIBGCC=$HAVE_LD_STATIC_LIBGCC" >>Makefile.config
echo "mdefs[\"HAVE_LD_STATIC_LIBGCC\"] = \"$HAVE_LD_STATIC_LIBGCC\"" >>configure.lua
echo "STATEDIR=$STATEDIR" >>Makefile.config
echo "mdefs[\"STATEDIR\"] = \"$STATEDIR\"" >>configure.lua
echo "HAVE_SYSEXITS_H=$HAVE_SYSEXITS_H" >>Makefile.config
echo "mdefs[\"HAVE_SYSEXITS_H\"] = \"$HAVE_SYSEXITS_H\"" >>configure.lua
echo "LOCALEDIR=$LOCALEDIR" >>Makefile.config
echo "mdefs[\"LOCALEDIR\"] = \"$LOCALEDIR\"" >>configure.lua
echo "HAVE_NONNULL_ATTRIBUTE=$HAVE_NONNULL_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_NONNULL_ATTRIBUTE\"] = \"$HAVE_NONNULL_ATTRIBUTE\"" >>configure.lua
echo "HAVE_CC_WARNINGS=$HAVE_CC_WARNINGS" >>Makefile.config
echo "mdefs[\"HAVE_CC_WARNINGS\"] = \"$HAVE_CC_WARNINGS\"" >>configure.lua
echo "CXXFLAGS=$CXXFLAGS" >>Makefile.config
echo "mdefs[\"CXXFLAGS\"] = \"$CXXFLAGS\"" >>configure.lua
echo "HAVE_SYS_UIO_H=$HAVE_SYS_UIO_H" >>Makefile.config
echo "mdefs[\"HAVE_SYS_UIO_H\"] = \"$HAVE_SYS_UIO_H\"" >>configure.lua
echo "HAVE_CYGWIN=$HAVE_CYGWIN" >>Makefile.config
echo "mdefs[\"HAVE_CYGWIN\"] = \"$HAVE_CYGWIN\"" >>configure.lua
echo "INCLDIR=$INCLDIR" >>Makefile.config
echo "mdefs[\"INCLDIR\"] = \"$INCLDIR\"" >>configure.lua
echo "CC=$CC" >>Makefile.config
echo "mdefs[\"CC\"] = \"$CC\"" >>configure.lua
echo "HAVE_UNUSED_VARIABLE_ATTRIBUTE=$HAVE_UNUSED_VARIABLE_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_UNUSED_VARIABLE_ATTRIBUTE\"] = \"$HAVE_UNUSED_VARIABLE_ATTRIBUTE\"" >>configure.lua
echo "HAVE_FASTCGI=$HAVE_FASTCGI" >>Makefile.config
echo "mdefs[\"HAVE_FASTCGI\"] = \"$HAVE_FASTCGI\"" >>configure.lua
echo "SYSCONFDIR=$SYSCONFDIR" >>Makefile.config
echo "mdefs[\"SYSCONFDIR\"] = \"$SYSCONFDIR\"" >>configure.lua
echo "HAVE_VASPRINTF=$HAVE_VASPRINTF" >>Makefile.config
echo "mdefs[\"HAVE_VASPRINTF\"] = \"$HAVE_VASPRINTF\"" >>configure.lua
echo "HAVE_GETTEXT=$HAVE_GETTEXT" >>Makefile.config
echo "mdefs[\"HAVE_GETTEXT\"] = \"$HAVE_GETTEXT\"" >>configure.lua
echo "FASTCGI_LIBS=$FASTCGI_LIBS" >>Makefile.config
echo "mdefs[\"FASTCGI_LIBS\"] = \"$FASTCGI_LIBS\"" >>configure.lua
echo "HAVE_CC_MWINDOWS=$HAVE_CC_MWINDOWS" >>Makefile.config
echo "mdefs[\"HAVE_CC_MWINDOWS\"] = \"$HAVE_CC_MWINDOWS\"" >>configure.lua
echo "FASTCGI_CFLAGS=$FASTCGI_CFLAGS" >>Makefile.config
echo "mdefs[\"FASTCGI_CFLAGS\"] = \"$FASTCGI_CFLAGS\"" >>configure.lua
echo "MANDIR=$MANDIR" >>Makefile.config
echo "mdefs[\"MANDIR\"] = \"$MANDIR\"" >>configure.lua
echo "HAVE_LD_NO_UNDEFINED=$HAVE_LD_NO_UNDEFINED" >>Makefile.config
echo "mdefs[\"HAVE_LD_NO_UNDEFINED\"] = \"$HAVE_LD_NO_UNDEFINED\"" >>configure.lua
echo "HAVE_CC_MCONSOLE=$HAVE_CC_MCONSOLE" >>Makefile.config
echo "mdefs[\"HAVE_CC_MCONSOLE\"] = \"$HAVE_CC_MCONSOLE\"" >>configure.lua
echo "HAVE_BOUNDED_ATTRIBUTE=$HAVE_BOUNDED_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_BOUNDED_ATTRIBUTE\"] = \"$HAVE_BOUNDED_ATTRIBUTE\"" >>configure.lua
echo "HAVE_SYS_PARAM_H=$HAVE_SYS_PARAM_H" >>Makefile.config
echo "mdefs[\"HAVE_SYS_PARAM_H\"] = \"$HAVE_SYS_PARAM_H\"" >>configure.lua
echo "HAVE_PACKED_ATTRIBUTE=$HAVE_PACKED_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_PACKED_ATTRIBUTE\"] = \"$HAVE_PACKED_ATTRIBUTE\"" >>configure.lua
echo "LIBDIR=$LIBDIR" >>Makefile.config
echo "mdefs[\"LIBDIR\"] = \"$LIBDIR\"" >>configure.lua
echo "CFLAGS=$CFLAGS" >>Makefile.config
echo "mdefs[\"CFLAGS\"] = \"$CFLAGS\"" >>configure.lua
echo "HAVE_FORMAT_ATTRIBUTE=$HAVE_FORMAT_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_FORMAT_ATTRIBUTE\"] = \"$HAVE_FORMAT_ATTRIBUTE\"" >>configure.lua
echo "HAVE_DEPRECATED_ATTRIBUTE=$HAVE_DEPRECATED_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_DEPRECATED_ATTRIBUTE\"] = \"$HAVE_DEPRECATED_ATTRIBUTE\"" >>configure.lua
echo "HAVE_ALIGNED_ATTRIBUTE=$HAVE_ALIGNED_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_ALIGNED_ATTRIBUTE\"] = \"$HAVE_ALIGNED_ATTRIBUTE\"" >>configure.lua
echo "PROG_CLI_FLAGS=$PROG_CLI_FLAGS" >>Makefile.config
echo "mdefs[\"PROG_CLI_FLAGS\"] = \"$PROG_CLI_FLAGS\"" >>configure.lua
echo "PACKAGE=$PACKAGE" >>Makefile.config
echo "mdefs[\"PACKAGE\"] = \"$PACKAGE\"" >>configure.lua
echo "VERSION=$VERSION" >>Makefile.config
echo "mdefs[\"VERSION\"] = \"$VERSION\"" >>configure.lua
echo "PROG_GUI_FLAGS=$PROG_GUI_FLAGS" >>Makefile.config
echo "mdefs[\"PROG_GUI_FLAGS\"] = \"$PROG_GUI_FLAGS\"" >>configure.lua
echo "LIBEXECDIR=$LIBEXECDIR" >>Makefile.config
echo "mdefs[\"LIBEXECDIR\"] = \"$LIBEXECDIR\"" >>configure.lua
echo "HAVE_WARN_UNUSED_RESULT_ATTRIBUTE=$HAVE_WARN_UNUSED_RESULT_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_WARN_UNUSED_RESULT_ATTRIBUTE\"] = \"$HAVE_WARN_UNUSED_RESULT_ATTRIBUTE\"" >>configure.lua
echo "GETTEXT_LIBS=$GETTEXT_LIBS" >>Makefile.config
echo "mdefs[\"GETTEXT_LIBS\"] = \"$GETTEXT_LIBS\"" >>configure.lua
echo "GETTEXT_CFLAGS=$GETTEXT_CFLAGS" >>Makefile.config
echo "mdefs[\"GETTEXT_CFLAGS\"] = \"$GETTEXT_CFLAGS\"" >>configure.lua
echo "HAVE_CONST_ATTRIBUTE=$HAVE_CONST_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_CONST_ATTRIBUTE\"] = \"$HAVE_CONST_ATTRIBUTE\"" >>configure.lua
echo "BINDIR=$BINDIR" >>Makefile.config
echo "mdefs[\"BINDIR\"] = \"$BINDIR\"" >>configure.lua
echo "HAVE_ASPRINTF=$HAVE_ASPRINTF" >>Makefile.config
echo "mdefs[\"HAVE_ASPRINTF\"] = \"$HAVE_ASPRINTF\"" >>configure.lua
echo "_MK_HAVE_SYS_TYPES_H=$_MK_HAVE_SYS_TYPES_H" >>Makefile.config
echo "mdefs[\"_MK_HAVE_SYS_TYPES_H\"] = \"$_MK_HAVE_SYS_TYPES_H\"" >>configure.lua
echo "HAVE_NORETURN_ATTRIBUTE=$HAVE_NORETURN_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_NORETURN_ATTRIBUTE\"] = \"$HAVE_NORETURN_ATTRIBUTE\"" >>configure.lua
echo "HAVE_INT64_T=$HAVE_INT64_T" >>Makefile.config
echo "mdefs[\"HAVE_INT64_T\"] = \"$HAVE_INT64_T\"" >>configure.lua
echo "RELEASE=$RELEASE" >>Makefile.config
echo "mdefs[\"RELEASE\"] = \"$RELEASE\"" >>configure.lua
echo "HAVE_PURE_ATTRIBUTE=$HAVE_PURE_ATTRIBUTE" >>Makefile.config
echo "mdefs[\"HAVE_PURE_ATTRIBUTE\"] = \"$HAVE_PURE_ATTRIBUTE\"" >>configure.lua
echo "MODULEDIR=$MODULEDIR" >>Makefile.config
echo "mdefs[\"MODULEDIR\"] = \"$MODULEDIR\"" >>configure.lua
if [ "${srcdir}" != "" ]; then
$ECHO_N "* Source is in ${srcdir}. Generating Makefiles..."
${PERL} ${SRC}/mk/mkconcurrent.pl ${SRC}
if [ $? != 0 ]; then
exit 1;
fi
echo "done"
fi
echo "*"
echo "* Configuration successful. Use \"make depend all\" to compile,"
echo "* and \"make install\" to install this software under $PREFIX."
echo "*"