1 dnl configure.ac for freeciv
2 dnl Process this file with autoconf to produce a configure script.
4 dnl Initialize with some random file to ensure the source is here.
5 AC_INIT([freeciv], m4_esyscmd([./fc_version | tr -d '\n']))
7 AC_CONFIG_SRCDIR([common/game.c])
8 AC_CONFIG_AUX_DIR(bootstrap) # This can't be quoted or automake will fail
9 AC_CONFIG_MACRO_DIR([m4])
10 ifdef([AC_CONFIG_MACRO_DIRS],[AC_CONFIG_MACRO_DIRS([dependencies/m4])])
11 AC_CONFIG_HEADERS([fc_config.h])
13 AC_USE_SYSTEM_EXTENSIONS
16 BUG_URL="http://gna.org/projects/freeciv/"
17 WIKI_URL="http://www.freeciv.org/"
18 MAIL_ADDRESS="freeciv-dev AT gna.org"
20 AC_DEFINE(FC_CONFIG_H, 1, [Configuration autogenerated])
21 AC_DEFINE_UNQUOTED([BUG_URL], ["$BUG_URL"], [Bug reporting URL])
22 AC_DEFINE(META_URL, "http://meta.freeciv.org/metaserver.php", [Meta server URL])
23 AC_DEFINE_UNQUOTED([WIKI_URL], ["$WIKI_URL"], [Informational URL])
25 AC_DEFINE(DEFAULT_SOCK_PORT, 5556, [Connection TCP Port])
29 AC_SUBST([MAIL_ADDRESS])
31 dnl client/server should always have the same major and minor versions
32 dnl different patch versions are compatible
33 VERSION_SCRIPT_SILENT=yes
34 m4_include(fc_version)
36 VERSION_WITHOUT_LABEL=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}
37 VERSION=${VERSION_WITHOUT_LABEL}${VERSION_LABEL}
39 AC_DEFINE_UNQUOTED([MAJOR_VERSION], [$MAJOR_VERSION], [Major version])
40 AC_DEFINE_UNQUOTED([MINOR_VERSION], [$MINOR_VERSION], [Minor version])
41 AC_DEFINE_UNQUOTED([PATCH_VERSION], [$PATCH_VERSION], [Patch version])
42 AC_DEFINE_UNQUOTED([VERSION_LABEL], ["${VERSION_LABEL}"], [Version label])
43 AC_DEFINE_UNQUOTED([VERSION_STRING], ["${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${VERSION_LABEL}"], [Version string])
44 AC_DEFINE_UNQUOTED([IS_DEVEL_VERSION], [$IS_DEVEL_VERSION], [Is this a devel version])
45 AC_DEFINE_UNQUOTED([IS_FREEZE_VERSION], [$IS_FREEZE_VERSION], [Is this a frozen version])
46 AC_DEFINE_UNQUOTED([IS_BETA_VERSION], [$IS_BETA_VERSION], [Is this a beta version])
47 AC_DEFINE_UNQUOTED([NEXT_STABLE_VERSION], ["$NEXT_STABLE_VERSION"], [Version number of next release])
48 AC_DEFINE_UNQUOTED([RELEASE_MONTH], [$RELEASE_MONTH], [Month next version will be released])
49 AC_SUBST([MAJOR_VERSION])
50 AC_SUBST([MINOR_VERSION])
52 AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_MANDATORY],
53 ["$NETWORK_CAPSTRING_MANDATORY"],
54 [Network capability string])
55 AC_SUBST([NETWORK_CAPSTRING_MANDATORY])
56 AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_OPTIONAL],
57 ["$NETWORK_CAPSTRING_OPTIONAL"],
58 [Additional optional network capabilities])
59 AC_SUBST([NETWORK_CAPSTRING_OPTIONAL])
61 AC_DEFINE_UNQUOTED([DATASUBDIR],
63 [Version specific subdir for default data path])
64 AC_SUBST([DATASUBDIR])
66 AC_DEFINE_UNQUOTED([FREECIV_DISTRIBUTOR], ["$FREECIV_DISTRIBUTOR"],
67 [Distribution this freeciv is built for])
69 dnl Initialize automake stuff
70 AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
72 dnl Use Automake 1.11 silent rules by default if available
73 dnl verbose build using make V=1
74 ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
80 dnl Sed is needed for the configuration
81 dnl of the clients, database setting and the mapimg toolkits.
84 dnl set default values
90 dnl checks for databases
91 dnl all: Autodetect as many as possible [default].
92 dnl mysql: use mysql database
93 dnl postgres: use postgres database
94 dnl comma-separated-list: Detect these or abort.
96 AS_HELP_STRING([--enable-fcdb[=no/all/mysql/postgres/sqlite3]],
97 [database backends [no](no, or list)]),
98 [databases=${enableval}],
101 for db in $(echo $databases | $SED 's/,/ /g') ; do
102 if test "x$db" = "xall" ; then
104 elif test "x$db" = "xno" ; then
106 elif test "x$db" = "xmysql" ; then
108 elif test "x$db" = "xpostgres" ; then
110 elif test "x$db" = "xsqlite3" ; then
113 AC_MSG_ERROR([bad value ${db} for --enable-fcdb])
117 dnl checks for database mysql
118 dnl sets FCDB_MYSQL(conditional), FCDB_MYSQL_CFLAGS
121 dnl checks for database postgres
122 dnl sets FCDB_POSTGRES(conditional), FCDB_POSTGRES_CFLAGS
125 dnl checks for database sqlite3
126 dnl sets FCDB_SQLITE3(conditional), FCDB_SQLITE3_CFLAGS
129 dnl check if a database backend is available
130 if test "x$fcdb_mysql" = "xyes" || test "x$fcdb_postgres" = "xyes" \
131 || test "x$fcdb_sqlite3" = "xyes"; then
133 AC_DEFINE([HAVE_FCDB], [1], [Database backend available])
137 AM_CONDITIONAL([FCDB_DB], [test "x$enable_fcdb" = "xyes"])
139 dnl no=do not compile server, yes=compile server, *=error
140 AC_ARG_ENABLE([server],
141 AS_HELP_STRING([--disable-server], [do not compile the server]),
142 [case "${enableval}" in
145 *) AC_MSG_ERROR(bad value ${enableval} for --disable-server) ;;
147 AM_CONDITIONAL(SERVER, test x$server = xyes)
149 dnl yes - Support for IPv6 required
150 dnl no - Legacy IPv4 support
151 dnl test - Try to enable IPv6 support
152 AC_ARG_ENABLE([ipv6],
153 AS_HELP_STRING([--enable-ipv6=yes/no/test], [use IPv6 [test]]),
154 [case "${enableval}" in
155 yes|no|test) ipv6=${enableval} ;;
156 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
158 if test x$ipv6 != xno ; then
160 dnl We check some functions (getaddrinfo) twice. Once unconditionally
161 dnl to get HAVE_xxx always correctly set. We need separate check here to
162 dnl correcly disable IPv6 when function is not available.
163 AC_CHECK_FUNCS([getaddrinfo inet_pton inet_ntop getnameinfo],
164 [], [enable_ipv6=no])
165 if test x$enable_ipv6 = xyes ; then
166 AC_MSG_CHECKING([for AF_INET6])
167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
168 #include <sys/types.h>
169 #include <sys/socket.h>
170 ]], [[return AF_INET6;]])], [AC_MSG_RESULT([yes])],
174 if test x$enable_ipv6 = xno && test x$ipv6 = xyes ; then
175 AC_MSG_ERROR([Cannot enable IPv6 functionality])
177 if test x$enable_ipv6 = xyes ; then
178 AC_DEFINE([IPV6_SUPPORT], [1], [IPv6 Support built in])
184 AC_ARG_WITH([readline],
185 AS_HELP_STRING([--with-readline], [support fancy command line editing]),
186 WITH_READLINE=$withval, dnl yes/no - required to use / never use
187 WITH_READLINE="maybe" dnl maybe - use if found [default]
190 FOLLOWTAG=${DEFAULT_FOLLOW_TAG}
191 AC_ARG_WITH([followtag],
192 AS_HELP_STRING([--with-followtag], [version tag to follow]),
193 [FOLLOWTAG=${withval}])
194 AC_DEFINE_UNQUOTED([FOLLOWTAG], ["${FOLLOWTAG}"], [Version tag to follow])
196 AC_ARG_WITH([desktopdir],
197 AS_HELP_STRING([--with-desktopdir], [install desktop files to given dir]),
198 [ DESKTOPDIR=${withval} ], [ DESKTOPDIR="\$(prefix)/share/applications" ])
199 AC_SUBST([DESKTOPDIR])
201 AC_ARG_WITH([appdatadir],
202 AS_HELP_STRING([--with-appdatadir], [install appdata files to given dir]),
203 [ APPDATADIR=${withval} ], [ APPDATADIR="\$(prefix)/share/appdata" ])
204 AC_SUBST([APPDATADIR])
206 dnl set default values
211 dnl all: Autodetect as many as possible [default].
212 dnl no: No additional toolkits.
213 dnl magickwand: compile magickwand (imagemagick) support.
214 dnl comma-separated-list: Detect these or abort.
215 AC_ARG_ENABLE([mapimg],
216 AS_HELP_STRING([--enable-mapimg=no/auto/magickwand],
217 [additional map image toolkits to compile [auto](no, or list)]),
218 [toolkits=${enableval}],
219 [enable_mapimg=auto])
221 for toolkit in $(echo $toolkits | $SED 's/,/ /g') ; do
222 if test "x$toolkit" = "xauto" ; then
224 elif test "x$toolkit" = "xno" ; then
227 enable_mapimg=selected
230 if test "x$toolkit" = "xmagickwand" ; then
231 mapimg_magickwand=yes
235 dnl checks for MagickWand mapimg support
236 dnl sets MAPIMG_WAND_CFLAGS, MAPIMG_WAND_LIBS
239 dnl no: Do not compile client.
240 dnl auto: Autodetect one.
241 dnl all: Autodetect as many as possible.
242 dnl comma-separated-list: Detect these or abort.
243 AC_ARG_ENABLE([client],
244 AS_HELP_STRING([--enable-client=auto/all/gtk2/gtk3/sdl/xaw/qt/stub],
245 [clients to compile [auto](list for multiple)]),
246 [clients=${enableval}],
256 for gui in $(echo $clients | $SED 's/,/ /g') ; do
257 if test "x$gui" = "xno" ; then
259 elif test "x$gui" = "xauto" ; then
261 elif test "x$gui" = "xall" ; then
264 if test "x$gui" = "xgtk2" ||
265 test "x$gui" = "xgtk2.0" ||
266 test "x$gui" = "xgtk20" ||
267 test "x$gui" = "xgtk-2.0" ; then
269 elif test "x$gui" = "xgtk3" ||
270 test "x$gui" = "xgtk3.0" ||
271 test "x$gui" = "xgtk30" ||
272 test "x$gui" = "xgtk-3.0" ; then
274 elif test "x$gui" = "xgtk" ; then
275 AC_MSG_WARN([for requested client 'gtk' enabled gtk2-client, but that default changes in the future])
278 if test ! -d "${srcdir}/client/gui-$gui" ; then
279 AC_MSG_ERROR(bad value ${gui} for --enable-client)
288 AS_HELP_STRING([--with-xaw], [use the Xaw widget set for the xaw client]),
293 AS_HELP_STRING([--with-xaw3d], [use the Xaw3d widget set for the xaw client]),
297 if test "x$WITH_XAW" != "x" && test "x$WITH_XAW3D" != "x" ; then
298 AC_MSG_ERROR(Cannot use both --with-xaw and --with-xaw3d at the same time)
301 AC_ARG_ENABLE([svnrev],
302 AS_HELP_STRING([--enable-svnrev], [get svn revision to version information]),
303 [case "${enableval}" in
306 *) AC_MSG_ERROR([bad value ${enableval} for --enable-svnrev]) ;;
307 esac], [svnrev=false])
308 AM_CONDITIONAL([SVNREV], [test x$svnrev = xtrue])
309 if test x$svnrev = xtrue ; then
310 AC_DEFINE([SVNREV], [1], [Get svn revision information to version number])
313 AC_ARG_ENABLE([gitrev],
314 AS_HELP_STRING([--enable-gitrev], [get git revision to version information]),
315 [case "${enableval}" in
318 *) AC_MSG_ERROR([bad value ${enableval} for --enable-gitrev]) ;;
319 esac], [gitrev=false])
320 AM_CONDITIONAL([GITREV], [test x$gitrev = xtrue])
321 if test x$gitrev = xtrue ; then
322 AC_DEFINE([GITREV], [1], [Get git revision information to version number])
325 AC_ARG_ENABLE([make_data],
326 AS_HELP_STRING([--disable-make-data], [do not recurse make into data directories]),
327 [case "${enableval}" in
328 yes) make_data=true ;;
329 no) make_data=false ;;
330 *) AC_MSG_ERROR(bad value ${enableval} for --disable-make-data) ;;
331 esac], [make_data=true])
332 AM_CONDITIONAL(MAKE_DATA, test x$make_data = xtrue)
334 AC_ARG_ENABLE([make_include],
335 AS_HELP_STRING([--enable-make-include], [force make to recurse into include directory]),
336 [case "${enableval}" in
337 yes) make_include=true ;;
338 no) make_include=false ;;
339 *) AC_MSG_ERROR(bad value ${enableval} for --enable-make-include) ;;
340 esac], [make_include=false])
341 AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test "$make_include" = "true")
343 AC_ARG_WITH([efence],
344 AS_HELP_STRING([--with-efence], [use Electric Fence, malloc debugger]),
348 AC_ARG_ENABLE([aimodules],
349 AS_HELP_STRING([--enable-aimodules=yes/no/experimental], [support for ai modules [no]]),
350 [case "${enableval}" in
351 yes) enable_aimodules=yes ;;
352 no) enable_aimodules=no ;;
353 experimental) enable_aimodules=yes
355 *) AC_MSG_ERROR([bad value ${enable_aimodules} for --enable-aimodules]) ;;
356 esac], [enable_aimodules=no])
357 aimoduledir="${libdir}/fcai"
358 AC_SUBST(aimoduledir)
359 AM_CONDITIONAL(AI_MODULES, test "x$enable_aimodules" = "xyes")
360 if test $enable_aimodules = yes ; then
361 if test x$enable_shared != xyes ; then
362 AC_MSG_ERROR([cannot enable ai module support if also build of shared libraries is not enabled with --enable-shared])
366 AC_MSG_CHECKING([whether can build modules])
367 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ltdl.h>]],
368 [[lt_dlopenext(NULL);]])],
369 [AC_MSG_RESULT([yes])],
371 AC_MSG_ERROR([cannot build loadable AI modules as requested])])
373 SERVER_LIBS="${SERVER_LIBS} -lltdl"
374 AC_DEFINE([AI_MODULES], [1], [Enable ai modules])
375 CPPFLAGS="${CPPFLAGS} -DAI_MODULEDIR=\"\\\"${aimoduledir}\\\"\""
376 ai_mod_default_needed=yes
378 AM_CONDITIONAL(EXP_AI_MODULES, test "x$exp_aimodules" = "xyes")
380 AC_ARG_ENABLE([ai-static],
381 AS_HELP_STRING([--enable-ai-static], [statically link listed modules to server]),
382 [static_modules="${enableval}"],
383 [static_modules="classic"])
385 ai_mod_static_classic=no
386 ai_mod_static_threaded=no
388 for module in $(echo $static_modules | $SED 's/,/ /g') ; do
389 if test "x$module" = "xclassic" ; then
390 ai_mod_static_classic=yes
391 ai_mod_default_needed=yes
392 AC_DEFINE([AI_MOD_STATIC_CLASSIC], [1],
393 [classic ai module statically linked])
394 elif test "x$module" = "xthreaded" ; then
395 ai_mod_static_threaded=yes
396 ai_mod_default_needed=yes
397 AC_DEFINE([AI_MOD_STATIC_THREADED], [1],
398 [threaded ai module statically linked])
400 AC_MSG_ERROR([bad value ${module} for --enable-ai-static])
402 if test "x$default_ai_set" = "x" ; then
403 dnl Make first static module default ai type
404 default_ai_set="${module}"
407 AM_CONDITIONAL([AI_MOD_STATIC_CLASSIC],
408 [test "x$ai_mod_static_classic" = "xyes" || test "x$enable_aimodules" != "xyes"])
409 AM_CONDITIONAL([AI_MOD_STATIC_THREADED],
410 [test "x$ai_mod_static_threaded" = "xyes"])
412 AC_ARG_WITH([default-ai],
413 AS_HELP_STRING([--with-default-ai], [default ai type [first static]]),
414 [default_ai_set="${withval}"],
417 AM_CONDITIONAL([AI_MOD_DEFAULT_NEEDED],
418 [test "x${ai_mod_default_needed}" = "xyes" || test "x${default_ai_set}" = "x"])
420 if test "x${default_ai_set}" = "x" ; then
421 default_ai_set="classic"
425 if test "x$ai_mod_static_classic" = "xyes" ; then
426 fc_ai_last=$fc_ai_last+1
428 if test "x$ai_mod_static_threaded" = "xyes" ; then
429 fc_ai_last=$fc_ai_last+1
431 if test "x$enable_aimodules" = "xyes" ; then
432 dnl Dynamic modules allowed, give slots for them
433 fc_ai_last=$fc_ai_last+3
435 AC_DEFINE_UNQUOTED([FC_AI_LAST], [(${fc_ai_last})], [Max number of AI modules])
437 AC_DEFINE_UNQUOTED([AI_MOD_DEFAULT], ["${default_ai_set}"], [Default ai type name])
439 dnl Checks for programs.
445 dnl Replace AC_PROG_LIBTOOL with LT_INIT when minimum libtool
448 LIBTOOL="$LIBTOOL --preserve-dup-deps"
450 AC_CHECK_TOOL(AR, ar)
452 AC_MSG_ERROR([*** 'ar' missing. Install binutils, fix your \$PATH, or set \$AR manually. ***])
459 AC_CHECK_PROG(UNAME,uname,uname,:)
461 AC_CHECK_SIZEOF([int])
463 dnl Programs already checked by AM_INIT_AUTOMAKE:
465 dnl AC_PROG_MAKE_SET required with automake-ng
468 dnl Check for libiconv (which is usually included in glibc, but may be
469 dnl distributed separately). The libcharset check must come after the
470 dnl iconv check. This whole thing must come before the gettext check below.
474 if test "$am_cv_func_iconv" != yes; then
475 AC_MSG_ERROR([Iconv is missing. You can get libiconv from http://gnu.org/, \
476 or try using --with-libiconv-prefix.])
478 LIBS="$LIBS $LIBICONV"
481 ALL_LINGUAS="ar bg cs ca da de el en_GB eo es et fa fi fr ga gd he hu id it ja
482 ko lt nl nb pl pt pt_BR ro ru sr sv tr uk zh_CN zh_TW"
483 PODOMAINS="freeciv nations"
486 AS_HELP_STRING([--disable-nls], [do not add localization support]),
487 [case "${enableval}" in
491 dnl NLS disabled, but 'make dist' allowed. That dist will lack
492 dnl all generated localization files.
493 no-gmo-dist) USE_NLS=no
495 *) AC_MSG_ERROR([bad value ${enableval} for --enable-nls]) ;;
496 esac], [USE_NLS=yes])
498 if test "$USE_NLS" = "yes" ; then
501 dnl AM_GLIB_GNU_GETTEXT doesn't have all features we want
502 dnl or they don't behave correctly.
503 dnl Old gettext binaries don't understand plurals. (ngettext, msgid_plural)
504 dnl and there are some problems with missing ngettext.
505 dnl Is that ngettext part still true? AM_GLIB_GNU_GETTEXT does check for it
507 have_working_ngettext=0
508 AC_CHECK_LIB(c, ngettext,
509 [AC_MSG_CHECKING(whether libc's ngettext works at runtime)
510 FC_CHECK_NGETTEXT_RUNTIME(,have_working_ngettext=1,)],)
512 if test "$have_working_ngettext" = "0"; then
513 AC_CHECK_LIB([intl], [ngettext],
514 [AC_MSG_CHECKING([whether libintl's ngettext works at runtime])
515 FC_CHECK_NGETTEXT_RUNTIME(["-lintl"],[have_working_ngettext=1
516 UTILITY_LIBS="${UTILITY_LIBS} -lintl"],)],)
519 if test "$have_working_ngettext" = "0"; then
520 AC_MSG_ERROR(I haven't found a working ngettext function in your system.
521 Try --disable-nls. Read ABOUT-NLS.)
524 if test "$IS_BETA_VERSION" = "1" || test "$IS_DEVEL_VERSION" = "1"; then
525 AC_MSG_CHECKING(for GNU xgettext version >= 0.10.36)
526 xgettext_version=`$XGETTEXT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'`
527 AC_RUN_IFELSE([AC_LANG_SOURCE([[
530 const char *version = "$xgettext_version";
533 const char *p = version;
534 int major = 0, minor = 0, patch = 0;
536 while (*p != '\0' && (*p < '0' || *p > '9')) {
542 sscanf(p, "%d.%d.%d", &major, &minor, &patch);
543 if (major < 1 && (minor < 10 || (minor == 10 && patch < 36))) {
548 ]])],[AC_MSG_RESULT(yes)
551 AC_MSG_WARN(You may have problems with creating pox files. \
552 Please update your gettext package.)
557 AC_MSG_CHECKING(for GNU msgfmt version >= 0.10.35)
558 msgfmt_version=`$MSGFMT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'`
559 AC_RUN_IFELSE([AC_LANG_SOURCE([[
562 const char *version = "$msgfmt_version";
566 const char *p = version;
567 int major = 0, minor = 0, patch = 0;
569 while (*p != '\0' && (*p < '0' || *p > '9')) {
575 sscanf(p, "%d.%d.%d", &major, &minor, &patch);
576 if (major < 1 && (minor < 10 || (minor == 10 && patch < 35))) {
581 ]])],[AC_MSG_RESULT(yes)
584 AC_MSG_ERROR(You are unable to create *.gmo files.
585 This is development version which doesn't include them. Please update your
586 gettext package. We recommend you versions >= 0.10.38. Or use
587 --disable-nls instead.)
593 dnl Setup POFILES even when NLS disabled.
594 dnl AM_GLIB_GNU_GETTEXT does this when NLS enabled.
595 for lang in $ALL_LINGUAS; do
596 POFILES="$POFILES $lang.po"
602 PKG_CHECK_MODULES([CURL], [libcurl >= 7.9.7],,
603 [AC_MSG_ERROR([libcurl development files required])])
604 UTILITY_CFLAGS="${UTILITY_CFLAGS} ${CURL_CFLAGS}"
605 UTILITY_LIBS="${UTILITY_LIBS} ${CURL_LIBS}"
607 dnl Set debug flags supported by compiler
608 EXTRA_DEBUG_CFLAGS=""
609 EXTRA_DEBUG_CXXFLAGS=""
610 EXTRA_DEBUG_LDFLAGS=""
616 AC_C99_VARIADIC_MACROS
617 AC_C99_VARIABLE_ARRAYS
623 dnl BeOS-specific settings
624 if test x`$UNAME -s` = xBeOS ; then
625 AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [BeOS-specific setting])
626 CFLAGS="$CFLAGS -Wno-multichar"
627 LDFLAGS="$LDFLAGS -x none"
628 if test x$enable_debug = xyes ; then
629 CFLAGS="$CFLAGS -gdwarf-2"
630 LDFLAGS="$LDFLAGS -gdwarf-2"
632 # We used to set ARFLAGS here, but under recent versions of automake this
633 # broke compilation on other systems. Setting ARFLAGS shouldn't be
634 # necessary with a working automake.
640 HOST_PATH_SEPARATOR=":"
642 dnl Settings specific to host OS
646 dnl Windows-specific settings
648 AC_CHECK_TOOL([WINDRES], [windres])
649 if test -z $WINDRES; then
650 AC_MSG_ERROR([*** 'windres' missing. Install binutils, fix your \$PATH, or set \$WINDRES manually. ***])
653 HOST_PATH_SEPARATOR=";"
655 AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [Mingw32-specific setting - stdin])
656 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw32])
657 AC_DEFINE([WIN32_NATIVE], [1], [Mingw32-specific setting - native])
658 AC_DEFINE([HAVE_WINSOCK], [1], [Mingw32-specific setting - winsock])
659 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])
660 LIBS="$LIBS -lwsock32"
664 dnl SkyOS specific settings
665 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - SkyOS])
669 dnl Haiku specific settings
670 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Haiku])
671 LIBS="$LIBS -lnetwork"
676 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Amiga])
681 dnl Autoconf provides path separator for build system.
682 dnl Use that instead of our own guess in case of native build.
683 if test x$build = x$host ; then
684 HOST_PATH_SEPARATOR=$PATH_SEPARATOR
687 dnl note this has to match the path installed by translations/freeciv/Makefile
688 if test x"$MINGW32" != "xyes"; then
689 CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\"\\\"$localedir\\\"\""
691 AC_DEFINE_UNQUOTED([LOCALEDIR], ["./share/locale"], [Locale directory (windows)])
694 CPPFLAGS="$CPPFLAGS -DBINDIR=\"\\\"$bindir\\\"\""
699 AC_CHECK_LIB(z, gzgets,
700 [AC_DEFINE([HAVE_LIBZ], [1], [zlib is available])
701 UTILITY_LIBS="${UTILITY_LIBS} -lz"
702 COMMON_LIBS="$COMMON_LIBS -lz"],
703 AC_MSG_ERROR([Could not find zlib library.]))
705 AC_CHECK_HEADER(zlib.h, ,
706 AC_MSG_ERROR([zlib found but not zlib.h.
707 You may need to install a zlib devel package.]))
709 AC_PATH_PROG(GZIP, gzip, "no")
710 if test "$GZIP" = "no"; then
711 AC_MSG_ERROR([You need the gzip program for compilation.])
714 dnl Check for bzip2 compression
715 AC_CHECK_LIB(bz2, BZ2_bzReadOpen,
716 [AC_CHECK_HEADERS([bzlib.h],
717 [AC_DEFINE([HAVE_LIBBZ2], [1], [libbzip2 is available])
718 UTILITY_LIBS="${UTILITY_LIBS} -lbz2"
719 libbz2_available=true])])
720 if test "x$libbz2_available" != "xtrue" ; then
724 dnl Check for xz compression
725 AC_CHECK_LIB(lzma, lzma_code,
726 [AC_CHECK_HEADERS([lzma.h],
727 [AC_DEFINE([HAVE_LIBLZMA], [1], [liblzma is available])
728 UTILITY_LIBS="${UTILITY_LIBS} -llzma"
729 libxz_available=true])])
730 if test "x$libxz_available" != "xtrue" ; then
734 AC_SUBST([UTILITY_CFLAGS])
735 AC_SUBST([UTILITY_LIBS])
736 AC_SUBST([COMMON_LIBS])
738 AC_ARG_ENABLE([crosser],
739 AS_HELP_STRING([--enable-crosser], [build version to be used with crosser environment]),
740 [case "${enableval}" in
743 *) AC_MSG_ERROR([bad value ${enableval} for --enable-crosser]) ;;
745 if test x$crosser = xyes && test x$MINGW32 != xyes ; then
746 AC_MSG_ERROR([--enable-crosser is Windows build specific option])
749 dnl Check thread implementation
750 AC_MSG_CHECKING([for threads implementation])
753 CFLAGS_SAVE="${CFLAGS}"
756 if test x$crosser != xyes ; then
757 FC_C_FLAGS([-pthread], [], [CFLAGS])
758 FC_LD_FLAGS([-pthread], [], [LIBS])
759 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
760 [[return pthread_create(NULL, NULL, NULL, NULL);]])],
761 [AC_DEFINE([HAVE_PTHREAD], [1], [Use pthreads as thread implementation])
763 AC_MSG_RESULT([pthreads])
764 AC_DEFINE([HAVE_THREAD_COND], [1], [Has thread condition variable implementation])])
768 if test "x$thread_impl" = "xnone" ; then
769 CFLAGS="$CFLAGS_SAVE"
770 LDFLAGS="$LDFLAGS_SAVE"
772 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
773 [[CreateThread(NULL, 0, NULL, NULL, 0, NULL);]])],
774 [AC_DEFINE([HAVE_WINTHREADS], [1], [Use Windows threads as thread implementation])
776 AC_MSG_RESULT([windows])])
779 if test "x$thread_impl" = "xnone" ; then
780 AC_MSG_ERROR([No usable thread implementation available])
783 if test "x$thread_cond" != "xtrue" ; then
784 feature_thr_cond=missing
787 dnl Check and choose clients
788 if test "x$client" != "xno"; then
790 dnl Check for sound support, sets SOUND_CFLAGS, SOUND_LIBS, AUDIO_SDL
791 dnl Client gui checks need to know which mixer version this has selected
794 dnl if specified --with-xaw or --with-xaw3d, assume --enable-client=xaw
795 if test -n "$WITH_XAW" || test -n "$WITH_XAW3D"; then
796 if test "x$client" = "xauto" ; then
799 elif test "x$client" = "xall" ; then
804 dnl if need to guess client, announce checking
805 if test "x$client" = "xauto"; then
806 AS_MESSAGE([checking for which client to compile:...])
807 elif test "x$client" = "xall" ; then
808 AS_MESSAGE([checking for which clients to compile:...])
811 dnl Gtk-2.0-specific overrides
814 dnl Gtk-3.0-specific overrides
817 dnl SDL-specific overrides
820 dnl Xaw-specific overrides
823 dnl QT-specific overrides
826 dnl Stub-specific overrides
827 if test "x$gui_stub" = "xyes" || test "x$client" = "xall" ; then
830 if test "x$found_client" = "xyes"; then
832 if test "x$client" = "xauto" ; then
836 elif test "x$gui_stub" = "xyes"; then
837 AC_MSG_ERROR(specified client 'stub' not configurable)
841 dnl If client still "auto", error out since we couldn't select any of them
842 if test "x$client" = "xauto" ; then
843 AC_MSG_ERROR([can not build any of the clients])
847 if test "x$client" = "xall" ; then
848 if test "x$gui_gtk2" = "xyes" ||
849 test "x$gui_gtk3" = "xyes" ||
850 test "x$gui_sdl" = "xyes" ||
851 test "x$gui_xaw" = "xyes" ||
852 test "x$gui_qt" = "xyes" ||
853 test "x$gui_stub" = "xyes" ; then
861 if test "x$gui_gtk2" = "xyes" || test "x$gui_gtk3" = "xyes" ; then
863 if test "x$gui_gtk2" = "xyes" ; then
864 gui_gtk2_LIBS="$gui_gtk2_libs $LIB_GGZ_GTK"
866 if test "x$gui_gtk3" = "xyes" ; then
867 gui_gtk3_libs="$gui_gtk3_libs $LIB_GGZ_GTK"
872 if test "$ggz_server" = "yes" ; then
873 AC_CHECK_FUNCS([chdir mkdtemp])
876 FC_LD_FLAGS(["-Wl,-rpath=${lib_prefix}"], [], [LDFLAGS])
878 AM_CONDITIONAL([CLIENT], [test "x$client" = "xyes"])
880 AC_ARG_WITH([freeciv-manual],
881 AS_HELP_STRING([--without-freeciv-manual], [do not build freeciv-manual]),
882 [fcmanual=${withval}], [fcmanual=yes])
884 AM_CONDITIONAL([FCMANUAL], [test "x$fcmanual" = "xyes"])
886 dnl freeciv-modpack checks
887 AC_ARG_ENABLE([fcmp],
888 AS_HELP_STRING([--enable-fcmp=no/yes/gtk2/gtk3/qt/cli/all/auto], [build freeciv-modpack-program [auto]]),
889 [fc_mp=${enableval}],
898 if test "x$fc_mp" = "xcli" ; then
899 dnl Only cli requested -> no gui needed
903 for mp in $(echo $fc_mp | $SED 's/,/ /g') ; do
904 if test "x$mp" = "xno" ; then
906 elif test "x$mp" = "xauto" || test "x$mp" = "xyes" ; then
908 elif test "x$mp" = "xall" ; then
910 else if test "x$mp" = "xgtk2" ||
911 test "x$mp" = "xgtk2.0" ||
912 test "x$mp" = "xgtk20" ||
913 test "x$mp" = "xgtk-2.0" ; then
915 elif test "x$mp" = "xgtk3" ||
916 test "x$mp" = "xgtk3.0" ||
917 test "x$mp" = "xgtk30" ||
918 test "x$mp" = "xgtk-3.0" ; then
920 elif test "x$mp" = "xqt" ; then
922 elif test "x$mp" = "xcli" ; then
924 elif test "x$mp" != "xyes" ; then
925 AC_MSG_ERROR([bad value ${mp} for --enable-fcmp])
930 if test "x$req_fcmp_gtk2" = "xyes" ||
931 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
932 AM_PATH_GTK_2_0([2.12.0],
934 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
937 fcmp_list="$fcmp_list gtk2"
938 mp_gtk2_cflags="$GTK2_CFLAGS $GTHREAD_CFLAGS"
939 mp_gtk2_libs="$GTK2_LIBS $GTHREAD_LIBS"
940 if test "x$MINGW32" = "xyes"; then
941 dnl Required to compile gtk2 on Windows platform
942 mp_gtk2_cflags="$mp_gtk2_cflags -mms-bitfields"
943 mp_gtk2_ldflags="$mp_gtk2_ldflags -mwindows"
946 if test "x$modinst" = "xauto" ; then
952 if test "x$req_fcmp_gtk2" = "xyes" && test "x$fcmp_gtk2" != "xyes" ; then
953 AC_MSG_ERROR([Cannot build gtk2-version of freeciv-modpack as requested])
956 if test "x$req_fcmp_gtk3" = "xyes" ||
957 test "x$modinst" = "xall" || test "x$modinst" = "xauto" ; then
958 AM_PATH_GTK_3_0([3.0.0],
960 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
963 fcmp_list="$fcmp_list gtk3"
964 mp_gtk3_cflags="$GTK3_CFLAGS $GHTREAD_CFLAGS"
965 mp_gtk3_libs="$GTK3_LIBS $GTHREAD_LIBS"
966 if test "x$MINGW32" = "xyes"; then
967 dnl Required to compile gtk3 on Windows platform
968 mp_gtk3_cflags="$mp_gtk3_cflags -mms-bitfields"
969 mp_gtk3_ldflags="$mp_gtk3_ldflags -mwindows"
972 if test "x$modinst" = "xauto" ; then
978 if test "x$req_fcmp_gtk3" = "xyes" && test "x$fcmp_gtk3" != "xyes" ; then
979 AC_MSG_ERROR([Cannot build gtk3-version of freeciv-modpack as requested])
982 if test "x$req_fcmp_qt" = "xyes" ||
983 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
985 if test "x$cxx_works" = "xyes" ; then
988 if test "x$fc_qt5_usable" = "xtrue" ; then
990 fcmp_list="$fcmp_list qt"
992 mp_qt_cppflags=$FC_QT5_CPPFLAGS
993 mp_qt_cxxflags=$FC_QT5_CXXFLAGS
994 mp_qt_libs=$FC_QT5_LIBS
996 if test "x$modinst" = "xauto" ; then
1004 if test "x$req_fcmp_qt" = "xyes" && test "x$fcmp_qt" != "xyes" ; then
1005 AC_MSG_ERROR([Cannot build Qt-version of freeciv-modpack as requested])
1008 dnl Cli does not satisfy --enable-fcmp=auto as it's not an gui.
1009 if test "x$req_fcmp_cli" = "xyes" || test "x$modinst" = "xall" ; then
1011 fcmp_list="$fcmp_list cli"
1014 if test "x$modinst" != "xfound" &&
1015 test "x$modinst" != "xno" &&
1016 test "x$modinst" != "xcli" &&
1017 test "x$fcmp_gtk3" != "xyes" &&
1018 test "x$fcmp_gtk2" != "xyes" &&
1019 test "x$fcmp_qt" != "xyes" ;then
1020 AC_MSG_ERROR([Cannot build modpack installer with any gui])
1023 if test "x$modinst" != "xno" && test "x$MINGW32" != "xyes" ; then
1024 dnl Hack to get a run-time icon -- not needed on Windows
1025 mp_gtk2_cflags="$mp_gtk2_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1026 mp_gtk3_cflags="$mp_gtk3_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1029 if test "x$fcmp_list" = "x" ; then
1033 AM_CONDITIONAL([MODINST], [test "x$modinst" != "xno"])
1034 AM_CONDITIONAL([MODINST_GTK3], [test "x$fcmp_gtk3" = "xyes"])
1035 AM_CONDITIONAL([MODINST_GTK2], [test "x$fcmp_gtk2" = "xyes"])
1036 AM_CONDITIONAL([MODINST_QT], [test "x$fcmp_qt" = "xyes"])
1037 AM_CONDITIONAL([MODINST_CLI], [test "x$fcmp_cli" = "xyes"])
1039 AC_SUBST([gui_gtk2_cflags])
1040 AC_SUBST([gui_gtk2_libs])
1041 AC_SUBST([gui_gtk2_ldflags])
1042 AC_SUBST([gui_gtk3_cflags])
1043 AC_SUBST([gui_gtk3_libs])
1044 AC_SUBST([gui_gtk3_ldflags])
1045 AC_SUBST([gui_sdl_cflags])
1046 AC_SUBST([gui_sdl_libs])
1047 AC_SUBST([gui_sdl_ldflags])
1048 AC_SUBST([gui_xaw_cflags])
1049 AC_SUBST([gui_xaw_libs])
1050 AC_SUBST([gui_xaw_ldflags])
1051 AC_SUBST([gui_qt_cppflags])
1052 AC_SUBST([gui_qt_cflags])
1053 AC_SUBST([gui_qt_cxxflags])
1054 AC_SUBST([gui_qt_libs])
1055 AC_SUBST([gui_qt_ldflags])
1056 AC_SUBST([gui_stub_cflags])
1057 AC_SUBST([gui_stub_libs])
1058 AC_SUBST([gui_stub_ldflags])
1059 AC_SUBST([mp_cli_cflags])
1060 AC_SUBST([mp_cli_libs])
1061 AC_SUBST([mp_cli_ldflags])
1062 AC_SUBST([mp_gtk2_cflags])
1063 AC_SUBST([mp_gtk2_libs])
1064 AC_SUBST([mp_gtk2_ldflags])
1065 AC_SUBST([mp_gtk3_cflags])
1066 AC_SUBST([mp_gtk3_libs])
1067 AC_SUBST([mp_gtk3_ldflags])
1068 AC_SUBST([mp_qt_cppflags])
1069 AC_SUBST([mp_qt_cxxflags])
1070 AC_SUBST([mp_qt_libs])
1071 AC_SUBST([SOUND_CFLAGS])
1072 AC_SUBST([SOUND_LIBS])
1073 AC_SUBST([VERSION_WITHOUT_LABEL])
1074 AC_SUBST([VERSION_LABEL])
1075 AC_SUBST([HOST_PATH_SEPARATOR])
1076 AM_CONDITIONAL(AUDIO_SDL, test "x$SDL_mixer" != "xno")
1077 AM_CONDITIONAL(CLIENT_GUI_SDL, test "x$gui_sdl" = "xyes")
1078 AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "x$gui_gtk2" = "xyes")
1079 AM_CONDITIONAL(CLIENT_GUI_GTK_3_0, test "x$gui_gtk3" = "xyes")
1080 AM_CONDITIONAL(CLIENT_GUI_XAW, test "x$gui_xaw" = "xyes")
1081 AM_CONDITIONAL(CLIENT_GUI_QT, test "x$gui_qt" = "xyes")
1082 AM_CONDITIONAL(CLIENT_GUI_STUB, test "x$gui_stub" = "xyes")
1083 AM_CONDITIONAL(MINGW32, test x"$MINGW32" = "xyes")
1085 dnl Additional client libraries:
1086 if test "x$client" = "xyes"; then
1088 AC_SUBST(CLIENT_LIBS)
1091 dnl Checks for additional server libraries:
1092 if test "x$server" = "xyes"; then
1093 SERVER_LIBS="-lm ${SERVER_LIBS}"
1095 dnl Some systems (e.g., BeOS) need this lib
1096 AC_CHECK_LIB(bind, gethostbyaddr, SERVER_LIBS="-lbind $SERVER_LIBS")
1098 dnl Readline library and header files.
1100 AC_SUBST([SERVER_LIBS])
1101 AC_SUBST([SRV_LIB_LIBS])
1104 AC_CHECK_LIB(nls,main)
1106 dnl Checks for header files.
1109 AC_CHECK_HEADERS([fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \
1110 sys/file.h libintl.h signal.h strings.h execinfo.h \
1113 dnl Avoid including the unix emulation layer if we build mingw executables
1114 dnl There would be type conflicts between winsock and bsd/unix includes
1115 if test "x$MINGW32" != "xyes"; then
1116 AC_CHECK_HEADERS(arpa/inet.h netdb.h netinet/in.h pwd.h sys/ioctl.h \
1117 sys/select.h sys/signal.h sys/socket.h sys/termio.h \
1118 sys/uio.h termios.h)
1120 if test "x$gui_xaw" = "xyes" ; then
1121 dnl Want to get appropriate -I flags:
1122 fc_save_CPPFLAGS="$CPPFLAGS"
1123 CPPFLAGS="$CPPFLAGS $gui_xaw_cflags"
1124 AC_CHECK_HEADER(X11/xpm.h, ,
1125 AC_MSG_ERROR(need X11/xpm.h header; perhaps try/adjust --with-xpm-include))
1126 CPPFLAGS="$fc_save_CPPFLAGS"
1129 dnl Checks for typedefs, structures, and compiler characteristics.
1133 AC_CHECK_TYPES(socklen_t, [], [],
1134 [#include <sys/types.h>
1135 #include <sys/socket.h>
1138 dnl Headers that might contain the intptr_t definition found earlier
1139 AC_CHECK_HEADERS([inttypes.h stdint.h])
1141 dnl Checks for library functions.
1146 dnl Windows vsnprintf doesn't support argument reordering (see PR#12932)
1147 if test "x$MINGW32" != "xyes"; then
1149 AC_CHECK_FUNCS([vsnprintf])
1152 AC_CHECK_FUNCS([bind connect fileno flock ftime gethostbyname gethostname \
1153 getpwuid inet_aton select snooze strcasecmp strcasestr \
1154 strerror strlcat strlcpy strncasecmp strstr uname usleep \
1155 getline _strcoll stricoll _stricoll strcasecoll getaddrinfo \
1158 AC_MSG_CHECKING(for working gettimeofday)
1159 FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
1160 [Define if the gettimeofday function works and is sane.]),)
1162 dnl Check for extra socket libraries.
1163 dnl If the AC_CHECK_FUNCS check finds the function, we don't look any
1164 dnl further. This is rumoured to prevent choosing the wrong libs on IRIX.
1165 if test $ac_cv_func_gethostbyname = no; then
1166 AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS")
1168 if test $ac_cv_func_connect = no; then
1169 AC_CHECK_LIB(socket, connect, LIBS="-lsocket $LIBS")
1171 if test $ac_cv_func_bind = no; then
1172 AC_CHECK_LIB(bind, gethostbyaddr, LIBS="-lbind $LIBS")
1175 dnl The use of both AC_FUNC_VSNPRINTF and AC_CHECK_FUNCS(vsnprintf) is
1178 dnl Windows fdopen does not work with sockets.
1179 if test "x$MINGW32" != "xyes"; then
1180 AC_CHECK_FUNCS(fdopen)
1183 dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated
1184 dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS,
1185 dnl and not in LIBS.
1187 dnl Now check if non blocking sockets are possible
1188 dnl (if fcntl or ioctl exists)
1190 AC_CHECK_FUNC([fcntl],
1191 [AC_DEFINE([HAVE_FCNTL], [1], [fcntl support])
1192 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])],
1193 [AC_CHECK_FUNC([ioctl],
1194 [AC_DEFINE([HAVE_IOCTL], [1], [ioctl support])
1195 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])])])
1197 dnl Checks if SIGPIPE is usable
1198 AC_MSG_CHECKING([for SIGPIPE])
1199 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[signal (SIGPIPE, SIG_IGN)]])],[AC_MSG_RESULT([yes])
1200 AC_DEFINE([HAVE_SIGPIPE], [1], [sigpipe support])],[AC_MSG_RESULT([no])])
1202 dnl export where the datadir is going to be installed
1203 FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
1205 if test x"$MINGW32" = xyes; then
1206 DEFAULT_SAVE_PATH=".;~/.freeciv/saves"
1207 if test x$crosser = xyes ; then
1208 FC_CONF_PATH="../etc/freeciv"
1209 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv;../share/freeciv"
1210 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios;../share/freeciv/scenarios"
1212 FC_CONF_PATH="etc/freeciv"
1213 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv"
1214 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios"
1217 FC_CONF_PATH="$sysconfdir/freeciv"
1218 DEFAULT_DATA_PATH=".:data:~/.freeciv/$DATASUBDIR:$datadir/freeciv"
1219 DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
1220 DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
1222 CPPFLAGS="$CPPFLAGS -DFC_CONF_PATH=\"\\\"$FC_CONF_PATH\\\"\""
1223 CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\""
1224 CPPFLAGS="$CPPFLAGS -DDEFAULT_SAVES_PATH=\"\\\"$DEFAULT_SAVES_PATH\\\"\""
1225 CPPFLAGS="$CPPFLAGS -DDEFAULT_SCENARIO_PATH=\"\\\"$DEFAULT_SCENARIO_PATH\\\"\""
1227 dnl This has to be last library
1228 if test -n "$WITH_EFENCE"; then
1229 AC_CHECK_LIB(efence, malloc, [
1230 if test "x$LIBS" = "x"; then
1233 LIBS="$LIBS -lefence"
1237 dnl Checks needed for Lua. Get rid of these if system lua is ever used.
1239 if test x$gl_cv_func_working_mkstemp = xyes ; then
1240 AC_DEFINE([HAVE_MKSTEMP], [1], [Have working mkstemp])
1242 AC_CHECK_FUNCS([isatty popen _longjmp _setjmp])
1244 AC_ARG_ENABLE([sys-lua],
1245 AS_HELP_STRING([--enable-sys-lua], [use lua from system instead of one from freeciv tree [false]]),
1246 [case "${enableval}" in
1253 *) AC_MSG_ERROR([bad value ${enableval} for --enable-sys-lua]) ;;
1254 esac], [sys_lua=false])
1256 dnl There's wide divergence on what the pkg-config file for Lua is called
1257 dnl See http://lua-users.org/lists/lua-l/2008-09/msg00184.html
1258 if test "x$sys_lua" = "xtrue" || test "x$sys_lua" = "xtest" ; then
1259 PKG_CHECK_MODULES([LUA], [lua5.2], [sys_lua=true],
1260 [PKG_CHECK_MODULES([LUA], [lua-5.2], [sys_lua=true],
1261 [PKG_CHECK_MODULES([LUA], [lua >= 5.2 lua < 5.3], [sys_lua=true],
1262 [if test "x$sys_lua" = "xtrue" ; then
1263 AC_MSG_ERROR([Use of included lua disabled, and no lua found from system])
1265 feature_syslua=missing
1269 if test "x$sys_lua" = "xfalse" ; then
1270 LUA_CFLAGS="-I\$(top_srcdir)/dependencies/lua-5.2/src"
1271 LUA_LIBS="\$(top_builddir)/dependencies/lua-5.2/src/liblua.la"
1274 AC_SUBST([LUA_CFLAGS])
1275 AC_SUBST([LUA_LIBS])
1276 AM_CONDITIONAL([SYS_LUA], [test "x$sys_lua" = "xtrue"])
1278 if test x$enable_fcdb = xyes ; then
1279 LUASQL_CFLAGS="-I\$(top_srcdir)/dependencies/luasql/src"
1280 LUASQL_LIBS="\$(top_builddir)/dependencies/luasql/src/libluasql_base.la"
1281 if test x$fcdb_mysql = xyes ; then
1282 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_mysql.la"
1284 if test x$fcdb_postgres = xyes ; then
1285 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_postgres.la"
1287 if test x$fcdb_sqlite3 = xyes ; then
1288 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_sqlite3.la"
1290 LUASQL_AS_DEPENDENCY="$LUASQL_LIBS"
1291 LUASQL_LIBS="$LUASQL_LIBS $FCDB_MYSQL_LIBS $FCDB_POSTGRES_LIBS $FCDB_SQLITE3_LIBS"
1293 AC_SUBST([LUASQL_CFLAGS])
1294 AC_SUBST([LUASQL_LIBS])
1295 AC_SUBST([LUASQL_AS_DEPENDENCY])
1298 TOLUA_CFLAGS="-I\$(top_srcdir)/dependencies/tolua-5.2/include"
1299 TOLUA_LIBS="\$(top_builddir)/dependencies/tolua-5.2/src/lib/libtolua.la"
1300 AC_SUBST([TOLUA_CFLAGS])
1301 AC_SUBST([TOLUA_LIBS])
1303 TOLUA="\$(top_builddir)/dependencies/tolua-5.2/src/bin/tolua$EXEEXT"
1306 dnl Freeciv uses a non-standard macro, Q_(), to handle cases of qualified
1307 dnl translatable strings and macro PL_() to handle plural forms.
1308 dnl Since the Gettext supplied Autoconf support
1309 dnl doesn't seem to have a way to add new keywords to its xgettext call,
1310 dnl we do the following.
1311 dnl The Gettext supplied Autoconf support starts with
1312 dnl 'translations/<domain>/Makefile.in.in', and builds
1313 dnl 'translations/<domain>/Makefile.in' then 'translations/<domain>/Makefile'.
1314 dnl In order for the commonly used _() and N_() macros to work, there
1315 dnl should be somewhere in that 'translations/<domain>/Makefile' a call
1316 dnl to xgettext with "--keyword=_" and "--keyword=N_" as arguments.
1317 dnl To support Q_() and PL_(), the following simply replaces instances of
1318 dnl "--keyword=N_" with "--keyword=N_ --keyword=Q_ --keyword=PL_:1,2"
1319 dnl in the 'translations/<domain>/Makefile' file.
1320 AC_CONFIG_COMMANDS([fc_default-1],[[for domain in $PODOMAINS ; do
1321 if test -f translations/${domain}/Makefile ; then
1322 if grep 'keyword=N_ --keyword=Q_ --keyword=PL_:1,2' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1323 # has already been extended
1326 echo extending translations/${domain}/Makefile
1327 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1328 sed -e 's/--keyword=N_/--keyword=N_ --keyword=Q_ --keyword=PL_:1,2/g' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1329 rm translations/${domain}/Makefile.tmp
1332 done]],[PODOMAINS="$PODOMAINS"])
1334 dnl Vast quantities of meaningless errors from xgettext is also annoying.
1335 dnl We fix this by forcing xgettext to assume all files are C source files.
1336 AC_CONFIG_COMMANDS([fc_default-2],[[for domain in $PODOMAINS ; do
1337 if test -f translations/freeciv/Makefile ; then
1338 if grep 'language=C --files-from=\$(srcdir)/POTFILES.in' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1339 # has already been silenced
1342 echo silencing translations/${domain}/Makefile
1343 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1344 sed -e 's/--files-from=$(srcdir)\/POTFILES.in/--language=C --files-from=$(srcdir)\/POTFILES.in/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1345 rm translations/${domain}/Makefile.tmp
1348 done]],[PODOMAINS="$PODOMAINS"])
1350 dnl Most of the C comments copied to freeciv.pot are spurious;
1351 dnl change to only copy those with prefix "TRANS:"
1352 dnl Also add --escape to the arguments to convert extended
1353 dnl characters to escape characters.
1354 AC_CONFIG_COMMANDS([fc_default-4],[[for domain in $PODOMAINS ; do
1355 if test -f translations/${domain}/Makefile ; then
1356 if grep 'add-comments="TRANS:" --escape' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1357 # has already been modified
1360 echo modifying translations/${domain}/Makefile add-comments/escape
1361 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1362 sed -e 's/add-comments/add-comments="TRANS:" --escape/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1363 rm translations/${domain}/Makefile.tmp
1366 done]],[PODOMAINS="$PODOMAINS"])
1368 dnl The BeOS sys/uio.h is broken. This kludges it out of existence.
1369 dnl (This still causes lots of spurious changes to fc_config.h on BeOS.)
1370 AC_CONFIG_COMMANDS([fc_default-5],[[if test x`uname -s` = xBeOS ; then
1371 if grep '#define HAVE_SYS_UIO_H 1' fc_config.h >/dev/null 2>&1 ; then
1372 echo kluging fc_config.h
1373 mv -f fc_config.h fc_config.h.tmp
1374 sed -e 's/#define HAVE_SYS_UIO_H 1/#undef HAVE_SYS_UIO_H/g' fc_config.h.tmp > fc_config.h
1379 CFLAGS="$EXTRA_DEBUG_CFLAGS $CFLAGS"
1380 CXXFLAGS="$EXTRA_DEBUG_CXXFLAGS $CXXFLAGS"
1381 LDFLAGS="$EXTRA_DEBUG_LDFLAGS $LDFLAGS"
1383 dnl Rebuild 'configure' whenever fc_version changes, if maintainer mode enabled.
1384 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/fc_version"])
1386 dnl Make sure that fc_config.h changes when ever CPPFLAGS, CFLAGS or CXXFLAGS
1387 dnl change so everything gets rebuilt. LDFLAGS is not handled here
1388 dnl since change in it should not cause recompilation, only relinking.
1389 dnl Note: Variables are named FC_STORE_* instead of FC_*_STORE in order to
1390 dnl make them appear next to each other in fc_config.h. Also single-quotes are
1391 dnl used because some " may appear unescaped within the flag strings.
1392 AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ['$CPPFLAGS'],
1393 [These are the CPPFLAGS used in compilation])
1394 AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ['$CFLAGS'],
1395 [These are the CFLAGS used in compilation])
1396 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'],
1397 [These are the CXXFLAGS used in compilation])
1399 AC_CONFIG_FILES([Makefile
1405 data/amplio2/Makefile
1406 data/buildings/Makefile
1409 data/cimpletoon/Makefile
1410 data/trident/Makefile
1411 data/isophex/Makefile
1412 data/isotrident/Makefile
1413 data/stdsounds/Makefile
1414 data/default/Makefile
1415 data/classic/Makefile
1416 data/multiplayer/Makefile
1417 data/experimental/Makefile
1418 data/civ2civ3/Makefile
1421 data/scenarios/Makefile
1422 data/nation/Makefile
1423 data/themes/Makefile
1424 data/themes/gui-gtk-2.0/Makefile
1425 data/themes/gui-gtk-2.0/Freeciv/Makefile
1426 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Makefile
1427 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Arrows/Makefile
1428 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Buttons/Makefile
1429 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Check-Radio/Makefile
1430 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Combo/Makefile
1431 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Frame-Gap/Makefile
1432 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Handles/Makefile
1433 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Lines/Makefile
1434 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ListHeaders/Makefile
1435 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Menu-Menubar/Makefile
1436 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Others/Makefile
1437 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Panel/Makefile
1438 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ProgressBar/Makefile
1439 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Range/Makefile
1440 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Scrollbars/Makefile
1441 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Shadows/Makefile
1442 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Spin/Makefile
1443 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Tabs/Makefile
1444 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Toolbar/Makefile
1445 data/themes/gui-gtk-3.0/Makefile
1446 data/themes/gui-gtk-3.0/Freeciv/Makefile
1447 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Makefile
1448 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Arrows/Makefile
1449 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Buttons/Makefile
1450 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Check-Radio/Makefile
1451 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Combo/Makefile
1452 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Frame-Gap/Makefile
1453 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Handles/Makefile
1454 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Lines/Makefile
1455 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ListHeaders/Makefile
1456 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Menu-Menubar/Makefile
1457 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Others/Makefile
1458 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Panel/Makefile
1459 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ProgressBar/Makefile
1460 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Range/Makefile
1461 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Scrollbars/Makefile
1462 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Shadows/Makefile
1463 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Spin/Makefile
1464 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile
1465 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile
1466 data/themes/gui-qt/Makefile
1467 data/themes/gui-qt/oxygen/Makefile
1468 data/themes/gui-sdl/Makefile
1469 data/themes/gui-sdl/human/Makefile
1470 data/wonders/Makefile
1473 dependencies/Makefile
1474 dependencies/lua-5.2/Makefile
1475 dependencies/lua-5.2/src/Makefile
1476 dependencies/tolua-5.2/Makefile
1477 dependencies/tolua-5.2/src/Makefile
1478 dependencies/tolua-5.2/src/lib/Makefile
1479 dependencies/tolua-5.2/src/bin/Makefile
1480 dependencies/luasql/Makefile
1481 dependencies/luasql/src/Makefile
1482 dependencies/cvercmp/Makefile
1484 common/aicore/Makefile
1485 common/scriptcore/Makefile
1490 ai/threaded/Makefile
1494 client/agents/Makefile
1495 client/include/Makefile
1496 client/gui-sdl/Makefile
1497 client/gui-gtk-2.0/Makefile
1498 client/gui-gtk-3.0/Makefile
1499 client/gui-xaw/Makefile
1500 client/gui-qt/Makefile
1501 client/gui-stub/Makefile
1502 client/luascript/Makefile
1504 server/advisors/Makefile
1505 server/generator/Makefile
1506 server/scripting/Makefile
1508 translations/Makefile
1509 translations/freeciv/Makefile.in
1510 translations/nations/Makefile.in
1513 doc/man/freeciv-client.6
1514 doc/man/freeciv-server.6
1515 doc/man/freeciv-manual.6
1516 doc/man/freeciv-modpack.6
1524 freeciv.spec:bootstrap/freeciv.spec.in
1526 client/freeciv.desktop:bootstrap/freeciv.desktop.in
1527 client/freeciv-gtk2.desktop:bootstrap/freeciv-gtk2.desktop.in
1528 client/freeciv-sdl.desktop:bootstrap/freeciv-sdl.desktop.in
1529 client/freeciv-qt.desktop:bootstrap/freeciv-qt.desktop.in
1530 server/freeciv-server.desktop:bootstrap/freeciv-server.desktop.in
1531 tools/freeciv-mp-gtk2.desktop:bootstrap/freeciv-mp-gtk2.desktop.in
1532 tools/freeciv-mp-gtk3.desktop:bootstrap/freeciv-mp-gtk3.desktop.in
1533 tools/freeciv-mp-qt.desktop:bootstrap/freeciv-mp-qt.desktop.in
1534 client/freeciv-gtk2.appdata.xml:bootstrap/freeciv-gtk2.appdata.xml.in
1535 client/freeciv-gtk3.appdata.xml:bootstrap/freeciv-gtk3.appdata.xml.in
1536 client/freeciv-sdl.appdata.xml:bootstrap/freeciv-sdl.appdata.xml.in
1537 client/freeciv-qt.appdata.xml:bootstrap/freeciv-qt.appdata.xml.in
1538 server/freeciv-server.appdata.xml:bootstrap/freeciv-server.appdata.xml.in
1539 tools/freeciv-mp-gtk2.appdata.xml:bootstrap/freeciv-mp-gtk2.appdata.xml.in
1540 tools/freeciv-mp-gtk3.appdata.xml:bootstrap/freeciv-mp-gtk3.appdata.xml.in
1541 tools/freeciv-mp-qt.appdata.xml:bootstrap/freeciv-mp-qt.appdata.xml.in])
1542 AC_CONFIG_FILES([fcgui:bootstrap/fcgui.in], [chmod +x fcgui])
1543 AC_CONFIG_FILES([fcser:bootstrap/fcser.in], [chmod +x fcser])
1545 if test "$USE_NLS" != "yes" ; then
1547 dnl Produced config.status will have constant value of FORCE_DIST,
1548 dnl but it still checks 'if test x$FORCE_DIST = xyes'. We cannot
1549 dnl do that check in configure when producing config.status.
1550 AC_CONFIG_COMMANDS([translations/freeciv/Makefile], [
1551 for domain in $PODOMAINS ; do
1552 dnl Usually glib-gettext.m4:AM_GLIB_GNU_GETTEXT outputs commands to
1553 dnl generate translations/${domain}/Makefile.
1554 dnl If NLS is disabled, we generate one here.
1555 rm -f translations/${domain}/Makefile
1557 dnl - Add nonls_warn as dependency to dist -target
1558 dnl - Remove dependencies from update-po, so it is never rebuilt
1559 dnl - Set list of distributed files (no generated files)
1560 sed -e 's/^dist distdir:.*/dist distdir: nonls_warn/' \
1561 -e 's/^update-po:.*/update-po:/' \
1562 -e 's/^DISTFILES =.*/DISTFILES = Makefile.in.in POTFILES.in POTFILES.skip \$(POFILES)/' \
1563 translations/${domain}/Makefile.in > translations/${domain}/Makefile
1565 dnl Create nonls_warn target.
1566 echo >> translations/${domain}/Makefile
1567 echo nonls_warn: >> translations/${domain}/Makefile
1568 if test "x$FORCE_DIST" = "xyes" ; then
1569 echo " @echo Building dist without generated localization files!" >> translations/${domain}/Makefile
1571 echo " @echo Cannot build dist with NLS disabled! && /bin/false" >> translations/${domain}/Makefile
1574 ], [FORCE_DIST=$FORCE_DIST
1575 PODOMAINS="$PODOMAINS"])
1581 ****************** Configuration Summary ******************
1583 == General build options ==
1584 Shared libraries: $enable_shared
1585 Debugging support: $enable_debug
1586 Profiling support: $enable_gprof
1587 IPv6 support: $enable_ipv6
1588 Map image toolkits: $enable_mapimg
1590 MagickWand: $mapimg_magickwand
1593 Build freeciv client: $client
1595 Maintained client frontends:
1604 Build freeciv server: $server
1605 AI modules support: $enable_aimodules
1606 Database support: $enable_fcdb
1608 postgres: $fcdb_postgres
1609 sqlite3: $fcdb_sqlite3
1612 Modpack installers: $fcmp_list
1613 Manual generator: $fcmanual