File: configure.in

package info (click to toggle)
freeciv 1.9.0-2.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 11,004 kB
  • ctags: 6,284
  • sloc: ansic: 65,037; makefile: 634; sh: 418; sed: 93
file content (356 lines) | stat: -rw-r--r-- 11,246 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
dnl configure.in for freeciv
dnl Process this file with autoconf to produce a configure script.

dnl Initialize with some random file to ensure the source is here.
AC_INIT(common/game.c)
AM_CONFIG_HEADER(config.h)

dnl May not be quite correct, but autoconf version 2.9 is reported 
dnl not to work, and version 2.12 is known to work:
AC_PREREQ(2.12)

PACKAGE=freeciv

dnl client/server should always have the same major and minor versions
dnl different patch versions are compatible
MAJOR_VERSION=1
MINOR_VERSION=9
PATCH_VERSION=0
VERSION_LABEL=""
IS_BETA_VERSION=0

VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${VERSION_LABEL}

dnl Similar to following are already done by AM_INIT_AUTOMAKE:
dnl (but different in terms of producing quoted vs bare strings)
dnl  AC_DEFINE_UNQUOTED(PACKAGE, $PACKAGE)
dnl  AC_DEFINE_UNQUOTED(VERSION, $VERSION)
dnl  AC_SUBST(VERSION)

AC_DEFINE_UNQUOTED(MAJOR_VERSION, $MAJOR_VERSION)
AC_DEFINE_UNQUOTED(MINOR_VERSION, $MINOR_VERSION)
AC_DEFINE_UNQUOTED(PATCH_VERSION, $PATCH_VERSION)
AC_DEFINE_UNQUOTED(VERSION_LABEL, "${VERSION_LABEL}")
AC_DEFINE_UNQUOTED(VERSION_STRING, "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${VERSION_LABEL}")
AC_DEFINE_UNQUOTED(IS_BETA_VERSION, $IS_BETA_VERSION)

dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)

AM_MAINTAINER_MODE

dnl Evaluate options. Example:
AC_ARG_ENABLE(debug,
 	[  --enable-debug=[no/minimum/yes] 
 	                  turn on debugging [default=minimum]],,
	enable_debug=minimum
)

if test "x$enable_debug" = "xyes"; then
  test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
  CPPFLAGS="$CPPFLAGS -DDEBUG"
else
  if test "x$enable_debug" = "xno"; then
    CPPFLAGS="$CPPFLAGS -DNDEBUG"
  fi
fi

AC_ARG_WITH(xaw3d,
 	[  --with-xaw3d            use the Xaw3d widget set ],
	WITH_XAW3D=1
)
AC_ARG_WITH(xaw,
	[  --with-xaw              use the Xaw widget set],
	WITH_XAW=1
)

AC_ARG_WITH(efence,
	[  --with-efence           use Electric Fence, malloc debugger ],
	WITH_EFENCE=1
)

AC_ARG_ENABLE(client,
[  --disable-client        do not compile the client],
[case "${enableval}" in
  yes) client=true ;;
  no)  client=false ;;
  *)   AC_MSG_ERROR(bad value ${enableval} for --disable-client) ;;
esac], [client=true])
AM_CONDITIONAL(CLIENT, test x$client = xtrue)

AC_ARG_ENABLE(server,
[  --disable-server        do not compile the server],
[case "${enableval}" in
  yes) server=true ;;
  no)  server=false ;;
  *)   AC_MSG_ERROR(bad value ${enableval} for --disable-server) ;;
esac], [server=true])
AM_CONDITIONAL(SERVER, test x$server = xtrue)

AC_ARG_ENABLE(make_data,
[  --disable-make-data     do not recurse make into data directories
                          (ok to disable unless you will 'make install')],
[case "${enableval}" in
  yes) make_data=true ;;
  no)  make_data=false ;;
  *)   AC_MSG_ERROR(bad value ${enableval} for --disable-make-data) ;;
esac], [make_data=true])
AM_CONDITIONAL(MAKE_DATA, test x$make_data = xtrue)

AC_ARG_ENABLE(make_include,
[  --enable-make-include   force make to recurse into include directory
                          (useful for 'make tags')],
[case "${enableval}" in
  yes) make_include=true ;;
  no)  make_include=false ;;
  *)   AC_MSG_ERROR(bad value ${enableval} for --enable-make-include) ;;
esac], [make_include=false])
AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test "$make_include" = "true")

AC_ARG_ENABLE(cvs_deps,
 	[  --disable-cvs-deps      remove cvs-source deps calcs, which require gmake,gcc],,
	enable_cvs_deps="maybe"
)
CVS_DEPS=$enable_cvs_deps
AC_SUBST(CVS_DEPS)

dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_RANLIB

AC_ARG_PROGRAM

dnl Programs already checked by AM_INIT_AUTOMAKE:
dnl  AC_PROG_MAKE_SET

dnl I18n support
ALL_LINGUAS="de es fr hu pl pt pt_BR"
AM_GNU_GETTEXT

