]> git.pond.sub.org Git - empserver/blob - configure.ac
(EMPTH_LWP, EMPTH_POSIX, EMPTH_W32): Define in config.h instead of
[empserver] / configure.ac
1
2 #   Empire - A multi-player, client/server Internet based war game.
3 #   Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 #                            Ken Stevens, Steve McClure
5
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
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.
15
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20 #   ---
21
22 #   See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 #   related information and legal notices. It is expected that any future
24 #   projects/authors will amend these files as needed.
25
26 #   ---
27
28 #   configure.ac: Autoconf input file
29 #  
30 #   Known contributors to this file:
31 #      Markus Armbruster, 2005
32
33 # Process this file with autoconf to produce a configure script.
34
35 # Autoconf makes checking for and programming around assorted ancient
36 # crap relatively painless.  But why bother?  Just rely on C89 and
37 # POSIX, and when something breaks on some oddball machine, see
38 # whether it's worth fixing.
39
40 AC_PREREQ(2.59)
41 AC_INIT([Empire], [4.3.0], [wolfpack@wolfpackempire.com])
42 AC_CONFIG_SRCDIR([include/combat.h])
43 AC_CONFIG_MACRO_DIR([m4])
44 AC_CONFIG_HEADERS([config.h])
45
46
47 ### Checks for programs
48 AC_PROG_AWK
49 AC_PROG_INSTALL
50 AC_PROG_RANLIB
51 AC_PROG_CC
52 AC_SUBST(GCC)
53 AM_PROG_CC_C_O
54 # Private automake macro, tsk, tsk, tsk...
55 _AM_DEPENDENCIES(CC)
56
57 # not really a check for a program, but close enough
58 if test -d $srcdir/CVS; then cvs_controlled=yes; else cvs_controlled=no; fi
59 AC_SUBST(cvs_controlled,$cvs_controlled)
60
61
62 ### Checks for libraries
63 ACX_PTHREAD
64 LIB_SOCKET_NSL
65
66 # TODO turn this into a macro?
67 save_LIBS=$LIBS
68 AC_SEARCH_LIBS([setupterm], [termlib termcap])
69 termlibs=`echo $LIBS | sed s/\`echo $save_LIBS | sed 's/././g'\`'$//'`
70 AC_SUBST(termlibs)
71 LIBS=$save_LIBS
72
73
74 ### Checks for header files
75
76
77 ### Checks for typedefs, structures, and compiler characteristics
78
79
80 ### Checks for library functions
81
82 MY_FUNC_MAKECONTEXT
83
84
85 ### Site configuration
86
87 # Can't be bothered to make MAXNOC configurable right now.
88 AC_DEFINE([MAXNOC], [99],
89           [The maximum number of countries])
90
91 AC_ARG_VAR([EMPIREHOST], [Default host (client only) [127.0.0.1]])
92 test "$EMPIREHOST" || EMPIREHOST=127.0.0.1
93
94 AC_ARG_VAR([EMPIREPORT], [Default port (client and server) [6665]])
95 test "$EMPIREPORT" || EMPIREPORT=6665
96
97 AC_ARG_WITH([pthread],
98             AS_HELP_STRING([--with-pthread],
99                            [use POSIX threads]))
100
101 # Select thread package
102 # TODO Windows
103 case "$ac_cv_func_makecontext$acx_pthread_ok" in
104 yesyes)
105     if test -z "$with_pthread" || test "$with_pthread" = no; then
106         empthread=LWP
107     else
108         empthread=POSIX
109     fi
110     ;;
111 yes*)
112     empthread=LWP ;;
113 *yes)
114     empthread=POSIX ;;
115 *)
116     AC_MSG_ERROR([No usable thread package found])
117 esac
118 AC_SUBST(empthread)
119 AC_MSG_NOTICE([Using $empthread threads])
120 case $empthread in
121 LWP)    AC_DEFINE([EMPTH_LWP], 1, [Define to use LWP threads]) ;;
122 POSIX)  AC_DEFINE([EMPTH_POSIX], 1, [Define to use POSIX threads]) ;;
123 Windows) AC_DEFINE([EMPTH_W32], 1, [Define to use Windows threads]) ;;
124 esac
125
126 op=
127 if test "$with_pthread" = no; then
128     op='=='
129 elif test "$with_pthread"; then
130     op='!='
131 fi
132 if test "$op" && test "$empthread" $op POSIX; then
133     AC_MSG_WARN([Ignoring --with-pthread=$with_pthread])
134 fi
135
136
137 ### Output
138
139 AC_CONFIG_FILES([GNUmakefile])
140 AC_CONFIG_COMMANDS([stamp-h],
141         [if test $cvs_controlled = yes; then
142             mkdir -p `cd $srcdir && $AWK -f src/scripts/cvsfiles.awk \
143                 | sed -n '/\//s,/@<:@^/@:>@*$,,gp'| uniq`
144         elif test -f $srcdir/sources.mk; then
145             mkdir -p `sed s/.*=// <$srcdir/sources.mk \
146                 | sed -n '/\//s,/@<:@^/@:>@*$,,gp'| uniq`
147         fi
148         >stamp-h],
149         [cvs_controlled=$cvs_controlled; AWK=$AWK])
150 AC_OUTPUT