: # # Netris -- A free networked version of T*tris # Copyright (C) 1994-1996,1999 Mark H. Weaver # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # CC="gcc" COPT="-O" CEXTRA="-m486" LEXTRA="" CURSES_HACK=false while [ $# -ge 1 ]; do opt="$1" shift case "$opt" in -g) COPT="-g -O0" # CEXTRA="-Wall -Wstrict-prototypes -m486" ;; -O*) COPT="$opt" CEXTRA="-DNDEBUG" ;; --cc) CC="$1" shift ;; --copt) COPT="$1" shift ;; --cextra) CEXTRA="$1" shift ;; --lextra) LEXTRA="$1" shift ;; --curses-hack) CURSES_HACK=true ;; --lang) lang="$1" shift ;; *) cat << "END" Usage: ./configure [options...] -g: Full debugging, no optimization, and full warnings -O?: Optimization, no debugging or warnings --cc : Set the C compiler to use (default "gcc") --copt : Set C optimization flags --cextra : Set extra C flags --lextra : Set extra linker flags --curses-hack: Disable scroll-optimization for broken curses --lang : Preferred interface language (default "en") END exit 1 ;; esac done CFLAGS="$COPT $CEXTRA" echo "Checking for libraries" echo 'main(){}' > test.c LFLAGS="" for lib in -lcurses -lncurses; do if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then LFLAGS="$lib" fi done for lib in -lsocket -lnsl -ltermcap; do if $CC $CFLAGS $LEXTRA test.c $lib > /dev/null 2>&1; then LFLAGS="$LFLAGS $lib" fi done echo "Checking for on_exit()" cat << END > test.c void handler(void) {} main() { on_exit(handler, (void *)0); } END if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then HAS_ON_EXIT=true else HAS_ON_EXIT=false fi echo "Checking for sigprocmask()" cat << END > test.c #include main() { sigset_t set; sigprocmask(SIG_BLOCK, &set, &set); } END if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then HAS_SIGPROCMASK=true else HAS_SIGPROCMASK=false fi echo "Checking for getopt.h" cat << END > test.c #include main(){} END if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then HAS_GETOPT_H=true else HAS_GETOPT_H=false fi echo "Checking for memory.h" cat << END > test.c #include main(){} END if $CC $CFLAGS $LEXTRA test.c > /dev/null 2>&1; then HAS_MEMORY_H=true else HAS_MEMORY_H=false fi rm -f test.c test.o a.out test -z "$lang" && lang=en MSG_FILE=msg.$lang.h if [ ! -f $MSG_FILE ]; then echo "Error: $MSG_FILE not found" exit fi echo "Creating config.mak" cat > config.mak << END ### Automatically generated by ./configure ### CC = $CC COPT = $COPT CEXTRA = $CEXTRA LEXTRA = $LEXTRA LFLAGS = $LEXTRA $LFLAGS CFLAGS = \$(CEXTRA) \$(COPT) MSG_FILE = $MSG_FILE END echo "Creating config.h" cat << END > config.h /*** Automatically generated by ./configure ***/ END if [ "$HAS_GETOPT_H" = "true" ]; then echo "#include " >> config.h else echo "extern char *optarg;" >> config.h echo "extern int optind;" >> config.h fi if [ "$HAS_MEMORY_H" = "true" ]; then echo "#include " >> config.h fi if [ "$HAS_ON_EXIT" = "true" ]; then echo "#define HAS_ON_EXIT" >> config.h fi if [ "$HAS_SIGPROCMASK" = "true" ]; then echo "#define HAS_SIGPROCMASK" >> config.h fi if [ "$CURSES_HACK" = "true" ]; then echo "#define CURSES_HACK" >> config.h fi cat << END Now do a 'make' END