3 # ngIRCd -- The Next Generation IRC Daemon
4 # Copyright (c)2001-2014 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"`
35 [ -n "$MAKE" ] || MAKE="make"
38 while [ $# -gt 0 ]; do
47 echo "Usage: $NAME [-v] [-x]"
49 echo " -v Verbose output"
50 echo " -x Don't regenerate build system, even when possible"
57 echo "$NAME: Checking ngIRCd base source directory ..."
58 grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1
60 grep "ngIRCd" "$SRC_D/../ChangeLog" >/dev/null 2>&1
62 echo "$NAME: ngIRCd base source directory not found!?"
67 echo "$NAME: - source directory: $SRC_D"
68 echo "$NAME: - working directory: $MY_D"
70 echo "$NAME: Checking for GIT tree ..."
71 if [ -d "$SRC_D/.git" ]; then
72 echo "$NAME: Checking for \"git\" command ..."
73 git version >/dev/null 2>&1
74 if [ $? -eq 0 -a -n "$CLEAN" ]; then
75 echo "$NAME: Running \"git clean\" ..."
77 [ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null
82 echo "$NAME: Checking for \"$SRC_D/configure\" script ..."
83 if [ ! -r "$SRC_D/configure" ]; then
84 echo "$NAME: Running \"$SRC_D/autogen.sh\" ..."
86 [ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
90 if [ -r "$SRC_D/configure" ]; then
91 echo "$NAME: Running \"$SRC_D/configure\" script ..."
92 [ -n "$VERBOSE" ] && "$SRC_D/configure" -C || "$SRC_D/configure" -C >/dev/null
93 if [ $? -eq 0 -a -r ./Makefile ]; then
95 echo "$NAME: Running \"$MAKE\" ..."
96 [ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null
97 if [ $? -eq 0 -a -x src/ngircd/ngircd ]; then
99 echo "$NAME: Running \"$MAKE check\" ..."
100 [ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null
101 if [ $? -eq 0 ]; then
105 ./src/ngircd/ngircd --help 2>/dev/null \
106 | grep "^ngIRCd" >/dev/null
107 [ $? -eq 0 ] && R_RUN=1
113 # Get target platform information
114 if [ -r "src/config.h" ]; then
115 CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2`
116 OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2`
117 VENDOR=`grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2`
118 PLATFORM="$CPU/$VENDOR/$OS"
120 if [ -z "$PLATFORM" ]; then
121 PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`"
124 # Get compiler information
125 if [ -r "Makefile" ]; then
126 CC=$(grep "^CC = " Makefile | cut -d' ' -f3)
127 $CC --version 2>&1 | grep -i "GCC" >/dev/null
128 if [ $? -eq 0 ]; then
129 # GCC, or compiler that mimics GCC
130 $CC --version 2>&1 | grep -i "Open64" >/dev/null
131 if [ $? -eq 0 ]; then
134 COMPILER=$($CC --version | head -1 \
135 | cut -d')' -f2 | cut -d' ' -f2)
136 COMPILER="gcc $COMPILER"
140 $CC --version 2>&1 | grep -i "clang" >/dev/null
141 if [ $? -eq 0 ]; then
142 COMPILER=$($CC --version 2>/dev/null | head -1 \
143 | cut -d'(' -f1 | cut -d'-' -f1 \
144 | sed -e 's/version //g' | sed -e 's/Apple /A-/g' \
145 | sed -e 's/Debian //g' | sed -e 's/LLVM /clang /g')
147 $CC -version 2>&1 | grep -i "tcc" >/dev/null
148 if [ $? -eq 0 ]; then
149 COMPILER=$($CC -version 2>/dev/null | head -1 \
150 | cut -d'(' -f1 | sed -e 's/version //g')
152 if [ "$COMPILER" = "unknown" ]; then
153 v="`$CC --version 2>/dev/null | head -1`"
154 [ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`"
155 [ -n "$v" ] && COMPILER="$v"
160 # Get ngIRCd version information
161 eval $(grep "^VERSION = " Makefile | sed -e 's/ //g')
164 VERSION=`echo "$VERSION" | cut -b1-10`
167 [ -n "$VERSION" ] || VERSION="unknown"
169 # Get IO interface information
170 if [ "$OS" = "linux-gnu" ]; then
173 grep "^#define HAVE_SYS_DEVPOLL_H 1" src/config.h >/dev/null 2>&1
174 [ $? -eq 0 ] && COMMENT="4"
175 grep "^#define HAVE_EPOLL_CREATE 1" src/config.h >/dev/null 2>&1
176 [ $? -eq 0 ] && COMMENT="5"
177 grep "^#define HAVE_KQUEUE 1" src/config.h >/dev/null 2>&1
178 [ $? -eq 0 ] && COMMENT="3"
181 [ -n "$R_CONFIGURE" ] && C="Y" || C="N"
182 [ -n "$R_MAKE" ] && M="Y" || M="N"
183 [ -n "$R_CHECK" ] && T="Y" || T="N"
184 [ -n "$R_RUN" ] && R="Y" || R="N"
185 [ -n "$COMMENT" ] && COMMENT=" $COMMENT"
188 echo " the executable works (\"runs\") as expected --+"
189 echo " tests run successfully (\"make check\") --+ |"
190 echo " ngIRCd compiles (\"make\") --+ | |"
191 echo " ./configure works --+ | | |"
193 echo "Platform Compiler ngIRCd Date Tester C M T R *"
194 echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
195 type printf >/dev/null 2>&1
196 if [ $? -eq 0 ]; then
197 printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s" \
198 "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \
199 "$C" "$M" "$T" "$R" "$COMMENT"
201 echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \
202 "$C" "$M" "$T" "$R" "$COMMENT"