dnl DATADIRNAME is generated by AM_GNU_GETTEXT; 
dnl note this has to match the path installed by po/Makefile
FC_EXPAND_DIR(LOCALEDIR, '${prefix}/${DATADIRNAME}/locale')
AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR")

if test -n "$GCC"; then
   CFLAGS="$CFLAGS -Wall"
fi

if test "$CVS_DEPS" = "maybe"; then
   dnl Should also check for gmake?
   if test -n "$GCC"; then
      CVS_DEPS="yes"
   else
      CVS_DEPS="no"
   fi
fi

if test x$client = xtrue; then
  if test "x$WITH_XAW3D" = "x" && test "x$WITH_XAW" = "x"; then
    AM_PATH_GTK(1.2.1, gtk_found="yes", gtk_found="", imlib_found="")
    if test "x$gtk_found" = "xyes"; then
      AM_PATH_GDK_IMLIB(1.9.2, imlib_found="yes", imlib_found="")
    fi
  fi
    
  if test "x$imlib_found" = "xyes"; then
    CLIENT_CFLAGS="$GDK_IMLIB_CFLAGS"
    CLIENT_LIBS="$GDK_IMLIB_LIBS"
    gui_sources="gui-gtk"
  else
    dnl Checks for X:
    AC_PATH_XTRA

    dnl Determine the Xfuncproto control definitions:
    FC_CHECK_X_PROTO_DEFINE(FUNCPROTO)
    if test -n "$fc_x_proto_value"; then
      AC_DEFINE_UNQUOTED(FUNCPROTO, $fc_x_proto_value)
    fi
    FC_CHECK_X_PROTO_DEFINE(NARROWPROTO)
    if test -n "$fc_x_proto_value"; then
      AC_DEFINE_UNQUOTED(NARROWPROTO, $fc_x_proto_value)
    fi

    dnl Try to get additional Xpm paths:
    FC_XPM_PATHS

    if test "$xpm_incdir" != "no"; then
        X_CFLAGS="$X_CFLAGS -I$xpm_incdir"
    fi
    if test "$xpm_libdir" != "no"; then
        X_LIBS="$X_LIBS -L$xpm_libdir"
	dnl Try using R values set in AC_PATH_XTRA:
        if test "$ac_R_nospace" = "yes"; then
            X_LIBS="$X_LIBS -R$xpm_libdir"
        elif test "$ac_R_space" = "yes"; then
            X_LIBS="$X_LIBS -R $xpm_libdir"
        fi
	dnl Some sites may put xpm.h in a directory whose parent isn't "X11"
	if test "x$xpm_h_no_x11" = "xyes"; then
	    AC_DEFINE(XPM_H_NO_X11)
	fi
    fi
    fc_save_X_LIBS="$X_LIBS"
    X_LIBS="$X_LIBS $X_PRE_LIBS"

    dnl Checks for X libs:
    FC_CHECK_X_LIB(X11, XOpenDisplay, , 
        AC_MSG_ERROR(Need X11 libraries and development headers; perhaps try/adjust --x-libraries))
    FC_CHECK_X_LIB(Xext, XShapeCombineMask)

    dnl Insert X_PRE_LIBS (eg -lSM -lICE) into X_EXTRA_LIBS here:
    X_EXTRA_LIBS="$X_PRE_LIBS $X_EXTRA_LIBS"
    X_LIBS="$fc_save_X_LIBS"

    FC_CHECK_X_LIB(Xt, main)
    FC_CHECK_X_LIB(Xmu, main)
    FC_CHECK_X_LIB(Xpm, XpmReadFileToPixmap, , 
        AC_MSG_ERROR(Need Xpm library and development headers; perhaps try/adjust --with-xpm-lib))

    dnl Xaw or Xaw3d:
    dnl If we specified Xaw or Xaw3d explicitly, check and require that.
    dnl Else: Check Xaw3d first, in case Xaw is linked there.
    dnl       If didn't find Xaw3d, check Xaw, and complain if neither.
    if test -n "$WITH_XAW3D"; then
	FC_CHECK_X_LIB(Xaw3d, main, , AC_MSG_ERROR(Did not find Xaw3d library))
    elif test -n "$WITH_XAW"; then
	FC_CHECK_X_LIB(Xaw, main, , AC_MSG_ERROR(Did not find Xaw library))
    else
	FC_CHECK_X_LIB(Xaw3d, main, ,[NO_XAW3D=1])
        if test -n "$NO_XAW3D"; then
	    FC_CHECK_X_LIB(Xaw, main, , 
               AC_MSG_ERROR(Did not find either Xaw or Xaw3d library))
        fi
    fi

    dnl Don't do following because don't want server to link with X:
    dnl LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS"
    CLIENT_CFLAGS="$X_CFLAGS"
    CLIENT_LIBS="$X_LIBS $X_EXTRA_LIBS"
    gui_sources="gui-xaw"
  fi
