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"
64 Usage: ./configure [options...]
65 -g: Full debugging, no optimization, and full warnings
66 -O?: Optimization, no debugging or warnings
67 --cc <compiler>: Set the C compiler to use (default "gcc")
68 --copt <opt>: Set C optimization flags
69 --cextra <opt>: Set extra C flags
70 --lextra <opt>: Set extra linker flags
71 --curses-hack: Disable scroll-optimization for broken curses
72 --lang <code>: Preferred interface language (default "en")
79 CFLAGS="$COPT $CEXTRA"
81 echo "Checking for libraries"
82 echo 'main(){}' > test.c
84 for lib in -lcurses -lncurses; do
85 if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then
89 for lib in -lsocket -lnsl -ltermcap; do
90 if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then
95 echo "Checking for on_exit()"
98 main() { on_exit(handler, (void *)0); }
100 if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then
106 echo "Checking for sigprocmask()"
109 main() { sigset_t set; sigprocmask(SIG_BLOCK, &set, &set); }
111 if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then
114 HAS_SIGPROCMASK=false
117 echo "Checking for getopt.h"
123 if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then
129 echo "Checking for memory.h"
135 if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then
141 rm -f test.c test.o a.out
143 test -z "$lang" && lang=en
145 if [ ! -f $MSG_FILE ]; then
146 echo "Error: $MSG_FILE not found"
150 echo "Creating config.mak"
151 cat > config.mak << END
152 ### Automatically generated by ./configure ###
158 LFLAGS = $LEXTRA $LFLAGS
159 CFLAGS = \$(CEXTRA) \$(COPT)
163 echo "Creating config.h"
164 cat << END > config.h
165 /*** Automatically generated by ./configure ***/
169 if [ "$HAS_GETOPT_H" = "true" ]; then
170 echo "#include <getopt.h>" >> config.h
172 echo "extern char *optarg;" >> config.h
173 echo "extern int optind;" >> config.h
175 if [ "$HAS_MEMORY_H" = "true" ]; then
176 echo "#include <memory.h>" >> config.h
178 if [ "$HAS_ON_EXIT" = "true" ]; then
179 echo "#define HAS_ON_EXIT" >> config.h
181 if [ "$HAS_SIGPROCMASK" = "true" ]; then
182 echo "#define HAS_SIGPROCMASK" >> config.h
184 if [ "$CURSES_HACK" = "true" ]; then
185 echo "#define CURSES_HACK" >> config.h