2009-08-04 22:30:59 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# ngIRCd -- The Next Generation IRC Daemon
|
2016-01-06 15:47:31 +01:00
|
|
|
# Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors
|
2009-08-04 22:30:59 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
# Please read the file COPYING, README and AUTHORS for more information.
|
|
|
|
#
|
|
|
|
|
|
|
|
# This script analyzes the build process of ngIRCd and generates output
|
|
|
|
# suitable for inclusion in doc/Platforms.txt -- please send reports
|
|
|
|
# to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>.
|
|
|
|
|
|
|
|
NAME=`basename "$0"`
|
|
|
|
VERBOSE=
|
2014-01-11 01:27:12 +01:00
|
|
|
CLEAN=1
|
2009-08-04 22:30:59 +02:00
|
|
|
|
|
|
|
PLATFORM=
|
|
|
|
COMPILER="unknown"
|
|
|
|
VERSION="unknown"
|
|
|
|
DATE=`date "+%y-%m-%d"`
|
|
|
|
COMMENT=
|
|
|
|
|
2012-04-28 00:58:23 +02:00
|
|
|
R_CONFIGURE=
|
|
|
|
R_MAKE=
|
|
|
|
R_CHECK=
|
2014-06-04 12:15:23 +02:00
|
|
|
R_CHECK_Y="?"
|
2012-04-28 00:58:23 +02:00
|
|
|
R_RUN=
|
|
|
|
|
2014-01-11 01:33:24 +01:00
|
|
|
SRC_D=`dirname "$0"`
|
|
|
|
MY_D="$PWD"
|
|
|
|
|
2012-04-28 00:58:23 +02:00
|
|
|
[ -n "$MAKE" ] || MAKE="make"
|
|
|
|
export MAKE CC
|
|
|
|
|
2009-08-04 22:30:59 +02:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
"-v")
|
|
|
|
VERBOSE=1
|
|
|
|
;;
|
2014-01-11 01:27:12 +01:00
|
|
|
"-x")
|
|
|
|
CLEAN=
|
|
|
|
;;
|
2009-08-04 22:30:59 +02:00
|
|
|
*)
|
2014-01-11 01:27:12 +01:00
|
|
|
echo "Usage: $NAME [-v] [-x]"
|
|
|
|
echo
|
|
|
|
echo " -v Verbose output"
|
|
|
|
echo " -x Don't regenerate build system, even when possible"
|
|
|
|
echo
|
2009-08-04 22:30:59 +02:00
|
|
|
exit 2
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2015-12-19 17:27:27 +01:00
|
|
|
for cmd in telnet expect; do
|
|
|
|
command -v "$cmd" >/dev/null 2>&1 \
|
|
|
|
|| echo "$NAME: WARNING: $cmd(1) not found, \"make check\" won't run all tests!"
|
|
|
|
done
|
|
|
|
|
2009-08-04 22:30:59 +02:00
|
|
|
echo "$NAME: Checking ngIRCd base source directory ..."
|
2014-01-11 01:33:24 +01:00
|
|
|
grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1
|
2009-08-04 22:30:59 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
2014-01-11 01:33:24 +01:00
|
|
|
grep "ngIRCd" "$SRC_D/../ChangeLog" >/dev/null 2>&1
|
2009-08-04 22:30:59 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "$NAME: ngIRCd base source directory not found!?"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-01-11 01:33:24 +01:00
|
|
|
SRC_D="$SRC_D/.."
|
2009-08-04 22:30:59 +02:00
|
|
|
fi
|
2014-01-11 01:33:24 +01:00
|
|
|
echo "$NAME: - source directory: $SRC_D"
|
|
|
|
echo "$NAME: - working directory: $MY_D"
|
2009-08-04 22:30:59 +02:00
|
|
|
|
2013-10-14 23:47:07 +02:00
|
|
|
echo "$NAME: Checking for GIT tree ..."
|
2014-01-11 01:33:24 +01:00
|
|
|
if [ -d "$SRC_D/.git" ]; then
|
2013-10-14 23:47:07 +02:00
|
|
|
echo "$NAME: Checking for \"git\" command ..."
|
|
|
|
git version >/dev/null 2>&1
|
2015-12-19 17:27:03 +01:00
|
|
|
if [ $? -eq 0 ] && [ -n "$CLEAN" ]; then
|
2013-10-14 23:47:07 +02:00
|
|
|
echo "$NAME: Running \"git clean\" ..."
|
2014-01-11 01:33:24 +01:00
|
|
|
cd "$SRC_D" || exit 1
|
2013-10-14 23:47:07 +02:00
|
|
|
[ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null
|
2014-01-11 01:33:24 +01:00
|
|
|
cd "$MY_D" || exit 1
|
2013-10-14 23:47:07 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-01-11 01:33:24 +01:00
|
|
|
echo "$NAME: Checking for \"$SRC_D/configure\" script ..."
|
|
|
|
if [ ! -r "$SRC_D/configure" ]; then
|
|
|
|
echo "$NAME: Running \"$SRC_D/autogen.sh\" ..."
|
|
|
|
cd "$SRC_D" || exit 1
|
2009-08-04 22:30:59 +02:00
|
|
|
[ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
|
2014-01-11 01:33:24 +01:00
|
|
|
cd "$MY_D" || exit 1
|
2009-08-04 22:30:59 +02:00
|
|
|
fi
|
|
|
|
|
2014-01-11 01:33:24 +01:00
|
|
|
if [ -r "$SRC_D/configure" ]; then
|
|
|
|
echo "$NAME: Running \"$SRC_D/configure\" script ..."
|
|
|
|
[ -n "$VERBOSE" ] && "$SRC_D/configure" -C || "$SRC_D/configure" -C >/dev/null
|
2015-12-19 17:27:03 +01:00
|
|
|
if [ $? -eq 0 ] && [ -r ./Makefile ]; then
|
2012-04-28 00:58:23 +02:00
|
|
|
R_CONFIGURE=1
|
|
|
|
echo "$NAME: Running \"$MAKE\" ..."
|
|
|
|
[ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null
|
2015-12-19 17:27:03 +01:00
|
|
|
if [ $? -eq 0 ] && [ -x src/ngircd/ngircd ]; then
|
2012-04-28 00:58:23 +02:00
|
|
|
R_MAKE=1
|
|
|
|
echo "$NAME: Running \"$MAKE check\" ..."
|
|
|
|
[ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null
|
2009-08-04 22:30:59 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-04-28 00:58:23 +02:00
|
|
|
R_CHECK=1
|
|
|
|
R_RUN=$R_CHECK
|
2014-06-04 12:15:23 +02:00
|
|
|
[ -r ./src/testsuite/tests-skipped.lst ] \
|
|
|
|
&& R_CHECK_Y="y" || R_CHECK_Y="Y"
|
2009-08-04 22:30:59 +02:00
|
|
|
else
|
|
|
|
./src/ngircd/ngircd --help 2>/dev/null \
|
2012-11-13 22:42:49 +01:00
|
|
|
| grep "^ngIRCd" >/dev/null
|
2012-04-28 00:58:23 +02:00
|
|
|
[ $? -eq 0 ] && R_RUN=1
|
2009-08-04 22:30:59 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get target platform information
|
|
|
|
if [ -r "src/config.h" ]; then
|
2012-11-13 22:42:49 +01:00
|
|
|
CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2`
|
|
|
|
OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2`
|
|
|
|
VENDOR=`grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2`
|
2009-08-04 22:30:59 +02:00
|
|
|
PLATFORM="$CPU/$VENDOR/$OS"
|
|
|
|
fi
|
|
|
|
if [ -z "$PLATFORM" ]; then
|
|
|
|
PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get compiler information
|
|
|
|
if [ -r "Makefile" ]; then
|
2010-10-25 18:49:54 +02:00
|
|
|
CC=$(grep "^CC = " Makefile | cut -d' ' -f3)
|
2009-08-04 22:30:59 +02:00
|
|
|
$CC --version 2>&1 | grep -i "GCC" >/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
2013-10-16 21:59:23 +02:00
|
|
|
# GCC, or compiler that mimics GCC
|
2012-04-24 12:08:01 +02:00
|
|
|
$CC --version 2>&1 | grep -i "Open64" >/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
COMPILER="Open64"
|
|
|
|
else
|
|
|
|
COMPILER=$($CC --version | head -1 \
|
|
|
|
| cut -d')' -f2 | cut -d' ' -f2)
|
|
|
|
COMPILER="gcc $COMPILER"
|
|
|
|
fi
|
2010-10-26 22:18:30 +02:00
|
|
|
else
|
2013-10-16 21:59:23 +02:00
|
|
|
# Non-GCC compiler
|
2013-10-20 15:25:19 +02:00
|
|
|
$CC --version 2>&1 | grep -i "clang" >/dev/null
|
2013-10-14 23:45:59 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
COMPILER=$($CC --version 2>/dev/null | head -1 \
|
2013-10-20 15:25:19 +02:00
|
|
|
| cut -d'(' -f1 | cut -d'-' -f1 \
|
|
|
|
| sed -e 's/version //g' | sed -e 's/Apple /A-/g' \
|
|
|
|
| sed -e 's/Debian //g' | sed -e 's/LLVM /clang /g')
|
2013-10-14 23:45:59 +02:00
|
|
|
fi
|
2013-10-16 21:59:23 +02:00
|
|
|
$CC -version 2>&1 | grep -i "tcc" >/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
COMPILER=$($CC -version 2>/dev/null | head -1 \
|
|
|
|
| cut -d'(' -f1 | sed -e 's/version //g')
|
|
|
|
fi
|
2013-10-14 23:45:59 +02:00
|
|
|
if [ "$COMPILER" = "unknown" ]; then
|
2010-10-26 22:18:30 +02:00
|
|
|
v="`$CC --version 2>/dev/null | head -1`"
|
2013-10-16 21:59:23 +02:00
|
|
|
[ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`"
|
2013-10-14 23:45:59 +02:00
|
|
|
[ -n "$v" ] && COMPILER="$v"
|
|
|
|
fi
|
2009-08-04 22:30:59 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get ngIRCd version information
|
2015-08-27 00:12:50 +02:00
|
|
|
eval "$(grep "^VERSION = " Makefile | sed -e 's/ //g')"
|
2010-10-25 18:49:54 +02:00
|
|
|
case "$VERSION" in
|
2014-01-11 01:32:12 +01:00
|
|
|
*~*-*)
|
|
|
|
VERSION=`echo "$VERSION" | cut -b1-10`
|
2010-10-25 18:49:54 +02:00
|
|
|
;;
|
|
|
|
esac
|
2009-08-04 22:30:59 +02:00
|
|
|
[ -n "$VERSION" ] || VERSION="unknown"
|
|
|
|
|
|
|
|
# Get IO interface information
|
|
|
|
if [ "$OS" = "linux-gnu" ]; then
|
2013-10-22 14:15:34 +02:00
|
|
|
COMMENT="1"
|
2009-08-04 22:30:59 +02:00
|
|
|
else
|
|
|
|
grep "^#define HAVE_SYS_DEVPOLL_H 1" src/config.h >/dev/null 2>&1
|
2013-10-22 14:15:34 +02:00
|
|
|
[ $? -eq 0 ] && COMMENT="4"
|
2009-08-04 22:30:59 +02:00
|
|
|
grep "^#define HAVE_EPOLL_CREATE 1" src/config.h >/dev/null 2>&1
|
2013-10-22 14:15:34 +02:00
|
|
|
[ $? -eq 0 ] && COMMENT="5"
|
2009-08-04 22:30:59 +02:00
|
|
|
grep "^#define HAVE_KQUEUE 1" src/config.h >/dev/null 2>&1
|
2013-10-22 14:15:34 +02:00
|
|
|
[ $? -eq 0 ] && COMMENT="3"
|
2009-08-04 22:30:59 +02:00
|
|
|
fi
|
|
|
|
|
2012-04-28 00:58:23 +02:00
|
|
|
[ -n "$R_CONFIGURE" ] && C="Y" || C="N"
|
|
|
|
[ -n "$R_MAKE" ] && M="Y" || M="N"
|
2014-06-04 12:15:23 +02:00
|
|
|
[ -n "$R_CHECK" ] && T="$R_CHECK_Y" || T="N"
|
2012-04-28 00:58:23 +02:00
|
|
|
[ -n "$R_RUN" ] && R="Y" || R="N"
|
2009-08-04 22:30:59 +02:00
|
|
|
[ -n "$COMMENT" ] && COMMENT=" $COMMENT"
|
|
|
|
|
|
|
|
echo
|
2013-10-22 14:15:34 +02:00
|
|
|
echo " the executable works (\"runs\") as expected --+"
|
|
|
|
echo " tests run successfully (\"make check\") --+ |"
|
|
|
|
echo " ngIRCd compiles (\"make\") --+ | |"
|
|
|
|
echo " ./configure works --+ | | |"
|
|
|
|
echo " | | | |"
|
|
|
|
echo "Platform Compiler ngIRCd Date Tester C M T R *"
|
|
|
|
echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
|
2015-12-19 17:27:03 +01:00
|
|
|
command -v printf >/dev/null 2>&1
|
2010-10-26 22:18:30 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
2014-06-04 12:15:23 +02:00
|
|
|
printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s\n" \
|
2016-01-06 15:47:31 +01:00
|
|
|
"$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$LOGNAME" \
|
2010-10-26 22:18:30 +02:00
|
|
|
"$C" "$M" "$T" "$R" "$COMMENT"
|
|
|
|
else
|
2016-01-06 15:47:31 +01:00
|
|
|
echo "$PLATFORM $COMPILER $VERSION $DATE $LOGNAME" \
|
2010-10-26 22:18:30 +02:00
|
|
|
"$C" "$M" "$T" "$R" "$COMMENT"
|
|
|
|
fi
|
2014-06-04 12:15:23 +02:00
|
|
|
echo
|
|
|
|
if [ "$R_CHECK_Y" = "y" ]; then
|
2015-12-19 17:27:27 +01:00
|
|
|
echo "$NAME: WARNING: Some tests have been skipped!"
|
2014-06-04 12:15:23 +02:00
|
|
|
echo
|
|
|
|
fi
|