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"`
32 [ -n "$MAKE" ] || MAKE="make"
35 while [ $# -gt 0 ]; do
44 echo "Usage: $NAME [-v] [-x]"
46 echo " -v Verbose output"
47 echo " -x Don't regenerate build system, even when possible"
54 echo "$NAME: Checking ngIRCd base source directory ..."
55 grep "ngIRCd" ./ChangeLog >/dev/null 2>&1
57 grep "ngIRCd" ../ChangeLog >/dev/null 2>&1
59 echo "$NAME: ngIRCd base source directory not found!?"
65 echo "$NAME: Checking for GIT tree ..."
67 echo "$NAME: Checking for \"git\" command ..."
68 git version >/dev/null 2>&1
69 if [ $? -eq 0 -a -n "$CLEAN" ]; then
70 echo "$NAME: Running \"git clean\" ..."
71 [ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null
75 echo "$NAME: Checking for \"./configure\" script ..."
76 if [ ! -r ./configure ]; then
77 echo "$NAME: Running \"./autogen.sh\" ..."
78 [ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
81 if [ -r ./configure ]; then
82 echo "$NAME: Running \"./configure\" script ..."
83 [ -n "$VERBOSE" ] && ./configure || ./configure >/dev/null
84 if [ $? -eq 0 -a -r ./Makefile ]; then
86 echo "$NAME: Running \"$MAKE\" ..."
87 [ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null
88 if [ $? -eq 0 -a -x src/ngircd/ngircd ]; then
90 echo "$NAME: Running \"$MAKE check\" ..."
91 [ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null
96 ./src/ngircd/ngircd --help 2>/dev/null \
97 | grep "^ngIRCd" >/dev/null
98 [ $? -eq 0 ] && R_RUN=1
104 # Get target platform information
105 if [ -r "src/config.h" ]; then
106 CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2`
107 OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2`
108 VENDOR=`grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2`
109 PLATFORM="$CPU/$VENDOR/$OS"
111 if [ -z "$PLATFORM" ]; then
112 PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`"
115 # Get compiler information
116 if [ -r "Makefile" ]; then
117 CC=$(grep "^CC = " Makefile | cut -d' ' -f3)
118 $CC --version 2>&1 | grep -i "GCC" >/dev/null
119 if [ $? -eq 0 ]; then
120 # GCC, or compiler that mimics GCC
121 $CC --version 2>&1 | grep -i "Open64" >/dev/null
122 if [ $? -eq 0 ]; then
125 COMPILER=$($CC --version | head -1 \
126 | cut -d')' -f2 | cut -d' ' -f2)
127 COMPILER="gcc $COMPILER"
131 $CC --version 2>&1 | grep -i "clang" >/dev/null
132 if [ $? -eq 0 ]; then
133 COMPILER=$($CC --version 2>/dev/null | head -1 \
134 | cut -d'(' -f1 | cut -d'-' -f1 \
135 | sed -e 's/version //g' | sed -e 's/Apple /A-/g' \
136 | sed -e 's/Debian //g' | sed -e 's/LLVM /clang /g')
138 $CC -version 2>&1 | grep -i "tcc" >/dev/null
139 if [ $? -eq 0 ]; then
140 COMPILER=$($CC -version 2>/dev/null | head -1 \
141 | cut -d'(' -f1 | sed -e 's/version //g')
143 if [ "$COMPILER" = "unknown" ]; then
144 v="`$CC --version 2>/dev/null | head -1`"
145 [ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`"
146 [ -n "$v" ] && COMPILER="$v"
151 # Get ngIRCd version information
152 eval $(grep "^VERSION = " Makefile | sed -e 's/ //g')
155 VERSION=`echo "$VERSION" | cut -b1-10`
158 [ -n "$VERSION" ] || VERSION="unknown"
160 # Get IO interface information
161 if [ "$OS" = "linux-gnu" ]; then
164 grep "^#define HAVE_SYS_DEVPOLL_H 1" src/config.h >/dev/null 2>&1
165 [ $? -eq 0 ] && COMMENT="4"
166 grep "^#define HAVE_EPOLL_CREATE 1" src/config.h >/dev/null 2>&1
167 [ $? -eq 0 ] && COMMENT="5"
168 grep "^#define HAVE_KQUEUE 1" src/config.h >/dev/null 2>&1
169 [ $? -eq 0 ] && COMMENT="3"
172 [ -n "$R_CONFIGURE" ] && C="Y" || C="N"
173 [ -n "$R_MAKE" ] && M="Y" || M="N"
174 [ -n "$R_CHECK" ] && T="Y" || T="N"
175 [ -n "$R_RUN" ] && R="Y" || R="N"
176 [ -n "$COMMENT" ] && COMMENT=" $COMMENT"
179 echo " the executable works (\"runs\") as expected --+"
180 echo " tests run successfully (\"make check\") --+ |"
181 echo " ngIRCd compiles (\"make\") --+ | |"
182 echo " ./configure works --+ | | |"
184 echo "Platform Compiler ngIRCd Date Tester C M T R *"
185 echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
186 type printf >/dev/null 2>&1
187 if [ $? -eq 0 ]; then
188 printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s" \
189 "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \
190 "$C" "$M" "$T" "$R" "$COMMENT"
192 echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \
193 "$C" "$M" "$T" "$R" "$COMMENT"