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