3 # ngIRCd -- The Next Generation IRC Daemon
4 # Copyright (c)2001-2016 Alexander Barton (alex@barton.de) and Contributors
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
13 # This script analyzes the build process of ngIRCd and generates output
14 # suitable for inclusion in doc/Platforms.txt -- please send reports
15 # to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>.
24 DATE=`date "+%y-%m-%d"`
36 [ -n "$MAKE" ] || MAKE="make"
39 while [ $# -gt 0 ]; do
48 echo "Usage: $NAME [-v] [-x]"
50 echo " -v Verbose output"
51 echo " -x Don't regenerate build system, even when possible"
58 for cmd in telnet expect; do
59 command -v "$cmd" >/dev/null 2>&1 \
60 || echo "$NAME: WARNING: $cmd(1) not found, \"make check\" won't run all tests!"
63 echo "$NAME: Checking ngIRCd base source directory ..."
64 grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1
66 grep "ngIRCd" "$SRC_D/../ChangeLog" >/dev/null 2>&1
68 echo "$NAME: ngIRCd base source directory not found!?"
73 echo "$NAME: - source directory: $SRC_D"
74 echo "$NAME: - working directory: $MY_D"
76 echo "$NAME: Checking for GIT tree ..."
77 if [ -d "$SRC_D/.git" ]; then
78 echo "$NAME: Checking for \"git\" command ..."
79 git version >/dev/null 2>&1
80 if [ $? -eq 0 ] && [ -n "$CLEAN" ]; then
81 echo "$NAME: Running \"git clean\" ..."
83 [ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null
88 echo "$NAME: Checking for \"$SRC_D/configure\" script ..."
89 if [ ! -r "$SRC_D/configure" ]; then
90 echo "$NAME: Running \"$SRC_D/autogen.sh\" ..."
92 [ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
96 if [ -r "$SRC_D/configure" ]; then
97 echo "$NAME: Running \"$SRC_D/configure\" script ..."
98 [ -n "$VERBOSE" ] && "$SRC_D/configure" -C || "$SRC_D/configure" -C >/dev/null
99 if [ $? -eq 0 ] && [ -r ./Makefile ]; then
101 rm -f "src/ngircd/ngircd"
102 echo "$NAME: Running \"$MAKE\" ..."
103 [ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null
104 if [ $? -eq 0 ] && [ -x src/ngircd/ngircd ]; then
106 echo "$NAME: Running \"$MAKE check\" ..."
107 [ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null
108 if [ $? -eq 0 ]; then
111 [ -r ./src/testsuite/tests-skipped.lst ] \
112 && R_CHECK_Y="y" || R_CHECK_Y="Y"
114 ./src/ngircd/ngircd --help 2>/dev/null \
115 | grep "^ngIRCd" >/dev/null
116 [ $? -eq 0 ] && R_RUN=1
122 # Get target platform information
123 if [ -r "src/config.h" ]; then
124 CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2`
125 OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2`
126 VENDOR=`grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2`
127 PLATFORM="$CPU/$VENDOR/$OS"
129 if [ -z "$PLATFORM" ]; then
130 PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`"
133 # Get compiler information
134 if [ -r "Makefile" ]; then
135 CC=$(grep "^CC = " Makefile | cut -d' ' -f3)
136 $CC --version 2>&1 | grep -i "GCC" >/dev/null
137 if [ $? -eq 0 ]; then
138 # GCC, or compiler that mimics GCC
139 $CC --version 2>&1 | grep -i "Open64" >/dev/null
140 if [ $? -eq 0 ]; then
143 COMPILER=$($CC --version | head -1 \
144 | cut -d')' -f2 | cut -d' ' -f2)
145 COMPILER="gcc $COMPILER"
149 $CC --version 2>&1 | grep -i "clang" >/dev/null
150 if [ $? -eq 0 ]; then
151 COMPILER=$($CC --version 2>/dev/null | head -1 \
152 | cut -d'(' -f1 | cut -d'-' -f1 \
153 | sed -e 's/version //g' | sed -e 's/Apple /A-/g' \
154 | sed -e 's/Debian //g' | sed -e 's/LLVM /clang /g')
156 $CC -version 2>&1 | grep -i "tcc" >/dev/null
157 if [ $? -eq 0 ]; then
158 COMPILER=$($CC -version 2>/dev/null | head -1 \
159 | cut -d'(' -f1 | sed -e 's/version //g')
161 if [ "$COMPILER" = "unknown" ]; then
162 v="`$CC --version 2>/dev/null | head -1`"
163 [ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`"
164 [ -n "$v" ] && COMPILER="$v"
169 # Get ngIRCd version information
170 eval "$(grep "^VERSION = " Makefile | sed -e 's/ //g')"
173 VERSION=`echo "$VERSION" | cut -b1-10`
176 [ -n "$VERSION" ] || VERSION="unknown"
178 # Get IO interface information
179 if [ "$OS" = "linux-gnu" ]; then
182 grep "^#define HAVE_SYS_DEVPOLL_H 1" src/config.h >/dev/null 2>&1
183 [ $? -eq 0 ] && COMMENT="4"
184 grep "^#define HAVE_EPOLL_CREATE 1" src/config.h >/dev/null 2>&1
185 [ $? -eq 0 ] && COMMENT="5"
186 grep "^#define HAVE_KQUEUE 1" src/config.h >/dev/null 2>&1
187 [ $? -eq 0 ] && COMMENT="3"
190 [ -n "$R_CONFIGURE" ] && C="Y" || C="N"
191 [ -n "$R_MAKE" ] && M="Y" || M="N"
192 [ -n "$R_CHECK" ] && T="$R_CHECK_Y" || T="N"
193 if [ -n "$R_RUN" ]; then
194 # Mark "runs" with "Y" only when the test suite succeeded:
195 [ "$T" = "N" ] && R="?" || R="Y"
199 [ -n "$COMMENT" ] && COMMENT=" $COMMENT"
202 echo " the executable works (\"runs\") as expected --+"
203 echo " tests run successfully (\"make check\") --+ |"
204 echo " ngIRCd compiles (\"make\") --+ | |"
205 echo " ./configure works --+ | | |"
207 echo "Platform Compiler ngIRCd Date Tester C M T R *"
208 echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
209 command -v printf >/dev/null 2>&1
210 if [ $? -eq 0 ]; then
211 printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s\n" \
212 "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$LOGNAME" \
213 "$C" "$M" "$T" "$R" "$COMMENT"
215 echo "$PLATFORM $COMPILER $VERSION $DATE $LOGNAME" \
216 "$C" "$M" "$T" "$R" "$COMMENT"
221 echo "Please double check that the ngIRCd daemon starts up, runs and handles IRC"
222 echo "connections successfully!"
225 if [ "$R_CHECK_Y" = "y" ]; then
226 echo "WARNING: Some tests have been skipped!"
230 if [ "$R" = "?" ]; then
231 echo "WARNING: The resulting binary passed simple tests, but the test suite failed!"