]> git.pond.sub.org Git - empserver/blob - configure.ac
New info Hvy-Plastic
[empserver] / configure.ac
1 #
2 #   Empire - A multi-player, client/server Internet based war game.
3 #   Copyright (C) 1986-2010, 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 files README, COPYING and CREDITS in the root of the source
23 #   tree for related information and legal notices.  It is expected
24 #   that future 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-2009
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([Wolfpack Empire], [4.3.24], [wolfpack@wolfpackempire.com], [empire])
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 AC_ARG_VAR(NROFF, [nroff command])
58 AC_CHECK_PROG(NROFF, groff, [GROFF_NO_SGR= groff -Tascii -U], nroff)
59
60 # not really a check for a program, but close enough
61 if test -d $srcdir/.git; then revctrl=git
62 else revctrl=
63 fi
64 AC_SUBST(revctrl,$revctrl)
65
66 # Not a program, but need to check this early
67 MY_WINDOWS_API
68
69
70 ### Checks for libraries
71 ACX_PTHREAD
72 LIBS_util="$LIBS"
73 LIBS="$LIBS_SOCKETS $LIBS"
74 LIB_SOCKET_NSL
75 LIBS_server="$LIBS"
76
77
78 ### Checks for header files
79
80
81 ### Checks for typedefs, structures, and compiler characteristics
82
83 AC_C_CHAR_UNSIGNED
84
85
86 ### Checks for library functions
87
88 AC_CHECK_FUNCS(getaddrinfo getpass)
89 MY_FUNC_MAKECONTEXT
90
91
92 ### Site configuration
93
94 # Can't be bothered to make MAXNOC configurable right now.
95 AC_DEFINE([MAXNOC], [99],
96           [The maximum number of countries])
97
98 AC_ARG_VAR([EMPIREHOST], [Default host (client only) [127.0.0.1]])
99 test "$EMPIREHOST" || EMPIREHOST=127.0.0.1
100
101 AC_ARG_VAR([EMPIREPORT], [Default port (client and server) [6665]])
102 test "$EMPIREPORT" || EMPIREPORT=6665
103
104 AC_ARG_WITH([pthread],
105             AS_HELP_STRING([--with-pthread],
106                            [use POSIX threads]))
107
108 # Select thread package
109 empthread=
110 if test "$with_pthread" != no; then
111     if test "$acx_pthread_ok" = yes; then
112         empthread=POSIX
113     fi
114 fi
115 if test -z "$with_pthread" || test "$with_pthread" = no; then
116     if test "$ac_cv_func_makecontext" = yes; then
117         empthread=LWP
118     fi
119     if test $Windows_API = yes; then
120         empthread=Windows
121     fi
122 fi
123 if test -z "$empthread"; then
124     AC_MSG_ERROR([No usable thread package found])
125 fi
126 AC_SUBST(empthread)
127 case $empthread in
128 LWP)    AC_DEFINE([EMPTH_LWP], 1, [Define to use LWP threads]) ;;
129 POSIX)  AC_DEFINE([EMPTH_POSIX], 1, [Define to use POSIX threads]) ;;
130 Windows) AC_DEFINE([EMPTH_W32], 1, [Define to use Windows threads]) ;;
131 esac
132
133 MY_WITH_TERMINFO
134 LIBS_client="$LIBS"
135
136
137 ### Output
138
139 LIBS="$LIBS_util"
140 AC_SUBST(LIBS_client)
141 AC_SUBST(LIBS_server)
142
143 AC_CONFIG_FILES([GNUmakefile])
144 AC_CONFIG_COMMANDS([stamp-h],
145         [case $revctrl in
146         git)
147             mkdir -p `cd $srcdir && git ls-files \
148                 | sed -n 's,/@<:@^/@:>@*$,,gp' | uniq`
149             ;;
150         *)
151             mkdir -p `sed s/.*=// <$srcdir/sources.mk | tr ' ' '\012' \
152                 | sed -n '/\//s,/@<:@^/@:>@*$,,gp'| uniq`
153         esac
154         mkdir -p info.html info.nr lib
155         touch stamp-h],
156         [revctrl=$revctrl])
157 AC_OUTPUT
158
159 AC_MSG_NOTICE([])
160 AC_MSG_NOTICE([-= Configuration summary =-])
161 AC_MSG_NOTICE([Thread package: $empthread])
162 AC_MSG_NOTICE([      terminfo: $with_terminfo])
163 AC_MSG_NOTICE([    EMPIREHOST: $EMPIREHOST])
164 AC_MSG_NOTICE([    EMPIREPORT: $EMPIREPORT])