Allow using things that were deprecated in gtk+-3.22.
[freeciv.git] / configure.ac
blob7839b2653c369be56315cfffc2c96f1a5f2b05a1
1 dnl configure.ac for freeciv
2 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([Freeciv], m4_esyscmd([./fc_version | tr -d '\n']),
5         [http://gna.org/projects/freeciv/],
6         [freeciv])
7 AC_PREREQ(2.61)
9 dnl Initialize with some random file to ensure the source is here.
10 AC_CONFIG_SRCDIR([common/game.c])
11 AC_CONFIG_AUX_DIR(bootstrap) # This can't be quoted or automake will fail
12 AC_CONFIG_MACRO_DIR([m4])
13 ifdef([AC_CONFIG_MACRO_DIRS],[AC_CONFIG_MACRO_DIRS([dependencies/m4])])
14 AC_CONFIG_HEADERS([gen_headers/fc_config.h gen_headers/freeciv_config.h])
15 AC_CANONICAL_HOST
16 AC_USE_SYSTEM_EXTENSIONS
17 AC_C_BIGENDIAN
19 BUG_URL="$PACKAGE_BUGREPORT"
20 WIKI_URL="http://www.freeciv.org/"
21 MAIL_ADDRESS="freeciv-dev AT gna.org"
23 AC_DEFINE(FC_CONFIG_H, 1, [Configuration autogenerated])
24 AC_DEFINE_UNQUOTED([BUG_URL], ["$BUG_URL"], [Bug reporting URL])
25 AC_DEFINE([FREECIV_META_URL], ["http://meta.freeciv.org/metaserver.php"], [Metaserver URL])
26 AC_DEFINE_UNQUOTED([WIKI_URL], ["$WIKI_URL"], [Informational URL])
28 AC_DEFINE(DEFAULT_SOCK_PORT, 5556, [Connection TCP Port])
30 AC_SUBST([BUG_URL])
31 AC_SUBST([WIKI_URL])
32 AC_SUBST([MAIL_ADDRESS])
34 dnl client/server should always have the same major and minor versions
35 dnl different patch versions are compatible
36 VERSION_SCRIPT_SILENT=yes
37 m4_include(fc_version)
39 AC_ARG_VAR([FREECIV_LABEL_FORCE], [Forced version label format])
41 VERSION_WITHOUT_LABEL=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EMERG_PART}
42 VERSION=${VERSION_WITHOUT_LABEL}${VERSION_LABEL}x
44 AC_DEFINE_UNQUOTED([MAJOR_VERSION], [$MAJOR_VERSION], [Major version])
45 AC_DEFINE_UNQUOTED([MINOR_VERSION], [$MINOR_VERSION], [Minor version])
46 AC_DEFINE_UNQUOTED([PATCH_VERSION], [$PATCH_VERSION], [Patch version])
47 if test x$EMERGENCY_VERSION != x ; then
48   AC_DEFINE_UNQUOTED([EMERGENCY_VERSION], [$EMERGENCY_VERSION], [Emergency version])
50 AC_DEFINE_UNQUOTED([VERSION_LABEL], ["${VERSION_LABEL}"], [Version label])
51 AC_DEFINE_UNQUOTED([VERSION_STRING], ["${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EMERG_PART}${VERSION_LABEL}"], [Version string])
52 AC_DEFINE_UNQUOTED([IS_DEVEL_VERSION], [$IS_DEVEL_VERSION], [Is this a devel version])
53 AC_DEFINE_UNQUOTED([IS_FREEZE_VERSION], [$IS_FREEZE_VERSION], [Is this a frozen version])
54 AC_DEFINE_UNQUOTED([IS_BETA_VERSION], [$IS_BETA_VERSION], [Is this a beta version])
55 AC_DEFINE_UNQUOTED([NEXT_STABLE_VERSION], ["$NEXT_STABLE_VERSION"], [Version number of next release])
56 AC_DEFINE_UNQUOTED([FREECIV_RELEASE_MONTH], [$RELEASE_MONTH], [Month next version will be released])
57 AC_SUBST([MAJOR_VERSION])
58 AC_SUBST([MINOR_VERSION])
60 AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_MANDATORY],
61                    ["$NETWORK_CAPSTRING_MANDATORY"],
62                    [Network capability string])
63 AC_SUBST([NETWORK_CAPSTRING_MANDATORY])
64 AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_OPTIONAL],
65                    ["$NETWORK_CAPSTRING_OPTIONAL"],
66                    [Additional optional network capabilities])
67 AC_SUBST([NETWORK_CAPSTRING_OPTIONAL])
69 AC_DEFINE_UNQUOTED([DATASUBDIR],
70                    ["$DATASUBDIR"],
71                    [Version specific subdir for default data path])
72 AC_SUBST([DATASUBDIR])
74 AC_DEFINE_UNQUOTED([FREECIV_DISTRIBUTOR], ["$FREECIV_DISTRIBUTOR"],
75                    [Distribution this freeciv is built for])
77 dnl Initialize automake stuff
78 AM_INIT_AUTOMAKE([subdir-objects dist-bzip2 dist-zip])
80 dnl Use Automake 1.11 silent rules by default if available
81 dnl verbose build using  make V=1
82 ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
84 UTILITY_LIBS=
86 AC_PROG_MKDIR_P
88 dnl Sed is needed for the configuration
89 dnl of the clients, database setting and the mapimg toolkits.
90 AC_PROG_SED
92 AC_CACHE_CHECK([for malloc(0) return value], [fc_cv_malloc_zero_ok], [
93 AC_RUN_IFELSE([AC_LANG_SOURCE([[
94 #include <stdlib.h>
96 int
97 main()
99   void *allocation = malloc(0);
101   if (allocation != NULL) {
102     free(allocation);
103   }
105   return (allocation == NULL);
107 ]])], [fc_cv_malloc_zero_ok=true], [fc_cv_malloc_zero_ok=false], [fc_cv_malloc_zero_ok=false])])
109 if test "x$fc_cv_malloc_zero_ok" = "xtrue" ; then
110   AC_DEFINE([MALLOC_ZERO_OK], [1], [It's ok to call malloc() for zero bytes])
113 dnl set default values
114 fcdb_all=no
115 fcdb_mysql=no
116 fcdb_postgres=no
117 fcdb_sqlite3=no
119 dnl checks for databases
120 dnl all:                  Autodetect as many as possible [default].
121 dnl mysql:                use mysql database
122 dnl postgres:             use postgres database
123 dnl comma-separated-list: Detect these or abort.
124 AC_ARG_ENABLE([fcdb],
125   AS_HELP_STRING([--enable-fcdb[=no/all/mysql/postgres/sqlite3]],
126                  [database backends [no](no, or list)]),
127 [databases=${enableval}],
128 [databases=no])
130 for db in $(echo $databases | $SED 's/,/ /g') ; do
131   if test "x$db" = "xall" ; then
132     fcdb_all=yes
133   elif test "x$db" = "xno" ; then
134     fcdb_all=no
135   elif test "x$db" = "xmysql" ; then
136     fcdb_mysql=yes
137   elif test "x$db" = "xpostgres" ; then
138     fcdb_postgres=yes
139   elif test "x$db" = "xsqlite3" ; then
140     fcdb_sqlite3=yes
141   else
142     AC_MSG_ERROR([bad value ${db} for --enable-fcdb])
143   fi
144 done
146 dnl checks for database mysql
147 dnl sets FCDB_MYSQL(conditional), FCDB_MYSQL_CFLAGS
148 FC_FCDB_MYSQL
150 dnl checks for database postgres
151 dnl sets FCDB_POSTGRES(conditional), FCDB_POSTGRES_CFLAGS
152 FC_FCDB_POSTGRES
154 dnl checks for database sqlite3
155 dnl sets FCDB_SQLITE3(conditional), FCDB_SQLITE3_CFLAGS
156 FC_FCDB_SQLITE3
158 dnl check if a database backend is available
159 if test "x$fcdb_mysql" = "xyes" || test "x$fcdb_postgres" = "xyes" \
160    || test "x$fcdb_sqlite3" = "xyes"; then
161   enable_fcdb=yes
162   AC_DEFINE([HAVE_FCDB], [1], [Database backend available])
163 else
164   enable_fcdb=no
166 AM_CONDITIONAL([FCDB_DB], [test "x$enable_fcdb" = "xyes"])
168 dnl  no=do not compile server,  yes=compile server,  *=error
169 AC_ARG_ENABLE([server],
170   AS_HELP_STRING([--disable-server], [do not compile the server]),
171 [case "${enableval}" in
172   yes) server=yes ;;
173   no)  server=no ;;
174   *)   AC_MSG_ERROR(bad value ${enableval} for --disable-server) ;;
175 esac], [server=yes])
176 AM_CONDITIONAL(SERVER, test x$server = xyes)
178 dnl Host type variable defaults
179 MINGW=no
180 AMIGA=no
182 dnl Settings specific to host OS
183 case "$host_os" in
185   *mingw*)
186     dnl Windows-specific settings
187     MINGW=yes
188     FC_WINSOCK2_INCLUDE([AC_DEFINE([FREECIV_HAVE_WINSOCK2], [1], [Mingw-specific setting - winsock2])])
189     AC_DEFINE([FREECIV_HAVE_WINSOCK], [1], [Mingw-specific setting - winsock])
190     AC_CHECK_HEADERS([ws2tcpip.h], [AC_DEFINE([FREECIV_HAVE_WS2TCPIP_H], [1], [ws2tcpip.h available])])
191     AC_CHECK_HEADERS([direct.h])
193     dnl Without WINSOCK2, use: LIBS="$LIBS -lwsock32"
194     LIBS="${LIBS} -lws2_32"
195     ;;
196 esac
198 dnl Networking headers
199 AC_CHECK_HEADERS([sys/types.h], [AC_DEFINE([FREECIV_HAVE_SYS_TYPES_H], [1], [sys/types.h available])])
201 dnl Avoid including the unix emulation layer if we build mingw executables
202 dnl There would be type conflicts between winsock and bsd/unix includes
203 if test "x$MINGW" != "xyes"; then
204   AC_CHECK_HEADERS([sys/socket.h], [AC_DEFINE([FREECIV_HAVE_SYS_SOCKET_H], [1], [sys/socket.h available])])
207 dnl Check getaddrinfo just once here, and remember the result
208 AC_CHECK_FUNCS([getaddrinfo], [have_getaddrinfo=yes], [
209   AC_MSG_CHECKING([getaddrinfo() as a macro])
210   AC_LINK_IFELSE([AC_LANG_PROGRAM([
211 #ifdef FREECIV_HAVE_WS2TCPIP_H
212 #include <ws2tcpip.h>
213 #endif], [getaddrinfo(NULL, NULL, NULL, NULL);])], [
214   AC_MSG_RESULT([yes])
215   have_getaddrinfo=yes
216   AC_DEFINE([HAVE_GETADDRINFO])], [AC_MSG_RESULT([no])])])
218 dnl yes     - Support for IPv6 required
219 dnl no      - Legacy IPv4 support
220 dnl test    - Try to enable IPv6 support
221 AC_ARG_ENABLE([ipv6],
222   AS_HELP_STRING([--enable-ipv6=yes/no/test], [use IPv6 [test]]),
223 [case "${enableval}" in
224   yes|no|test) ipv6=${enableval} ;;
225   *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
226 esac], [ipv6=test])
227 if test x$ipv6 != xno ; then
228   if test "x$have_getaddrinfo" = "xyes" ; then
229     enable_ipv6=yes
230     AC_CHECK_FUNCS([inet_pton], [],
231        [AC_MSG_CHECKING([inet_pton() as a macro])
232       AC_LINK_IFELSE([AC_LANG_PROGRAM([
233 #ifdef FREECIV_HAVE_WS2TCPIP_H
234 #include <ws2tcpip.h>
235 #endif], [inet_pton(0, NULL, NULL);])], [
236       AC_MSG_RESULT([yes])], [enable_ipv6=no])])
237     AC_CHECK_FUNCS([inet_ntop], [],
238        [AC_MSG_CHECKING([inet_ntop() as a macro])
239       AC_LINK_IFELSE([AC_LANG_PROGRAM([
240 #ifdef FREECIV_HAVE_WS2TCPIP_H
241 #include <ws2tcpip.h>
242 #endif], [inet_ntop(0, NULL, NULL, 0);])], [
243       AC_MSG_RESULT([yes])], [enable_ipv6=no])])
244     AC_CHECK_FUNCS([getnameinfo], [],
245        [AC_MSG_CHECKING([getnameinfo() as a macro])
246       AC_LINK_IFELSE([AC_LANG_PROGRAM([
247 #ifdef FREECIV_HAVE_WS2TCPIP_H
248 #include <ws2tcpip.h>
249 #endif], [getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);])], [
250       AC_MSG_RESULT([yes])], [enable_ipv6=no])])
251   else
252      enable_ipv6=no
253   fi
254   if test x$enable_ipv6 = xyes ; then
255     AC_MSG_CHECKING([for AF_INET6])
256     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
257 #ifdef FREECIV_HAVE_WINSOCK2
258 #include <winsock2.h>
259 #endif
260 #ifdef FREECIV_HAVE_SYS_TYPES_H
261 #include <sys/types.h>
262 #endif
263 #ifdef FREECIV_HAVE_SYS_SOCKET_H
264 #include <sys/socket.h>
265 #endif]], [[return AF_INET6;]])], [AC_MSG_RESULT([yes])],
266        [AC_MSG_RESULT([no])
267         enable_ipv6=no])
268   fi
269   if test x$enable_ipv6 = xno && test x$ipv6 = xyes ; then
270     AC_MSG_ERROR([Cannot enable IPv6 functionality])
271   fi
272   if test x$enable_ipv6 = xyes ; then
273     AC_DEFINE([FREECIV_IPV6_SUPPORT], [1], [IPv6 Support built in])
274   else
275     feature_ipv6=missing
276   fi
279 AC_ARG_WITH([readline],
280   AS_HELP_STRING([--with-readline], [support fancy command line editing]),
281 WITH_READLINE=$withval, dnl yes/no - required to use / never use
282 WITH_READLINE="maybe"   dnl maybe  - use if found [default]
285 FOLLOWTAG=${DEFAULT_FOLLOW_TAG}
286 AC_ARG_WITH([followtag],
287   AS_HELP_STRING([--with-followtag], [version tag to follow]),
288 [FOLLOWTAG=${withval}])
289 AC_DEFINE_UNQUOTED([FOLLOWTAG], ["${FOLLOWTAG}"], [Version tag to follow])
291 AC_ARG_WITH([modlist],
292   AS_HELP_STRING([--with-modlist], [default modlist URL]),
293 [modlist_url=${withval}])
294 if test "x$modlist_url" != "x" ; then
295   AC_DEFINE_UNQUOTED([MODPACK_LIST_URL], ["${modlist_url}"], [Default modpack list URL])
298 AC_ARG_WITH([desktopdir],
299   AS_HELP_STRING([--with-desktopdir], [install desktop files to given dir]),
300 [ DESKTOPDIR=${withval} ], [ DESKTOPDIR="\$(prefix)/share/applications" ])
301 AC_SUBST([DESKTOPDIR])
303 AC_ARG_WITH([appdatadir],
304   AS_HELP_STRING([--with-appdatadir], [install appdata files to given dir]),
305 [ APPDATADIR=${withval} ], [ APPDATADIR="\$(prefix)/share/appdata" ])
306 AC_SUBST([APPDATADIR])
308 dnl set default values
309 mapimg_all=auto
310 mapimg_magickwand=no
312 dnl map images
313 dnl all:                  Autodetect as many as possible [default].
314 dnl no:                   No additional toolkits.
315 dnl magickwand:           compile magickwand (imagemagick) support.
316 dnl comma-separated-list: Detect these or abort.
317 AC_ARG_ENABLE([mapimg],
318   AS_HELP_STRING([--enable-mapimg=no/auto/magickwand],
319                  [additional map image toolkits to compile [auto](no, or list)]),
320 [toolkits=${enableval}],
321 [enable_mapimg=auto])
323 for toolkit in $(echo $toolkits | $SED 's/,/ /g') ; do
324   if test "x$toolkit" = "xauto" ; then
325     enable_mapimg=auto
326   elif test "x$toolkit" = "xno" ; then
327     enable_mapimg=no
328   else
329     enable_mapimg=selected
330   fi
332   if test "x$toolkit" = "xmagickwand" ; then
333     mapimg_magickwand=yes
334   fi
335 done
337 dnl checks for MagickWand mapimg support
338 dnl sets MAPIMG_WAND_CFLAGS, MAPIMG_WAND_LIBS
339 FC_MAPIMG_MAGICKWAND
341 dnl Option not available in stable branch
342 fcweb=false
344 FC_WEB_CLIENT
346 FC_TESTMATIC
348 dnl no:   Do not compile client.
349 dnl auto: Autodetect one.
350 dnl all:  Autodetect as many as possible.
351 dnl comma-separated-list: Detect these or abort.
352 AC_ARG_ENABLE([client],
353   AS_HELP_STRING([--enable-client=auto/all/gtk2/gtk3/gtk3.22/sdl/sdl2/xaw/qt/stub],
354                  [clients to compile [auto](list for multiple)]),
355 [clients=${enableval}],
356 [client=auto])
358 if test "x$fcweb" = "xtrue" ; then
359   if test "x$clients" != "x" && test "x$clients" != "xauto" &&
360      test "x$clients" != "xno" ; then
361     AC_MSG_ERROR([One cannot enable any clients for freeciv-web build])
362   fi
363   clients=no
366 gui_gtk2=no
367 gui_gtk3_22=no
368 gui_gtk3=no
369 gui_sdl=no
370 gui_sdl2=no
371 gui_xaw=no
372 gui_qt=no
373 gui_stub=no
375 for gui in $(echo $clients | $SED 's/,/ /g') ; do
376   if test "x$gui" = "xno" ; then
377     client=no
378   elif test "x$gui" = "xauto" || test "x$gui" = "xyes" ; then
379     client=auto
380   elif test "x$gui" = "xall" ; then
381     client=all
382   else
383     if test "x$gui" = "xgtk2"   ||
384        test "x$gui" = "xgtk2.0" ||
385        test "x$gui" = "xgtk20"  ||
386        test "x$gui" = "xgtk-2.0" ; then
387       gui_gtk2=yes
388     elif test "x$gui" = "xgtk3.22" ; then
389       gui_gtk3_22=yes
390     elif test "x$gui" = "xgtk3"   ||
391          test "x$gui" = "xgtk3.0" ||
392          test "x$gui" = "xgtk30"  ||
393          test "x$gui" = "xgtk-3.0" ; then
394       gui_gtk3=yes
395     elif test "x$gui" = "xgtk" ; then
396       AC_MSG_WARN([for requested client 'gtk' enabled gtk3-client, that has changed since earlier versions])
397       gui_gtk3=yes
398     else
399       if test ! -d "${srcdir}/client/gui-$gui" ; then
400         AC_MSG_ERROR(bad value ${gui} for --enable-client)
401       fi
402       eval "gui_$gui=yes"
403     fi
404     client=yes
405   fi
406 done
408 AC_ARG_WITH([zoom],
409   [AS_HELP_STRING([--with-zoom], [expose experimental/WIP zoom support on gtk3-client to user])],
410   [AC_DEFINE([GTK3_ZOOM_ENABLED], [1], [Experimental zoom functionality exposed to user])])
412 AC_ARG_WITH([xaw],
413   [AS_HELP_STRING([--with-xaw], [use the Xaw widget set for the xaw client])],
414   [WITH_XAW=1])
416 AC_ARG_WITH([xaw3d],
417   [AS_HELP_STRING([--with-xaw3d], [use the Xaw3d widget set for the xaw client])],
418   [WITH_XAW3D=1])
420 if test "x$WITH_XAW" != "x" && test "x$WITH_XAW3D" != "x" ; then
421   AC_MSG_ERROR([Cannot use both --with-xaw and --with-xaw3d at the same time])
424 AC_ARG_ENABLE([svnrev],
425   AS_HELP_STRING([--enable-svnrev], [get svn revision to version information]),
426 [case "${enableval}" in
427   yes) svnrev=true  ;;
428   no)  svnrev=false ;;
429   *)   AC_MSG_ERROR([bad value ${enableval} for --enable-svnrev]) ;;
430 esac], [svnrev=false])
431 AM_CONDITIONAL([SVNREV], [test x$svnrev = xtrue])
432 if test x$svnrev = xtrue ; then
433   AC_DEFINE([SVNREV], [1], [Get svn revision information to version number])
436 AC_ARG_ENABLE([gitrev],
437   AS_HELP_STRING([--enable-gitrev], [get git revision to version information]),
438 [case "${enableval}" in
439   yes) gitrev=true  ;;
440   no)  gitrev=false ;;
441   *)   AC_MSG_ERROR([bad value ${enableval} for --enable-gitrev]) ;;
442 esac], [gitrev=false])
443 AM_CONDITIONAL([GITREV], [test x$gitrev = xtrue])
444 if test x$gitrev = xtrue ; then
445   AC_DEFINE([GITREV], [1], [Get git revision information to version number])
448 AC_ARG_ENABLE([make_data],
449   AS_HELP_STRING([--disable-make-data], [do not recurse make into data directories]),
450 [case "${enableval}" in
451   yes) make_data=true ;;
452   no)  make_data=false ;;
453   *)   AC_MSG_ERROR(bad value ${enableval} for --disable-make-data) ;;
454 esac], [make_data=true])
455 AM_CONDITIONAL(MAKE_DATA, test x$make_data = xtrue)
457 AC_ARG_ENABLE([make_include],
458   AS_HELP_STRING([--enable-make-include], [force make to recurse into include directory]),
459 [case "${enableval}" in
460   yes) make_include=true ;;
461   no)  make_include=false ;;
462   *)   AC_MSG_ERROR(bad value ${enableval} for --enable-make-include) ;;
463 esac], [make_include=false])
464 AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test "$make_include" = "true")
466 AC_ARG_WITH([efence],
467   AS_HELP_STRING([--with-efence], [use Electric Fence, malloc debugger]),
468   WITH_EFENCE=1
471 AC_ARG_ENABLE([aimodules],
472   AS_HELP_STRING([--enable-aimodules=yes/no/experimental], [support for ai modules [no]]),
473 [case "${enableval}" in
474   yes) enable_aimodules=yes ;;
475   no)  enable_aimodules=no ;;
476   experimental) enable_aimodules=yes
477                 exp_aimodules=yes ;;
478   *)   AC_MSG_ERROR([bad value ${enable_aimodules} for --enable-aimodules]) ;;
479 esac], [enable_aimodules=no])
480 aimoduledir="${libdir}/fcai"
481 AC_SUBST(aimoduledir)
482 AM_CONDITIONAL(AI_MODULES, test "x$enable_aimodules" = "xyes")
483 if test $enable_aimodules = yes ; then
484   if test x$enable_shared != xyes ; then
485     AC_MSG_ERROR([cannot enable ai module support if also build of shared libraries is not enabled with --enable-shared])
486   fi
487   LIBS_TMP="$LIBS"
488   LIBS="$LIBS -lltdl"
489   AC_MSG_CHECKING([whether can build modules])
490   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ltdl.h>]],
491      [[lt_dlopenext(NULL);]])],
492      [AC_MSG_RESULT([yes])],
493      [AC_MSG_RESULT([no])
494       AC_MSG_ERROR([cannot build loadable AI modules as requested])])
495   LIBS="$LIBS_TMP"
496   SERVER_LIBS="${SERVER_LIBS} -lltdl"
497   AC_DEFINE([AI_MODULES], [1], [Enable ai modules])
498   CPPFLAGS="${CPPFLAGS} -DAI_MODULEDIR=\"\\\"${aimoduledir}\\\"\""
499   ai_mod_default_needed=yes
501 AM_CONDITIONAL(EXP_AI_MODULES, test "x$exp_aimodules" = "xyes")
503 AC_ARG_ENABLE([ai-static],
504   AS_HELP_STRING([--enable-ai-static], [statically link listed modules to server]),
505 [static_modules="${enableval}"],
506 [static_modules="classic"])
508 ai_mod_static_classic=no
509 ai_mod_static_threaded=no
510 ai_mod_static_stub=no
512 for module in $(echo $static_modules | $SED 's/,/ /g') ; do
513   if test "x$module" = "xclassic" ; then
514     ai_mod_static_classic=yes
515     ai_mod_default_needed=yes
516     AC_DEFINE([AI_MOD_STATIC_CLASSIC], [1],
517               [classic ai module statically linked])
518   elif test "x$module" = "xthreaded" ; then
519     ai_mod_static_threaded=yes
520     ai_mod_default_needed=yes
521     AC_DEFINE([AI_MOD_STATIC_THREADED], [1],
522               [threaded ai module statically linked])
523   elif test "x$module" = "xstub" ; then
524     ai_mod_static_stub=yes
525     AC_DEFINE([AI_MOD_STATIC_STUB], [1],
526               [stub ai module statically linked]) 
527   else
528     AC_MSG_ERROR([bad value ${module} for --enable-ai-static])
529   fi
530   if test "x$default_ai_set" = "x" ; then
531     dnl Make first static module default ai type
532     default_ai_set="${module}"
533   fi
534 done
535 AM_CONDITIONAL([AI_MOD_STATIC_CLASSIC],
536 [test "x$ai_mod_static_classic" = "xyes" || test "x$enable_aimodules" != "xyes"])
537 AM_CONDITIONAL([AI_MOD_STATIC_THREADED],
538 [test "x$ai_mod_static_threaded" = "xyes"])
539 AM_CONDITIONAL([AI_MOD_STATIC_STUB],
540 [test "x$ai_mod_static_stub" = "xyes"])
542 AC_ARG_WITH([default-ai],
543   AS_HELP_STRING([--with-default-ai], [default ai type [first_static]]),
544   [default_ai_set="${withval}"],
545   [])
547 AC_ARG_WITH([ai-lib],
548   AS_HELP_STRING([--with-ai-lib], [build in default AI code [if_needed]]),
549   [ai_mod_default_needed=yes], [])
551 AM_CONDITIONAL([AI_MOD_DEFAULT_NEEDED],
552 [test  "x${ai_mod_default_needed}" = "xyes" || test "x${default_ai_set}" = "x"])
554 if test "x${default_ai_set}" = "x" ; then
555   default_ai_set="classic"
558 fc_ai_last=0
559 if test "x$ai_mod_static_classic" = "xyes" ; then
560   fc_ai_last=$fc_ai_last+1
562 if test "x$ai_mod_static_threaded" = "xyes" ; then
563   fc_ai_last=$fc_ai_last+1
565 if test "x$ai_mod_static_stub" = "xyes" ; then
566   fc_ai_last=$fc_ai_last+1
568 if test "x$enable_aimodules" = "xyes" ; then
569   dnl Dynamic modules allowed, give slots for them
570   fc_ai_last=$fc_ai_last+3
572 AC_DEFINE_UNQUOTED([FREECIV_AI_MOD_LAST], [(${fc_ai_last})], [Max number of AI modules])
574 AC_DEFINE_UNQUOTED([AI_MOD_DEFAULT], ["${default_ai_set}"], [Default ai type name])
576 dnl Checks for programs.
577 AC_PROG_AWK
578 AC_PROG_CC
579 AC_PROG_CPP
580 AC_PROG_LN_S
581 AC_DISABLE_SHARED
582 dnl Replace AC_PROG_LIBTOOL with LT_INIT when minimum libtool
583 dnl version 2.2
584 m4_ifdef([AM_PROG_AR], [AM_PROG_AR], [AC_CHECK_TOOL([AR], [ar])])
585 AC_PROG_LIBTOOL
586 AC_SUBST(LIBTOOL)
587 if test -z $AR; then
588         AC_MSG_ERROR([*** 'ar' missing.  Install binutils, fix your \$PATH, or set \$AR manually. ***])
591 AM_PROG_CC_C_O
592 AC_PROG_CXX
593 FC_WORKING_CXX
594 FC_C99_TOKEN_CONCENATION
596 AC_CHECK_PROG(UNAME,uname,uname,:)
598 AC_CHECK_SIZEOF([int])
600 dnl Programs already checked by AM_INIT_AUTOMAKE:
602 dnl AC_PROG_MAKE_SET required with automake-ng
603 AC_PROG_MAKE_SET
605 dnl Check for libiconv (which is usually included in glibc, but may be
606 dnl distributed separately).  The libcharset check must come after the
607 dnl iconv check.  This whole thing must come before the gettext check below.
608 AM_ICONV
609 FC_LIBCHARSET
610 AM_LANGINFO_CODESET
611 if test "$am_cv_func_iconv" != yes; then
612   AC_MSG_ERROR([Iconv is missing. You can get libiconv from http://gnu.org/, \
613 or try using --with-libiconv-prefix.])
615 LIBS="$LIBS $LIBICONV"
617 dnl I18n support
618 ALL_LINGUAS="ar bg cs ca da de el en_GB eo es et fa fi fr ga gd he hu id it ja 
619 ko lt nl nb pl pt pt_BR ro ru sr sv tr uk zh_CN zh_TW"
620 PODOMAINS="freeciv nations ruledit"
622 AM_GNU_GETTEXT([external], [need-ngettext])
624 if test "x$USE_NLS" = "xyes" ; then
625   AC_DEFINE([FREECIV_ENABLE_NLS], [1], [Native language support enabled])
628 AM_XGETTEXT_OPTION([--keyword=Q_])
629 AM_XGETTEXT_OPTION([--keyword=PL_:1,2])
630 AM_XGETTEXT_OPTION([--language=C])
631 AM_XGETTEXT_OPTION([--escape])
632 AM_XGETTEXT_OPTION([--add-comments="TRANS:"])
633 AM_XGETTEXT_OPTION([--from-code=UTF-8])
635 PKG_PROG_PKG_CONFIG
636 if test "x$PKG_CONFIG" = "x" ; then
637   AC_MSG_ERROR([pkg-config not found])
639 PKG_CHECK_MODULES([CURL], [libcurl >= 7.12.1],,
640     [AC_MSG_ERROR([libcurl development files required])])
641 UTILITY_CFLAGS="${UTILITY_CFLAGS} ${CURL_CFLAGS}"
642 UTILITY_LIBS="${UTILITY_LIBS} ${CURL_LIBS}"
644 AC_ARG_ENABLE([xml-registry],
645   AS_HELP_STRING([--enable-xml-registry], [build xml-backend for registry (WIP)]),
646 [case "${enableval}" in
647   yes) XMLREGISTRY=yes ;;
648   no)  XMLREGISTRY=no  ;;
649   *)   AC_MSG_ERROR([bad value ${enableval} for --enable-xml-registry]) ;;
650 esac], [XMLREGISTRY=no])
652 if test "x$XMLREGISTRY" = "xyes" ; then
653   PKG_CHECK_MODULES([LIBXML2], [libxml-2.0],,
654       [AC_MSG_ERROR([libxml2 development files required])])
655   UTILITY_CFLAGS="${UTILITY_CFLAGS} ${LIBXML2_CFLAGS}"
656   UTILITY_LIBS="${UTILITY_LIBS} ${LIBXML2_LIBS}"
657   AC_DEFINE([FREECIV_HAVE_XML_REGISTRY], [1], [Build xml-backend for registry])
660 dnl Set debug flags supported by compiler
661 EXTRA_DEBUG_CFLAGS=""
662 EXTRA_DEBUG_CXXFLAGS=""
663 EXTRA_DEBUG_LDFLAGS=""
664 dnl check debugging
665 FC_DEBUG
666 dnl check profiling
667 FC_GPROF
669 AC_C99_VARIADIC_MACROS
670 AC_C99_VARIABLE_ARRAYS
671 AC_C99_INITIALIZERS
672 AC_C99_STDINT_H
674 FC_C99_INITIALIZER_BRACES
676 FC_C11_STATIC_ASSERT
677 FC_C11_AT_QUICK_EXIT
679 FC_CXX11_STATIC_ASSERT
680 FC_CXX11_NULLPTR
682 dnl BeOS-specific settings
683 if test x`$UNAME -s` = xBeOS ; then
684   AC_DEFINE([FREECIV_SOCKET_ZERO_NOT_STDIN], [1], [BeOS-specific setting])
685   CFLAGS="$CFLAGS -Wno-multichar"
686   LDFLAGS="$LDFLAGS -x none"
687   if test x$enable_debug = xyes ; then
688     CFLAGS="$CFLAGS -gdwarf-2"
689     LDFLAGS="$LDFLAGS -gdwarf-2"
690   fi
691   # We used to set ARFLAGS here, but under recent versions of automake this
692   # broke compilation on other systems.  Setting ARFLAGS shouldn't be
693   # necessary with a working automake.
696 dnl Defaults to override with host specific values
697 HOST_PATH_SEPARATOR=":"
698 HOST_DIR_SEPARATOR="/"
700 dnl Settings specific to host OS
701 case "$host_os" in
703   *mingw*)
704     dnl Windows-specific settings
705     AC_CHECK_TOOL([WINDRES], [windres])
706     if test -z $WINDRES; then
707           AC_MSG_ERROR([*** 'windres' missing.  Install binutils, fix your \$PATH, or set \$WINDRES manually. ***])
708     fi
710     HOST_PATH_SEPARATOR=";"
711     HOST_DIR_SEPARATOR="\\"
713     AC_DEFINE([FREECIV_SOCKET_ZERO_NOT_STDIN], [1], [Mingw-specific setting - stdin])
714     AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw])
715     AC_DEFINE([FREECIV_MSWINDOWS], [1], [Windows build])
717     dnl Backward compatibility macro, FREECIV_MSWINDOWS is the preferred one, and
718     dnl one that must be used in public headers.
719     AC_DEFINE([WIN32_NATIVE], [1], [Mingw-specific setting - native])
720     AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])
721     ;;
723   *skyos*)
724     dnl SkyOS specific settings
725     AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - SkyOS])
726     ;;
728   *haiku*)
729     dnl Haiku specific settings
730     AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Haiku])
731     LIBS="$LIBS -lnetwork"
732     ;;
734   *amigaos*)
735     AMIGA=yes
736     AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Amiga])
737     ;;
739 esac
741 dnl Autoconf provides path separator for build system.
742 dnl Use that instead of our own guess in case of native build.
743 dnl Actually; Don't, since at least with autoconf-2.69 msys2 builds got wrong separator this way
744 dnl if test x$build = x$host ; then
745 dnl   HOST_PATH_SEPARATOR=$PATH_SEPARATOR
746 dnl fi
748 dnl note this has to match the path installed by translations/freeciv/Makefile
749 if test x"$MINGW" != "xyes"; then
750   CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\"\\\"$localedir\\\"\""
751 else
752   AC_DEFINE_UNQUOTED([LOCALEDIR], [".\\\\share\\\\locale"], [Locale directory (windows)])
755 CPPFLAGS="$CPPFLAGS -DBINDIR=\"\\\"$bindir\\\"\""
757 COMMON_LIBS=-lm
759 dnl Check for zlib
760 AC_CHECK_LIB([z], [gzgets],
761   [AC_DEFINE([FREECIV_HAVE_LIBZ], [1], [zlib is available])
762 UTILITY_LIBS="${UTILITY_LIBS} -lz"
763 COMMON_LIBS="$COMMON_LIBS -lz"], 
764   AC_MSG_ERROR([Could not find zlib library.]))
766 AC_CHECK_HEADER(zlib.h, , 
767   AC_MSG_ERROR([zlib found but not zlib.h.
768 You may need to install a zlib devel package.]))
770 AC_PATH_PROG(GZIP, gzip, "no")
771 if test "$GZIP" = "no"; then
772   AC_MSG_ERROR([You need the gzip program for compilation.])
775 dnl Check for bzip2 compression
776 AC_ARG_WITH([libbz2],
777   AS_HELP_STRING([--with-libbz2], [support bzip2 compressed files [if_possible]]),
778 [WITH_BZ2="${withval}"],
779 [WITH_BZ2="test"])
781 if test "x$WITH_BZ2" != xno ; then
782   AC_CHECK_LIB([bz2], [BZ2_bzReadOpen],
783     [AC_CHECK_HEADERS([bzlib.h],
784      [AC_DEFINE([FREECIV_HAVE_LIBBZ2], [1], [libbzip2 is available])
785   UTILITY_LIBS="${UTILITY_LIBS} -lbz2"
786   libbz2_available=true])])
787   if test "x$libbz2_available" != "xtrue" ; then
788     if test "x$WITH_BZ2" = "xyes" ; then
789       AC_MSG_ERROR([Could not find libbz2 devel files])
790     fi
791     feature_bz2=missing
792   fi
795 dnl Check for xz compression
796 AC_ARG_WITH([liblzma],
797   AS_HELP_STRING([--with-liblzma], [support xz compressed files [if_possible]]),
798 [WITH_XZ="${withval}"],
799 [WITH_XZ="test"])
801 if test "x$WITH_XZ" != xno ; then
802   AC_CHECK_LIB([lzma], [lzma_code],
803     [AC_CHECK_HEADERS([lzma.h],
804      [AC_DEFINE([FREECIV_HAVE_LIBLZMA], [1], [liblzma is available])
805   UTILITY_LIBS="${UTILITY_LIBS} -llzma"
806   libxz_available=true])])
807   if test "x$libxz_available" != "xtrue" ; then
808     if test "x$WITH_XZ" = "xyes" ; then
809       AC_MSG_ERROR([Could not find liblzma devel files])
810     fi
811     feature_xz=missing
812   fi
815 UTILITY_LIBS="${UTILITY_LIBS} ${LTLIBINTL}"
817 AC_SUBST([UTILITY_CFLAGS])
818 AC_SUBST([UTILITY_LIBS])
819 AC_SUBST([COMMON_LIBS])
821 AC_ARG_ENABLE([crosser],
822   AS_HELP_STRING([--enable-crosser], [build version to be used with crosser environment]),
823 [case "${enableval}" in
824   yes) crosser=yes
825        AC_DEFINE([CROSSER], [1], [this is crosser based build]) ;;
826   no)  crosser=no ;;
827   *)   AC_MSG_ERROR([bad value ${enableval} for --enable-crosser]) ;;
828 esac], [crosser=no])
829 if test x$crosser = xyes && test x$MINGW != xyes ; then
830   AC_MSG_ERROR([--enable-crosser is Windows build specific option])
833 dnl Check thread implementation
834 AC_MSG_CHECKING([for threads implementation])
835 thread_impl=none
837 CFLAGS_SAVE="${CFLAGS}"
838 LIBS_SAVE="${LIBS}"
840 if test x$crosser != xyes ; then
841   FC_C_FLAGS([-pthread], [], [CFLAGS])
842   FC_LD_FLAGS([-pthread], [], [LIBS])
843   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
844     [[return pthread_create(NULL, NULL, NULL, NULL);]])],
845     [AC_DEFINE([FREECIV_HAVE_PTHREAD], [1], [Use pthreads as thread implementation])
846     thread_impl=pthreads
847     AC_MSG_RESULT([pthreads])
848     AC_DEFINE([FREECIV_HAVE_THREAD_COND], [1], [Has thread condition variable implementation])])
849     thread_cond=true
852 if test "x$thread_impl" = "xnone" ; then
853   CFLAGS="$CFLAGS_SAVE"
854   LDFLAGS="$LDFLAGS_SAVE"
856   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
857     [[CreateThread(NULL, 0, NULL, NULL, 0, NULL);]])],
858     [AC_DEFINE([FREECIV_HAVE_WINTHREADS], [1], [Use Windows threads as thread implementation])
859     thread_impl=windows
860     AC_MSG_RESULT([windows])])
863 if test "x$thread_impl" = "xnone" ; then
864   AC_MSG_ERROR([No usable thread implementation available])
867 if test "x$thread_cond" != "xtrue" ; then
868   feature_thr_cond=missing
871 dnl Check and choose clients
872 if test "x$client" != "xno"; then
874   dnl Check for sound support, sets SOUND_CFLAGS, SOUND_LIBS, AUDIO_SDL
875   dnl Client gui checks need to know which mixer version this has selected
876   FC_CHECK_SOUND()
878   dnl if specified --with-xaw or --with-xaw3d, assume --enable-client=xaw
879   if test -n "$WITH_XAW" || test -n "$WITH_XAW3D"; then
880     if test "x$client" = "xauto" ; then
881       gui_xaw=yes
882       client=yes
883     elif test "x$client" = "xall" ; then
884       gui_xaw=yes
885     fi
886   fi
888   dnl if need to guess client, announce checking
889   if test "x$client" = "xauto"; then
890     AS_MESSAGE([checking for which client to compile:...])
891   elif test "x$client" = "xall" ; then
892     AS_MESSAGE([checking for which clients to compile:...])
893   fi
895   dnl Gtk-3.22-specific overrides
896   FC_GTK3_22_CLIENT
898   dnl Gtk-3.0-specific overrides
899   FC_GTK3_CLIENT
901   dnl Gtk-2.0-specific overrides
902   FC_GTK2_CLIENT
904   dnl QT-specific overrides
905   FC_QT_CLIENT
907   dnl SDL-specific overrides
908   FC_SDL_CLIENT
910   dnl SDL2-specific overrides
911   FC_SDL2_CLIENT
913   dnl Xaw-specific overrides
914   FC_XAW_CLIENT
916   dnl Stub-specific overrides
917   if test "x$gui_stub" = "xyes" || test "x$client" = "xall" ; then
918     gui_stub=yes
919     if test "x$client" = "xauto" ; then
920       client=yes
921     fi
922     gui_stub_libs="-lm"
923   fi
925   dnl If client still "auto", error out since we couldn't select any of them
926   if test "x$client" = "xauto" ; then
927     AC_MSG_ERROR([can not build any of the supported clients])
928   fi
931 if test "x$client" = "xall" ; then
932   if test "x$gui_gtk2" = "xyes" ||
933      test "x$gui_gtk3_22" = "xyes" ||
934      test "x$gui_gtk3" = "xyes" ||
935      test "x$gui_sdl" = "xyes" ||
936      test "x$gui_sdl2" = "xyes" ||
937      test "x$gui_xaw" = "xyes" ||
938      test "x$gui_qt" = "xyes" ||
939      test "x$gui_stub" = "xyes" ; then
940     client=yes
941   else
942     client=no
943   fi
946 FC_LD_FLAGS(["-Wl,-rpath=${lib_prefix}"], [], [LDFLAGS])
948 AM_CONDITIONAL([CLIENT], [test "x$client" = "xyes"])
950 AC_ARG_ENABLE([freeciv-manual],
951   AS_HELP_STRING([--enable-freeciv-manual=no/yes/wiki/html], [build freeciv-manual [wiki]]),
952 [case "${enableval}" in
953   yes|wiki) fcmanual=wiki ;;
954   no)       fcmanual=no ;;
955   html)     fcmanual=html ;;
956   *) AC_MSG_ERROR([bad value ${enableval} for --enable-freeciv-manual]) ;;
957 esac], [fcmanual=wiki])
959 AM_CONDITIONAL([FCMANUAL], [test "x$fcmanual" != "xno"])
961 if test x$fcmanual = xhtml ; then
962   AC_DEFINE([MANUAL_USE_HTML], [1], [Build freeciv-manual with html formatting])
965 dnl freeciv-modpack checks
966 AC_ARG_ENABLE([fcmp],
967   AS_HELP_STRING([--enable-fcmp=no/yes/gtk2/gtk3/qt/cli/all/auto], [build freeciv-modpack-program [auto]]),
968 [fc_mp=${enableval}],
969 [fc_mp=auto])
971 fcmp_cli=no
972 fcmp_gtk2=no
973 fcmp_gtk3=no
974 fcmp_qt=no
975 fcmp_list=
977 if test "x$fc_mp" = "xcli" ; then
978   dnl Only cli requested -> no gui needed
979   modinst=cli
982 for mp in $(echo $fc_mp | $SED 's/,/ /g') ; do
983   if test "x$mp" = "xno" ; then
984     modinst=no
985   elif test "x$mp" = "xauto" || test "x$mp" = "xyes" ; then
986     modinst=auto
987   elif test "x$mp" = "xall" ; then
988     modinst=all
989   else if test "x$mp" = "xgtk2"   ||
990           test "x$mp" = "xgtk2.0" ||
991           test "x$mp" = "xgtk20"  ||
992           test "x$mp" = "xgtk-2.0" ; then
993       req_fcmp_gtk2=yes
994     elif test "x$mp" = "xgtk3"   ||
995          test "x$mp" = "xgtk3.0" ||
996          test "x$mp" = "xgtk30"  ||
997          test "x$mp" = "xgtk-3.0" ; then
998       req_fcmp_gtk3=yes
999     elif test "x$mp" = "xqt" ; then
1000       req_fcmp_qt=yes
1001     elif test "x$mp" = "xcli" ; then
1002       req_fcmp_cli=yes
1003     elif test "x$mp" != "xyes" ; then
1004       AC_MSG_ERROR([bad value ${mp} for --enable-fcmp])
1005     fi
1006   fi
1007 done
1009 if test "x$req_fcmp_gtk3" = "xyes" ||
1010    test "x$modinst" = "xall" || test "x$modinst" = "xauto" ; then
1011   PKG_CHECK_MODULES([GTK3MP], [gtk+-3.0 >= 3.8.0],
1013   GTK3MP_CFLAGS="$GTK3MP_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_8 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_8"
1014   GTK3MP_CFLAGS="$GTK3MP_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36"
1015   PKG_CHECK_MODULES([GTHREAD_GTK3], [gthread-2.0],
1017   fcmp_gtk3=yes
1018   fcmp_list="$fcmp_list gtk3"
1019   mp_gtk3_cflags="$GTK3MP_CFLAGS $GHTREAD_GTK3_CFLAGS"
1020   mp_gtk3_libs="$GTK3MP_LIBS $GTHREAD_GTK3_LIBS"
1021   if test "x$MINGW" = "xyes"; then
1022     dnl Required to compile gtk3 on Windows platform
1023     mp_gtk3_cflags="$mp_gtk3_cflags -mms-bitfields"
1024     mp_gtk3_ldflags="$mp_gtk3_ldflags -mwindows"
1025   fi
1027   if test "x$modinst" = "xauto" ; then
1028     modinst=found
1029   fi
1030 ], [])], [])
1033 if test "x$req_fcmp_gtk3" = "xyes" && test "x$fcmp_gtk3" != "xyes" ; then
1034   AC_MSG_ERROR([Cannot build gtk3-version of freeciv-modpack as requested])
1037 if test "x$req_fcmp_gtk2" = "xyes" ||
1038    test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
1039   AM_PATH_GTK_2_0([2.12.0],
1041   PKG_CHECK_MODULES([GTHREAD_GTK2], [gthread-2.0],
1043   fcmp_gtk2=yes
1044   fcmp_list="$fcmp_list gtk2"
1045   mp_gtk2_cflags="$GTK2_CFLAGS $GTHREAD_GTK2_CFLAGS"
1046   mp_gtk2_libs="$GTK2_LIBS $GTHREAD_GTK2_LIBS"
1047   if test "x$MINGW" = "xyes"; then
1048      dnl Required to compile gtk2 on Windows platform
1049      mp_gtk2_cflags="$mp_gtk2_cflags -mms-bitfields"
1050      mp_gtk2_ldflags="$mp_gtk2_ldflags -mwindows"
1051   fi
1053   if test "x$modinst" = "xauto" ; then
1054     modinst=found
1055   fi
1056 ], [])], [])
1059 if test "x$req_fcmp_gtk2" = "xyes" && test "x$fcmp_gtk2" != "xyes" ; then
1060   AC_MSG_ERROR([Cannot build gtk2-version of freeciv-modpack as requested])
1063 if test "x$req_fcmp_qt" = "xyes" ||
1064    test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
1066    if test "x$cxx_works" = "xyes" ; then
1067      FC_QT5
1069      if test "x$fc_qt5_usable" = "xtrue" ; then
1070        fcmp_qt=yes
1071        fcmp_list="$fcmp_list qt"
1073        mp_qt_cppflags=$FC_QT5_CPPFLAGS
1074        mp_qt_cxxflags=$FC_QT5_CXXFLAGS
1075        mp_qt_libs=$FC_QT5_LIBS
1077        if test "x$modinst" = "xauto" ; then
1078          modinst=found
1079        fi
1080      fi
1081    fi
1085 if test "x$req_fcmp_qt" = "xyes" && test "x$fcmp_qt" != "xyes" ; then
1086   AC_MSG_ERROR([Cannot build Qt-version of freeciv-modpack as requested])
1089 dnl Cli does not satisfy --enable-fcmp=auto as it's not an gui.
1090 if test "x$req_fcmp_cli" = "xyes" || test "x$modinst" = "xall" ; then
1091   fcmp_cli=yes
1092   fcmp_list="$fcmp_list cli"
1095 if test "x$modinst" != "xfound" &&
1096    test "x$modinst" != "xno" &&
1097    test "x$modinst" != "xcli" &&
1098    test "x$fcmp_gtk3" != "xyes" &&
1099    test "x$fcmp_gtk2" != "xyes" &&
1100    test "x$fcmp_qt" != "xyes" ;then
1101   AC_MSG_ERROR([Cannot build modpack installer with any gui])
1102 fi 
1104 if test "x$modinst" != "xno" && test "x$MINGW" != "xyes" ; then
1105   dnl Hack to get a run-time icon -- not needed on Windows
1106   mp_gtk2_cflags="$mp_gtk2_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1107   mp_gtk3_cflags="$mp_gtk3_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1110 if test "x$fcmp_list" = "x" ; then
1111   fcmp_list="none"
1114 AM_CONDITIONAL([MODINST], [test "x$modinst" != "xno"])
1115 AM_CONDITIONAL([MODINST_GTK3], [test "x$fcmp_gtk3" = "xyes"])
1116 AM_CONDITIONAL([MODINST_GTK2], [test "x$fcmp_gtk2" = "xyes"])
1117 AM_CONDITIONAL([MODINST_QT], [test "x$fcmp_qt" = "xyes"])
1118 AM_CONDITIONAL([MODINST_CLI], [test "x$fcmp_cli" = "xyes"])
1120 AC_ARG_ENABLE([ruledit],
1121   AS_HELP_STRING([--enable-ruledit], [build freeciv-ruledit (WIP)]),
1122 [case "${enableval}" in
1123   yes)  ruledit=yes ;;
1124   no)   ruledit=no ;;
1125   test) ruledit=test ;;
1126   experimental)
1127         AC_DEFINE([RULEDIT_EXPERIMENTAL], [1], [build experimental features to freeciv-ruledit])
1128         ruledit=yes ;;
1129   *)   AC_MSG_ERROR([bad value ${enableval} for --enable-ruledit]) ;;
1130 esac], [ruledit=test])
1131 if test "x$ruledit" = "xyes" || test "x$ruledit" = "xtest" ; then
1132   if test "x$cxx_works" = "xyes" ; then
1133     FC_QT5
1135     if test "x$fc_qt5_usable" = "xtrue" ; then
1136       ruledit_cppflags=$FC_QT5_CPPFLAGS
1137       ruledit_cxxflags=$FC_QT5_CXXFLAGS
1138       ruledit_libs=$FC_QT5_LIBS
1139       ruledit=yes
1140     elif test "x$ruledit" = "xyes" ; then
1141       AC_MSG_ERROR([Qt5 not found for building freeciv-ruledit])
1142     fi
1143   elif test "x$ruledit" = "xyes" ; then
1144     AC_MSG_ERROR([No working C++ compiler found for building freeciv-ruledit])
1145   fi
1147 if test "x$ruledit" = "xtest" ; then
1148   dnl Still not set to 'yes' so failed tests
1149   ruledit=no
1150   feature_ruledit=missing
1152 AM_CONDITIONAL([RULEDIT], [test "x$ruledit" = "xyes"])
1154 AC_SUBST([gui_gtk2_cflags])
1155 AC_SUBST([gui_gtk2_libs])
1156 AC_SUBST([gui_gtk2_ldflags])
1157 AC_SUBST([gui_gtk3_22_cflags])
1158 AC_SUBST([gui_gtk3_22_libs])
1159 AC_SUBST([gui_gtk3_22_ldflags])
1160 AC_SUBST([gui_gtk3_cflags])
1161 AC_SUBST([gui_gtk3_libs])
1162 AC_SUBST([gui_gtk3_ldflags])
1163 AC_SUBST([gui_sdl_cflags])
1164 AC_SUBST([gui_sdl_libs])
1165 AC_SUBST([gui_sdl_ldflags])
1166 AC_SUBST([gui_sdl2_cflags])
1167 AC_SUBST([gui_sdl2_libs])
1168 AC_SUBST([gui_sdl2_ldflags])
1169 AC_SUBST([gui_xaw_cflags])
1170 AC_SUBST([gui_xaw_libs])
1171 AC_SUBST([gui_xaw_ldflags])
1172 AC_SUBST([gui_qt_cppflags])
1173 AC_SUBST([gui_qt_cflags])
1174 AC_SUBST([gui_qt_cxxflags])
1175 AC_SUBST([gui_qt_libs])
1176 AC_SUBST([gui_qt_ldflags])
1177 AC_SUBST([gui_stub_cflags])
1178 AC_SUBST([gui_stub_libs])
1179 AC_SUBST([gui_stub_ldflags])
1180 AC_SUBST([mp_cli_cflags])
1181 AC_SUBST([mp_cli_libs])
1182 AC_SUBST([mp_cli_ldflags])
1183 AC_SUBST([mp_gtk2_cflags])
1184 AC_SUBST([mp_gtk2_libs])
1185 AC_SUBST([mp_gtk2_ldflags])
1186 AC_SUBST([mp_gtk3_cflags])
1187 AC_SUBST([mp_gtk3_libs])
1188 AC_SUBST([mp_gtk3_ldflags])
1189 AC_SUBST([mp_qt_cppflags])
1190 AC_SUBST([mp_qt_cxxflags])
1191 AC_SUBST([mp_qt_libs])
1192 AC_SUBST([ruledit_cppflags])
1193 AC_SUBST([ruledit_cxxflags])
1194 AC_SUBST([ruledit_libs])
1195 AC_SUBST([SOUND_CFLAGS])
1196 AC_SUBST([SOUND_LIBS])
1197 AC_SUBST([VERSION_WITHOUT_LABEL])
1198 AC_SUBST([VERSION_LABEL])
1199 AC_SUBST([HOST_PATH_SEPARATOR])
1200 AC_SUBST([HOST_DIR_SEPARATOR])
1201 AM_CONDITIONAL(AUDIO_SDL, test "x$SDL_mixer" != "xno")
1202 AM_CONDITIONAL(CLIENT_GUI_SDL, test "x$gui_sdl" = "xyes")
1203 AM_CONDITIONAL(CLIENT_GUI_SDL2, test "x$gui_sdl2" = "xyes")
1204 AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "x$gui_gtk2" = "xyes")
1205 AM_CONDITIONAL(CLIENT_GUI_GTK_3_22, test "x$gui_gtk3_22" = "xyes")
1206 AM_CONDITIONAL(CLIENT_GUI_GTK_3_0, test "x$gui_gtk3" = "xyes")
1207 AM_CONDITIONAL(CLIENT_GUI_XAW, test "x$gui_xaw" = "xyes")
1208 AM_CONDITIONAL(CLIENT_GUI_QT, test "x$gui_qt" = "xyes")
1209 AM_CONDITIONAL(CLIENT_GUI_STUB, test "x$gui_stub" = "xyes")
1210 AM_CONDITIONAL(MINGW, test x"$MINGW" = "xyes")
1212 dnl Additional client libraries:
1213 if test "x$client" = "xyes"; then
1214     CLIENT_LIBS=" -lm "
1215     AC_SUBST(CLIENT_LIBS)
1218 dnl Checks for additional server libraries:
1219 if test "x$server" = "xyes"; then
1220     SERVER_LIBS="-lm ${SERVER_LIBS}"
1222     dnl Some systems (e.g., BeOS) need this lib
1223     AC_CHECK_LIB(bind, gethostbyaddr, SERVER_LIBS="-lbind $SERVER_LIBS")
1225     dnl Readline library and header files.
1226     FC_HAS_READLINE()
1227     AC_SUBST([SERVER_LIBS])
1228     AC_SUBST([SRV_LIB_LIBS])
1231 AC_CHECK_LIB(nls,main)
1233 dnl Checks for header files.
1234 AC_HEADER_STDC
1235 AC_HEADER_SYS_WAIT
1236 AC_CHECK_HEADERS([fcntl.h sys/utsname.h \
1237                   sys/file.h signal.h strings.h execinfo.h \
1238                   libgen.h])
1239 AC_CHECK_HEADERS([sys/time.h], [AC_DEFINE([FREECIV_HAVE_SYS_TIME_H], [1], [sys/time.h available])])
1240 AC_CHECK_HEADERS([unistd.h], [AC_DEFINE([FREECIV_HAVE_UNISTD_H], [1], [unistd.h available])])
1241 AC_CHECK_HEADERS([locale.h], [AC_DEFINE([FREECIV_HAVE_LOCALE_H], [1], [locale.h available])])
1242 AC_CHECK_HEADERS([libintl.h], [AC_DEFINE([FREECIV_HAVE_LIBINTL_H], [1], [libint.h available])])
1243 AC_HEADER_STDBOOL
1244 if test $ac_cv_header_stdbool_h = yes; then
1245   AC_DEFINE([FREECIV_HAVE_STDBOOL_H], [1], [Have standard compliant stdbool.h])
1248 AC_CHECK_HEADERS([pwd.h])
1250 dnl Avoid including the unix emulation layer if we build mingw executables
1251 dnl There would be type conflicts between winsock and bsd/unix includes
1252 if test "x$MINGW" != "xyes"; then
1253   AC_CHECK_HEADERS([arpa/inet.h netdb.h sys/ioctl.h \
1254                     sys/signal.h sys/termio.h \
1255                     sys/uio.h termios.h])
1256   AC_CHECK_HEADERS([sys/select.h], [AC_DEFINE([FREECIV_HAVE_SYS_SELECT_H], [1], [sys/select.h available])])
1257   AC_CHECK_HEADERS([netinet/in.h], [AC_DEFINE([FREECIV_HAVE_NETINET_IN_H], [1], [netinet/in.h available])])
1259 if test "x$gui_xaw" = "xyes" ; then
1260   dnl Want to get appropriate -I flags:
1261   fc_save_CPPFLAGS="$CPPFLAGS"
1262   CPPFLAGS="$CPPFLAGS $gui_xaw_cflags"
1263   AC_CHECK_HEADER(X11/xpm.h, ,
1264     AC_MSG_ERROR(need X11/xpm.h header; perhaps try/adjust --with-xpm-include))
1265   CPPFLAGS="$fc_save_CPPFLAGS"
1268 dnl Checks for typedefs, structures, and compiler characteristics.
1269 AC_C_CONST
1270 AC_HEADER_TIME
1271 AC_STRUCT_TM
1272 AC_CHECK_TYPES([socklen_t], [AC_DEFINE([FREECIV_HAVE_SOCKLEN_T], [1], [Have socklen_t type defined])],
1274 [#ifdef FREECIV_HAVE_SYS_TYPES_H
1275 #include <sys/types.h>
1276 #endif
1277 #ifdef FREECIV_HAVE_SYS_SOCKET_H
1278 #include <sys/socket.h>
1279 #endif
1280 #ifdef FREECIV_HAVE_WS2TCPIP_H
1281 #include <ws2tcpip.h>
1282 #endif
1284 AC_TYPE_INTPTR_T
1285 dnl Headers that might contain the intptr_t definition found earlier
1286 AC_CHECK_HEADERS([inttypes.h],
1287   [AC_DEFINE([FREECIV_HAVE_INTTYPES_H], [1], [inttypes.h available])])
1288 AC_CHECK_HEADERS([stdint.h],
1289   [AC_DEFINE([FREECIV_HAVE_STDINT_H], [1], [stdint.h available])])
1291 dnl Checks for library functions.
1292 AC_FUNC_FORK
1293 AC_FUNC_STRCOLL
1294 AC_FUNC_VPRINTF
1295 AC_FUNC_FSEEKO
1297 dnl Windows vsnprintf doesn't support argument reordering (see PR#12932)
1298 if test "x$MINGW" != "xyes"; then
1299 dnl The use of both FC_FUNC_VSNPRINTF and AC_CHECK_FUNCS(vsnprintf) is
1300 dnl deliberate.
1301 FC_FUNC_VSNPRINTF
1302 AC_CHECK_FUNCS([vsnprintf])
1305 AC_CHECK_FUNCS([bind connect fileno flock ftime gethostbyname gethostname \
1306                 getpwuid inet_aton select snooze strcasecmp strcasestr \
1307                 strerror strlcat strlcpy strncasecmp strstr uname usleep \
1308                 getline _strcoll stricoll _stricoll strcasecoll \
1309                 backtrace])
1311 dnl Possible "-Wmissing-declarations" and "-Werror" will prune out
1312 dnl cases where we should not use _mkdir() even if it's possible to link against it
1313 fc_save_CPPFLAGS="$CPPFLAGS"
1314 CPPFLAGS="$CPPFLAGS -Werror $EXTRA_DEBUG_CFLAGS"
1315 AC_CHECK_FUNCS([_mkdir])
1316 CPPFLAGS="$fc_save_CPPFLAGS"
1318 AC_MSG_CHECKING(for working gettimeofday)
1319   FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
1320         [Define if the gettimeofday function works and is sane.]),)
1322 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]],
1323 [[struct ip_mreqn req; req.imr_ifindex = 0;]])],
1324 [AC_DEFINE([HAVE_IP_MREQN], [1], [struct ip_mreqn available])])
1326 dnl Check for extra socket libraries.
1327 dnl If the AC_CHECK_FUNCS check finds the function, we don't look any
1328 dnl further.  This is rumoured to prevent choosing the wrong libs on IRIX.
1329 if test $ac_cv_func_gethostbyname = no; then
1330   AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS")
1332 if test $ac_cv_func_connect = no; then
1333   AC_CHECK_LIB(socket, connect, LIBS="-lsocket $LIBS")
1335 if test $ac_cv_func_bind = no; then
1336   AC_CHECK_LIB(bind, gethostbyaddr, LIBS="-lbind $LIBS")
1339 dnl Windows fdopen does not work with sockets.
1340 if test "x$MINGW" != "xyes"; then
1341   AC_CHECK_FUNCS(fdopen)
1344 dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated
1345 dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS,
1346 dnl and not in LIBS.
1348 dnl Now check if non blocking sockets are possible
1349 dnl (if fcntl or ioctl exists)
1351 AC_CHECK_FUNC([fcntl],
1352               [AC_DEFINE([HAVE_FCNTL], [1], [fcntl support])
1353                AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])],
1354                [AC_CHECK_FUNC([ioctl], 
1355                              [AC_DEFINE([HAVE_IOCTL], [1], [ioctl support])
1356                               AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])])])
1358 dnl Checks if SIGPIPE is usable
1359 AC_MSG_CHECKING([for SIGPIPE])
1360 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[signal (SIGPIPE, SIG_IGN)]])],[AC_MSG_RESULT([yes])
1361                 AC_DEFINE([HAVE_SIGPIPE], [1], [sigpipe support])],[AC_MSG_RESULT([no])])
1363 dnl export where the datadir is going to be installed
1364 FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
1366 if test x"$MINGW" = xyes; then
1367   DEFAULT_SAVE_PATH=".;~\\\\\\\\.freeciv\\\\\\\\saves"
1368   if test x$crosser = xyes ; then
1369     FC_CONF_PATH="../etc/freeciv"
1370     DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv;../share/freeciv"
1371     DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios;../share/freeciv/scenarios"
1372   else
1373     FC_CONF_PATH="etc\\\\\\\\freeciv"
1374     DEFAULT_DATA_PATH=".;data;~\\\\\\\\.freeciv\\\\\\\\$DATASUBDIR;$datadir\\\\\\\\freeciv"
1375     DEFAULT_SCENARIO_PATH=".;data\\\\\\\\scenarios;~\\\\\\\\.freeciv\\\\\\\\$DATASUBDIR\\\\\\\\scenarios;~\\\\\\\\.freeciv\\\\\\\\scenarios;$datadir\\\\\\\\freeciv\\\\\\\\scenarios"
1376   fi
1377 else
1378   FC_CONF_PATH="$sysconfdir/freeciv"
1379   DEFAULT_DATA_PATH=".:data:~/.freeciv/$DATASUBDIR:$datadir/freeciv"
1380   DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
1381   DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
1383 CPPFLAGS="$CPPFLAGS -DFC_CONF_PATH=\"\\\"$FC_CONF_PATH\\\"\""
1384 CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\""
1385 CPPFLAGS="$CPPFLAGS -DDEFAULT_SAVE_PATH=\"\\\"$DEFAULT_SAVE_PATH\\\"\""
1386 CPPFLAGS="$CPPFLAGS -DDEFAULT_SCENARIO_PATH=\"\\\"$DEFAULT_SCENARIO_PATH\\\"\""
1388 dnl This has to be last library
1389 if test -n "$WITH_EFENCE"; then
1390   AC_CHECK_LIB(efence, malloc, [ 
1391   if test "x$LIBS" = "x"; then
1392     LIBS = -lefence
1393   else
1394     LIBS="$LIBS -lefence"
1395   fi])
1398 AC_ARG_ENABLE([sys-lua],
1399   AS_HELP_STRING([--enable-sys-lua], [use lua from system instead of one from freeciv tree [test]]),
1400 [case "${enableval}" in
1401   yes)
1402     sys_lua=true ;;
1403   no)
1404     sys_lua=false ;;
1405   test)
1406     sys_lua=test ;;
1407   *)   AC_MSG_ERROR([bad value ${enableval} for --enable-sys-lua]) ;;
1408 esac], [sys_lua=test])
1410 dnl There's wide divergence on what the pkg-config file for Lua is called
1411 dnl See http://lua-users.org/lists/lua-l/2008-09/msg00184.html
1412 if test "x$sys_lua" = "xtrue" || test "x$sys_lua" = "xtest" ; then
1413   PKG_CHECK_MODULES([LUA], [lua5.3], [sys_lua=true],
1414     [PKG_CHECK_MODULES([LUA], [lua-5.3], [sys_lua=true],
1415       [PKG_CHECK_MODULES([LUA], [lua >= 5.3 lua < 5.4], [sys_lua=true],
1416 [if test "x$sys_lua" = "xtrue" ; then
1417   AC_MSG_ERROR([Use of included lua disabled, and no lua found from system])
1419 feature_syslua=missing
1420 sys_lua=false])])])
1423 if test "x$sys_lua" != "xtrue" ; then
1424   dnl Checks needed for included lua.
1425   gl_FUNC_MKSTEMP
1426   if test "x$gl_cv_func_working_mkstemp" = xyes ; then
1427     dnl if only "guessing yes", do not try to use mkstemp, but fallback
1428     AC_DEFINE([HAVE_MKSTEMP], [1], [Have working mkstemp])
1429   fi
1430   AC_CHECK_FUNCS([popen pclose _longjmp _setjmp gmtime_r localtime_r])
1432   LUA_CFLAGS="-I\$(top_srcdir)/dependencies/lua-5.3/src"
1433   LUA_LIBS="\$(top_builddir)/dependencies/lua-5.3/src/liblua.la"
1436 AC_SUBST([LUA_CFLAGS])
1437 AC_SUBST([LUA_LIBS])
1438 AM_CONDITIONAL([SYS_LUA], [test "x$sys_lua" = "xtrue"])
1440 if test x$enable_fcdb = xyes ; then
1441   LUASQL_CFLAGS="-I\$(top_srcdir)/dependencies/luasql/src"
1442   LUASQL_LIBS="\$(top_builddir)/dependencies/luasql/src/libluasql_base.la"
1443   if test x$fcdb_mysql = xyes ; then
1444     LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_mysql.la"
1445   fi
1446   if test x$fcdb_postgres = xyes ; then
1447     LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_postgres.la"
1448   fi
1449   if test x$fcdb_sqlite3 = xyes ; then
1450     LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_sqlite3.la"
1451   fi
1452   LUASQL_AS_DEPENDENCY="$LUASQL_LIBS"
1453   LUASQL_LIBS="$LUASQL_LIBS $FCDB_MYSQL_LIBS $FCDB_POSTGRES_LIBS $FCDB_SQLITE3_LIBS"
1455   AC_SUBST([LUASQL_CFLAGS])
1456   AC_SUBST([LUASQL_LIBS])
1457   AC_SUBST([LUASQL_AS_DEPENDENCY])
1460 AC_ARG_ENABLE([sys-tolua-cmd],
1461   AS_HELP_STRING([--enable-sys-tolua-cmd], [use tolua command from build system instead of one from freeciv tree [true_when_cross-compiling]]),
1462 [case "${enableval}" in
1463   yes)
1464     sys_tolua_cmd=true ;;
1465   no)
1466     if test "x$cross_compiling" = "xyes" ; then
1467       AC_MSG_ERROR([Must use external build system tolua command when cross-compiling])
1468     fi
1469     sys_tolua_cmd=false ;;
1470   *)
1471     sys_tolua_cmd=${enableval} ;;
1472 esac], [
1473 if test "x$cross_compiling" = "xyes" ; then
1474   sys_tolua_cmd=true
1475 else
1476   sys_tolua_cmd=test
1477 fi])
1479 if test "x$sys_tolua_cmd" = "xtrue" || test "x$sys_tolua_cmd" = "xtest" ; then
1480   AC_PATH_PROG([TOLUA], [tolua], [notfound])
1481   if test "x$TOLUA" = "xnotfound" ; then
1482     if test "x$sys_tolua_cmd" = "xtest" ; then
1483       TOLUA="\$(top_builddir)/dependencies/tolua-5.2/src/bin/tolua$EXEEXT"
1484       feature_systolua_cmd=missing
1485     else
1486       AC_MSG_ERROR([tolua command not found from the system])
1487     fi
1488   fi
1489 elif test "x$sys_tolua_cmd" != "xfalse" ; then
1490   TOLUA=$sys_tolua_cmd
1491 else
1492   TOLUA="\$(top_builddir)/dependencies/tolua-5.2/src/bin/tolua$EXEEXT"
1495 AC_SUBST([TOLUA])
1497 TOLUA_CFLAGS="-I\$(top_srcdir)/dependencies/tolua-5.2/include"
1498 TOLUA_LIBS="\$(top_builddir)/dependencies/tolua-5.2/src/lib/libtolua.la"
1499 AC_SUBST([TOLUA_CFLAGS])
1500 AC_SUBST([TOLUA_LIBS])
1502 dnl The BeOS sys/uio.h is broken.  This kludges it out of existence.
1503 dnl (This still causes lots of spurious changes to fc_config.h on BeOS.)
1504 AC_CONFIG_COMMANDS([fc_default-5],[[if test x`uname -s` = xBeOS ; then
1505      if grep '#define HAVE_SYS_UIO_H 1' fc_config.h >/dev/null 2>&1 ; then
1506        echo kluging fc_config.h
1507        mv -f fc_config.h fc_config.h.tmp
1508        sed -e 's/#define HAVE_SYS_UIO_H 1/#undef HAVE_SYS_UIO_H/g' fc_config.h.tmp > fc_config.h
1509        rm fc_config.h.tmp
1510      fi
1511    fi]],[[]])
1513 CFLAGS="$EXTRA_DEBUG_CFLAGS $CFLAGS"
1514 CXXFLAGS="$EXTRA_DEBUG_CXXFLAGS $CXXFLAGS"
1515 LDFLAGS="$EXTRA_DEBUG_LDFLAGS $LDFLAGS"
1517 dnl Rebuild 'configure' whenever fc_version changes, if maintainer mode enabled.
1518 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/fc_version"])
1520 dnl Make sure that fc_config.h changes when ever CPPFLAGS, CFLAGS or CXXFLAGS
1521 dnl change so everything gets rebuilt. LDFLAGS is not handled here
1522 dnl since change in it should not cause recompilation, only relinking.
1523 dnl Note: Variables are named FC_STORE_* instead of FC_*_STORE in order to
1524 dnl make them appear next to each other in fc_config.h.
1525 FC_STORE_CPPFLAGS="$(echo $CPPFLAGS | $SED 's/\\/\\\\/g' | $SED 's/\"/\\\"/g')"
1526 AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ["$FC_STORE_CPPFLAGS"],
1527                    [These are the CPPFLAGS used in compilation])
1528 FC_STORE_CFLAGS="$(echo $CFLAGS | $SED 's/\\/\\\\/g' | $SED 's/\"/\\\"/g')"
1529 AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ["$FC_STORE_CFLAGS"],
1530                    [These are the CFLAGS used in compilation])
1531 FC_STORE_CXXFLAGS="$(echo $CXXFLAGS | $SED 's/\\/\\\\/g' | $SED 's/\"/\\\"/g')"
1532 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ["$FC_STORE_CXXFLAGS"],
1533                    [These are the CXXFLAGS used in compilation])
1535 dnl If old default of AR_FLAGS is otherwise being used (because of older automake),
1536 dnl replace it with one without 'u'
1537 if test "x$AR_FLAGS" = "xcru" ; then
1538   AR_FLAGS="cr"
1541 AC_CONFIG_FILES([Makefile
1542           data/Makefile
1543           data/hex2t/Makefile
1544           data/hexemplio/Makefile
1545           data/amplio2/Makefile
1546           data/buildings/Makefile
1547           data/flags/Makefile
1548           data/misc/Makefile
1549           data/cimpletoon/Makefile
1550           data/trident/Makefile
1551           data/isophex/Makefile
1552           data/isotrident/Makefile
1553           data/stdsounds/Makefile
1554           data/stdmusic/Makefile
1555           data/override/Makefile
1556           data/default/Makefile
1557           data/classic/Makefile
1558           data/multiplayer/Makefile
1559           data/experimental/Makefile
1560           data/civ2civ3/Makefile
1561           data/civ1/Makefile
1562           data/civ2/Makefile
1563           data/scenarios/Makefile
1564           data/nation/Makefile
1565           data/themes/Makefile
1566           data/themes/gui-gtk-2.0/Makefile
1567           data/themes/gui-gtk-2.0/Freeciv/Makefile
1568           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Makefile
1569           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Arrows/Makefile
1570           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Buttons/Makefile
1571           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Check-Radio/Makefile
1572           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Combo/Makefile
1573           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Frame-Gap/Makefile
1574           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Handles/Makefile
1575           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Lines/Makefile
1576           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ListHeaders/Makefile
1577           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Menu-Menubar/Makefile
1578           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Others/Makefile
1579           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Panel/Makefile
1580           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ProgressBar/Makefile
1581           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Range/Makefile
1582           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Scrollbars/Makefile
1583           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Shadows/Makefile
1584           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Spin/Makefile
1585           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Tabs/Makefile
1586           data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Toolbar/Makefile
1587           data/themes/gui-gtk-3.0/Makefile
1588           data/themes/gui-gtk-3.0/Freeciv/Makefile
1589           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Makefile
1590           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Arrows/Makefile
1591           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Buttons/Makefile
1592           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Check-Radio/Makefile
1593           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Combo/Makefile
1594           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Frame-Gap/Makefile
1595           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Handles/Makefile
1596           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Lines/Makefile
1597           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ListHeaders/Makefile
1598           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Menu-Menubar/Makefile
1599           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Others/Makefile
1600           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Panel/Makefile
1601           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ProgressBar/Makefile
1602           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Range/Makefile
1603           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Scrollbars/Makefile
1604           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Shadows/Makefile
1605           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Spin/Makefile
1606           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile
1607           data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile
1608           data/themes/gui-gtk-3.22/Makefile
1609           data/themes/gui-gtk-3.22/Freeciv/Makefile
1610           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Makefile
1611           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Arrows/Makefile
1612           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Buttons/Makefile
1613           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Check-Radio/Makefile
1614           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Combo/Makefile
1615           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Frame-Gap/Makefile
1616           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Handles/Makefile
1617           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Lines/Makefile
1618           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/ListHeaders/Makefile
1619           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Menu-Menubar/Makefile
1620           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Others/Makefile
1621           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Panel/Makefile
1622           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/ProgressBar/Makefile
1623           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Range/Makefile
1624           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Scrollbars/Makefile
1625           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Shadows/Makefile
1626           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Spin/Makefile
1627           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Tabs/Makefile
1628           data/themes/gui-gtk-3.22/Freeciv/gtk-3.0/Toolbar/Makefile
1629           data/themes/gui-qt/Makefile
1630           data/themes/gui-qt/icons/Makefile
1631           data/themes/gui-qt/Classic/Makefile
1632           data/themes/gui-qt/Necrophos/Makefile
1633           data/themes/gui-qt/NightStalker/Makefile
1634           data/themes/gui-qt/System/Makefile
1635           data/themes/gui-sdl/Makefile
1636           data/themes/gui-sdl/human/Makefile
1637           data/themes/gui-sdl2/Makefile
1638           data/themes/gui-sdl2/human/Makefile
1639           data/wonders/Makefile
1640           data/icons/Makefile
1641           utility/Makefile
1642           dependencies/Makefile
1643           dependencies/lua-5.3/Makefile
1644           dependencies/lua-5.3/src/Makefile
1645           dependencies/tolua-5.2/Makefile
1646           dependencies/tolua-5.2/src/Makefile
1647           dependencies/tolua-5.2/src/lib/Makefile
1648           dependencies/tolua-5.2/src/bin/Makefile
1649           dependencies/luasql/Makefile
1650           dependencies/luasql/src/Makefile
1651           dependencies/cvercmp/Makefile  
1652           common/Makefile
1653           common/aicore/Makefile
1654           common/scriptcore/Makefile
1655           ai/Makefile
1656           ai/default/Makefile
1657           ai/classic/Makefile
1658           ai/stub/Makefile
1659           ai/threaded/Makefile
1660           tests/Makefile
1661           win32/Makefile
1662           client/Makefile
1663           client/agents/Makefile
1664           client/include/Makefile
1665           client/gui-sdl/Makefile
1666           client/gui-sdl2/Makefile
1667           client/gui-gtk-2.0/Makefile
1668           client/gui-gtk-3.0/Makefile
1669           client/gui-gtk-3.22/Makefile
1670           client/gui-xaw/Makefile
1671           client/gui-qt/Makefile
1672           client/gui-stub/Makefile
1673           client/luascript/Makefile
1674           server/Makefile
1675           server/advisors/Makefile
1676           server/generator/Makefile
1677           server/scripting/Makefile
1678           tools/Makefile
1679           tools/ruledit/Makefile
1680           gen_headers/Makefile
1681           translations/Makefile
1682           translations/freeciv/Makefile.in
1683           translations/nations/Makefile.in
1684           translations/ruledit/Makefile.in
1685           doc/Makefile
1686           doc/man/Makefile
1687           doc/man/freeciv-client.6
1688           doc/man/freeciv-server.6
1689           doc/man/freeciv-manual.6
1690           doc/man/freeciv-modpack.6
1691           doc/man/freeciv-ruledit.6
1692           doc/ca/Makefile
1693           doc/de/Makefile
1694           doc/fr/Makefile
1695           doc/it/Makefile
1696           doc/ja/Makefile
1697           doc/nl/Makefile
1698           doc/sv/Makefile
1699           bootstrap/Makefile
1700           data/Freeciv
1701           lua/Makefile
1702           client/freeciv.desktop:bootstrap/freeciv.desktop.in
1703           client/freeciv-gtk3.22.desktop:bootstrap/freeciv-gtk3.22.desktop.in
1704           client/freeciv-gtk2.desktop:bootstrap/freeciv-gtk2.desktop.in
1705           client/freeciv-sdl.desktop:bootstrap/freeciv-sdl.desktop.in
1706           client/freeciv-sdl2.desktop:bootstrap/freeciv-sdl2.desktop.in
1707           client/freeciv-qt.desktop:bootstrap/freeciv-qt.desktop.in
1708           server/freeciv-server.desktop:bootstrap/freeciv-server.desktop.in
1709           tools/freeciv-mp-gtk3.desktop:bootstrap/freeciv-mp-gtk3.desktop.in
1710           tools/freeciv-mp-gtk2.desktop:bootstrap/freeciv-mp-gtk2.desktop.in
1711           tools/freeciv-mp-qt.desktop:bootstrap/freeciv-mp-qt.desktop.in
1712           tools/ruledit/freeciv-ruledit.desktop:bootstrap/freeciv-ruledit.desktop.in
1713           client/freeciv-gtk2.appdata.xml:bootstrap/freeciv-gtk2.appdata.xml.in
1714           client/freeciv-gtk3.appdata.xml:bootstrap/freeciv-gtk3.appdata.xml.in
1715           client/freeciv-gtk3.22.appdata.xml:bootstrap/freeciv-gtk3.22.appdata.xml.in
1716           client/freeciv-sdl.appdata.xml:bootstrap/freeciv-sdl.appdata.xml.in
1717           client/freeciv-sdl2.appdata.xml:bootstrap/freeciv-sdl2.appdata.xml.in
1718           client/freeciv-qt.appdata.xml:bootstrap/freeciv-qt.appdata.xml.in
1719           server/freeciv-server.appdata.xml:bootstrap/freeciv-server.appdata.xml.in
1720           tools/freeciv-mp-gtk2.appdata.xml:bootstrap/freeciv-mp-gtk2.appdata.xml.in
1721           tools/freeciv-mp-gtk3.appdata.xml:bootstrap/freeciv-mp-gtk3.appdata.xml.in
1722           tools/freeciv-mp-qt.appdata.xml:bootstrap/freeciv-mp-qt.appdata.xml.in
1723           tools/ruledit/freeciv-ruledit.appdata.xml:bootstrap/freeciv-ruledit.appdata.xml.in])
1724 AC_CONFIG_FILES([fcgui:bootstrap/fcgui.in], [chmod +x fcgui])
1725 AC_CONFIG_FILES([fcser:bootstrap/fcser.in], [chmod +x fcser])
1726 if test "x$ruledit" = "xyes" ; then
1727   AC_CONFIG_FILES([fcruledit:bootstrap/fcruledit.in], [chmod +x fcruledit])
1730 AC_OUTPUT
1732 AC_MSG_NOTICE([
1733 ****************** Configuration Summary ******************
1735   == General build options ==
1736   Shared libraries:      $enable_shared
1737   Debugging support:     $enable_debug
1738   Profiling support:     $enable_gprof
1739   IPv6 support:          $enable_ipv6
1740   Map image toolkits:    $enable_mapimg
1741     ppm:                   built-in
1742     MagickWand:            $mapimg_magickwand
1744   == Client ==
1745   Build freeciv client:  $client
1747   Maintained client frontends:
1748     Gtk-3.0: $gui_gtk3
1749     Gtk-2.0: $gui_gtk2
1750     SDL:     $gui_sdl
1751     QT:      $gui_qt
1752     Stub:    $gui_stub
1754   In-development client frontends:
1755   (these are not yet ready for general use)
1756     Gtk-3.22: $gui_gtk3_22
1757     SDL2:     $gui_sdl2
1759   Not maintained client frontends:
1760     Xaw:     $gui_xaw
1762   == Server ==
1763   Build freeciv server:  $server
1764     AI modules support:    $enable_aimodules
1765     Database support:      $enable_fcdb
1766       mysql:                 $fcdb_mysql
1767       postgres:              $fcdb_postgres
1768       sqlite3:               $fcdb_sqlite3
1770   == Tools ==
1771   Modpack installers:   $fcmp_list
1772   Ruleset editor:        $ruledit
1773   Manual generator:      $fcmanual
1776 FC_MISSING_FEATURES