fi
AC_SUBST(gui_sources)
AC_SUBST(CLIENT_CFLAGS)
AC_SUBST(CLIENT_LIBS)
AM_CONDITIONAL(CLIENT_GUI_GTK, test "$gui_sources" = "gui-gtk")

dnl Checks for non-X libraries:
if test x$server = xtrue; then
    dnl For the client, these libs (if required) should already be present
    dnl in X_EXTRA_LIBS, due to AC_PATH_XTRA, and we don't want to include 
    dnl them multiple times on the link line.
    dnl The use of AC_CHECK_FUNC is to avoid wrong libs on IRIX.
    AC_CHECK_FUNC(gethostbyname)
    if test $ac_cv_func_gethostbyname = no; then
        AC_CHECK_LIB(nsl, gethostbyname, SERVER_LIBS="-lnsl $SERVER_LIBS")
    fi
    AC_CHECK_FUNC(connect)
    if test $ac_cv_func_connect = no; then
        AC_CHECK_LIB(socket, connect, SERVER_LIBS="-lsocket $SERVER_LIBS")
    fi
fi
AC_SUBST(SERVER_LIBS)

AC_CHECK_LIB(nls,main)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(arpa/inet.h netdb.h netinet/in.h pwd.h sys/ioctl.h \
                 sys/select.h sys/signal.h sys/socket.h sys/termio.h \
		 sys/time.h sys/types.h sys/uio.h termios.h unistd.h)
if test x$client = xtrue; then
  dnl Want to get appropriate -I flags:
  fc_save_CPPFLAGS="$CPPFLAGS"
  if test "x$imlib_found" = "xyes"; then
    CPPFLAGS="$CPPFLAGS $GDK_IMLIB_CFLAGS"
  else
    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
    AC_CHECK_HEADER(X11/xpm.h, , 
        AC_MSG_ERROR(Need X11/xpm.h header; perhaps try/adjust --with-xpm-include))
  fi
  CPPFLAGS="$fc_save_CPPFLAGS"
fi

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(fdopen gethostname getpwuid gettimeofday select \
               snooze strerror strstr usleep)

dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated
dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS,
dnl and not in LIBS.

dnl Checks if SIGPIPE is usable
AC_MSG_CHECKING([for SIGPIPE])
AC_TRY_COMPILE([#include <signal.h>],[signal (SIGPIPE, SIG_IGN)],
               [AC_MSG_RESULT([yes])
                AC_DEFINE(HAVE_SIGPIPE)],
               [AC_MSG_RESULT([no])])

dnl export where the datadir is going to be installed
FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
AC_DEFINE_UNQUOTED(DEFAULT_DATA_PATH, ".:data:~/.freeciv:$FREECIV_DATADIR")

dnl This has to be last library
if test -n "$WITH_EFENCE"; then
  AC_CHECK_LIB(efence, malloc, [ 
  if test "x$LIBS" = "x"; then
    LIBS = -lefence
  else
    LIBS="$LIBS -lefence"
  fi])
fi

dnl Freeciv uses a non-standard macro, Q_(), to handle cases of qualified
dnl translatable strings.  Since the Gettext supplied Autoconf support
dnl doesn't seem to have a way to add new keywords to its xgettext call,
dnl we do the following.
dnl The Gettext supplied Autoconf support starts with 'po/Makefile.in.in',
dnl and builds 'po/Makefile.in' then 'po/Makefile'.  In order for the
dnl commonly used _() and N_() macros to work, there should be somewhere
dnl in that 'po/Makefile' a call to xgettext with "--keyword=_" and
dnl "--keyword=N_" as arguments.  To support Q_(), the following simply
dnl replaces instances of "--keyword=N_" with "--keyword=N_ --keyword=Q_"
dnl in the 'po/Makefile' file.
dnl
dnl (Left out for now due to minor problem.)
dnl
dnl AC_OUTPUT_COMMANDS(
dnl   [if test -f po/Makefile && ! grep -q -e '--keyword=N_ --keyword=Q_' po/Makefile; then
dnl     echo extending po/Makefile
dnl     mv -f po/Makefile po/Makefile.tmp
dnl     sed -e 's/--keyword=N_/--keyword=N_ --keyword=Q_/g' po/Makefile.tmp > po/Makefile
dnl     rm po/Makefile.tmp
dnl   fi])
dnl

AC_OUTPUT(Makefile
          data/Makefile 
	  data/misc/Makefile 
	  data/trident/Makefile 
	  data/engels/Makefile 
	  data/default/Makefile 
	  data/classic/Makefile 
	  data/civ1/Makefile 
	  data/civ2/Makefile 
	  data/scenario/Makefile 
	  common/Makefile 
	  ai/Makefile 
	  client/Makefile 
	  client/include/Makefile 
	  client/gui-gtk/Makefile 
	  client/gui-xaw/Makefile 
	  server/Makefile 
	  intl/Makefile
	  po/Makefile.in
	  undep.sh, [ chmod +x undep.sh ; ./undep.sh ])