3 # Netris -- A free networked version of T*tris
4 # Copyright (C) 1994-1996,1999 Mark H. Weaver <mhw@netris.org>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 while [ $# -ge 1 ]; do
33 # CEXTRA="-Wall -Wstrict-prototypes -m486"
60 Usage: ./Configure [options...]
61 -g: Full debugging, no optimization, and full warnings
62 -O?: Optimization, no debugging or warnings
63 --cc <compiler>: Set the C compiler to use (default "gcc")
64 --copt <opt>: Set C optimization flags
65 --cextra <opt>: Set extra C flags
66 --lextra <opt>: Set extra linker flags
67 --curses-hack: Disable scroll-optimization for broken curses
74 CFLAGS="$COPT $CEXTRA"
76 echo "Checking for libraries"
77 echo 'main(){}' > test.c
79 for lib in -lcurses -lncurses; do
80 if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then
84 for lib in -lsocket -lnsl -ltermcap; do
85 if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then
90 echo "Checking for on_exit()"
93 main() { on_exit(handler, (void *)0); }
95 if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then
101 echo "Checking for sigprocmask()"
104 main() { sigset_t set; sigprocmask(SIG_BLOCK, &set, &set); }
106 if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then
109 HAS_SIGPROCMASK=false
112 echo "Checking for getopt.h"
118 if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then
124 echo "Checking for memory.h"
130 if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then
136 rm -f test.c test.o a.out
138 echo "Creating config.mak"
139 cat > config.mak << END
140 ### Automatically generated by ./Configure ###
146 LFLAGS = $LEXTRA $LFLAGS
147 CFLAGS = \$(CEXTRA) \$(COPT)
150 echo "Creating config.h"
151 cat << END > config.h
152 /*** Automatically generated by ./Configure ***/
156 if [ "$HAS_GETOPT_H" = "true" ]; then
157 echo "#include <getopt.h>" >> config.h
159 echo "extern char *optarg;" >> config.h
160 echo "extern int optind;" >> config.h
162 if [ "$HAS_MEMORY_H" = "true" ]; then
163 echo "#include <memory.h>" >> config.h
165 if [ "$HAS_ON_EXIT" = "true" ]; then
166 echo "#define HAS_ON_EXIT" >> config.h
168 if [ "$HAS_SIGPROCMASK" = "true" ]; then
169 echo "#define HAS_SIGPROCMASK" >> config.h
171 if [ "$CURSES_HACK" = "true" ]; then
172 echo "#define CURSES_HACK" >> config.h