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 dnl set default values
201 dnl all: Autodetect as many as possible [default].
202 dnl no: No additional toolkits.
203 dnl magickwand: compile magickwand (imagemagick) support.
204 dnl comma-separated-list: Detect these or abort.
205 AC_ARG_ENABLE([mapimg],
206 AS_HELP_STRING([--enable-mapimg=no/auto/magickwand],
207 [additional map image toolkits to compile [auto](no, or list)]),
208 [toolkits=${enableval}],
209 [enable_mapimg=auto])
211 for toolkit in $(echo $toolkits | $SED 's/,/ /g') ; do
212 if test "x$toolkit" = "xauto" ; then
214 elif test "x$toolkit" = "xno" ; then
217 enable_mapimg=selected
220 if test "x$toolkit" = "xmagickwand" ; then
221 mapimg_magickwand=yes
225 dnl checks for MagickWand mapimg support
226 dnl sets MAPIMG_WAND_CFLAGS, MAPIMG_WAND_LIBS
229 AC_ARG_ENABLE([fcweb],
230 AS_HELP_STRING([--enable-fcweb], [build fcweb version of server [false]]),
231 [case "${enableval}" in
236 *) AC_MSG_ERROR([bad value ${enableval} for --enable-fcweb]) ;;
237 esac], [fcweb=false])
241 dnl no: Do not compile client.
242 dnl auto: Autodetect one.
243 dnl all: Autodetect as many as possible.
244 dnl comma-separated-list: Detect these or abort.
245 AC_ARG_ENABLE([client],
246 AS_HELP_STRING([--enable-client=auto/all/gtk2/gtk3/sdl/xaw/qt/stub],
247 [clients to compile [auto](list for multiple)]),
248 [clients=${enableval}],
251 if test "x$fcweb" = "xtrue" ; then
252 if test "x$clients" != "x" && test "x$clients" != "xauto" &&
253 test "x$clients" != "xno" ; then
254 AC_MSG_ERROR([One cannot enable any clients for freeciv-web build])
266 for gui in $(echo $clients | $SED 's/,/ /g') ; do
267 if test "x$gui" = "xno" ; then
269 elif test "x$gui" = "xauto" ; then
271 elif test "x$gui" = "xall" ; then
274 if test "x$gui" = "xgtk2" ||
275 test "x$gui" = "xgtk2.0" ||
276 test "x$gui" = "xgtk20" ||
277 test "x$gui" = "xgtk-2.0" ; then
279 elif test "x$gui" = "xgtk3" ||
280 test "x$gui" = "xgtk3.0" ||
281 test "x$gui" = "xgtk30" ||
282 test "x$gui" = "xgtk-3.0" ; then
284 elif test "x$gui" = "xgtk" ; then
285 AC_MSG_WARN([for requested client 'gtk' enabled gtk2-client, but that default changes in the future])
288 if test ! -d "${srcdir}/client/gui-$gui" ; then
289 AC_MSG_ERROR(bad value ${gui} for --enable-client)
298 AS_HELP_STRING([--with-xaw], [use the Xaw widget set for the xaw client]),
303 AS_HELP_STRING([--with-xaw3d], [use the Xaw3d widget set for the xaw client]),
307 if test "x$WITH_XAW" != "x" && test "x$WITH_XAW3D" != "x" ; then
308 AC_MSG_ERROR(Cannot use both --with-xaw and --with-xaw3d at the same time)
311 AC_ARG_ENABLE([svnrev],
312 AS_HELP_STRING([--enable-svnrev], [get svn revision to version information]),
313 [case "${enableval}" in
316 *) AC_MSG_ERROR([bad value ${enableval} for --enable-svnrev]) ;;
317 esac], [svnrev=false])
318 AM_CONDITIONAL([SVNREV], [test x$svnrev = xtrue])
319 if test x$svnrev = xtrue ; then
320 AC_DEFINE([SVNREV], [1], [Get svn revision information to version number])
323 AC_ARG_ENABLE([gitrev],
324 AS_HELP_STRING([--enable-gitrev], [get git revision to version information]),
325 [case "${enableval}" in
328 *) AC_MSG_ERROR([bad value ${enableval} for --enable-gitrev]) ;;
329 esac], [gitrev=false])
330 AM_CONDITIONAL([GITREV], [test x$gitrev = xtrue])
331 if test x$gitrev = xtrue ; then
332 AC_DEFINE([GITREV], [1], [Get git revision information to version number])
335 AC_ARG_ENABLE([make_data],
336 AS_HELP_STRING([--disable-make-data], [do not recurse make into data directories]),
337 [case "${enableval}" in
338 yes) make_data=true ;;
339 no) make_data=false ;;
340 *) AC_MSG_ERROR(bad value ${enableval} for --disable-make-data) ;;
341 esac], [make_data=true])
342 AM_CONDITIONAL(MAKE_DATA, test x$make_data = xtrue)
344 AC_ARG_ENABLE([make_include],
345 AS_HELP_STRING([--enable-make-include], [force make to recurse into include directory]),
346 [case "${enableval}" in
347 yes) make_include=true ;;
348 no) make_include=false ;;
349 *) AC_MSG_ERROR(bad value ${enableval} for --enable-make-include) ;;
350 esac], [make_include=false])
351 AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test "$make_include" = "true")
353 AC_ARG_WITH([efence],
354 AS_HELP_STRING([--with-efence], [use Electric Fence, malloc debugger]),
358 AC_ARG_ENABLE([aimodules],
359 AS_HELP_STRING([--enable-aimodules=yes/no/experimental], [support for ai modules [no]]),
360 [case "${enableval}" in
361 yes) enable_aimodules=yes ;;
362 no) enable_aimodules=no ;;
363 experimental) enable_aimodules=yes
365 *) AC_MSG_ERROR([bad value ${enable_aimodules} for --enable-aimodules]) ;;
366 esac], [enable_aimodules=no])
367 aimoduledir="${libdir}/fcai"
368 AC_SUBST(aimoduledir)
369 AM_CONDITIONAL(AI_MODULES, test "x$enable_aimodules" = "xyes")
370 if test $enable_aimodules = yes ; then
371 if test x$enable_shared != xyes ; then
372 AC_MSG_ERROR([cannot enable ai module support if also build of shared libraries is not enabled with --enable-shared])
376 AC_MSG_CHECKING([whether can build modules])
377 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ltdl.h>]],
378 [[lt_dlopenext(NULL);]])],
379 [AC_MSG_RESULT([yes])],
381 AC_MSG_ERROR([cannot build loadable AI modules as requested])])
383 SERVER_LIBS="${SERVER_LIBS} -lltdl"
384 AC_DEFINE([AI_MODULES], [1], [Enable ai modules])
385 CPPFLAGS="${CPPFLAGS} -DAI_MODULEDIR=\"\\\"${aimoduledir}\\\"\""
386 ai_mod_default_needed=yes
388 AM_CONDITIONAL(EXP_AI_MODULES, test "x$exp_aimodules" = "xyes")
390 AC_ARG_ENABLE([ai-static],
391 AS_HELP_STRING([--enable-ai-static], [statically link listed modules to server]),
392 [static_modules="${enableval}"],
393 [static_modules="classic"])
395 ai_mod_static_classic=no
396 ai_mod_static_threaded=no
398 for module in $(echo $static_modules | $SED 's/,/ /g') ; do
399 if test "x$module" = "xclassic" ; then
400 ai_mod_static_classic=yes
401 ai_mod_default_needed=yes
402 AC_DEFINE([AI_MOD_STATIC_CLASSIC], [1],
403 [classic ai module statically linked])
404 elif test "x$module" = "xthreaded" ; then
405 ai_mod_static_threaded=yes
406 ai_mod_default_needed=yes
407 AC_DEFINE([AI_MOD_STATIC_THREADED], [1],
408 [threaded ai module statically linked])
410 AC_MSG_ERROR([bad value ${module} for --enable-ai-static])
412 if test "x$default_ai_set" = "x" ; then
413 dnl Make first static module default ai type
414 default_ai_set="${module}"
417 if test "x$ai_mod_statix_classic" != "xyes" ; then
418 if test "x$ai_mod_static_threaded" = "xyes" ; then
419 AC_MSG_WARN([Selected ai module depends on classic, it's automatically enabled])
420 ai_mod_static_classic=yes
423 AM_CONDITIONAL([AI_MOD_STATIC_CLASSIC],
424 [test "x$ai_mod_static_classic" = "xyes" || test "x$enable_aimodules" != "xyes"])
425 AM_CONDITIONAL([AI_MOD_STATIC_THREADED],
426 [test "x$ai_mod_static_threaded" = "xyes"])
428 AC_ARG_WITH([default-ai],
429 AS_HELP_STRING([--with-default-ai], [default ai type [first static]]),
430 [default_ai_set="${withval}"],
433 AM_CONDITIONAL([AI_MOD_DEFAULT_NEEDED],
434 [test "x${ai_mod_default_needed}" = "xyes" || test "x${default_ai_set}" = "x"])
436 if test "x${default_ai_set}" = "x" ; then
437 default_ai_set="classic"
440 AC_DEFINE_UNQUOTED([AI_MOD_DEFAULT], ["${default_ai_set}"], [Default ai type name])
442 dnl Checks for programs.
448 dnl Replace AC_PROG_LIBTOOL with LT_INIT when minimum libtool
451 LIBTOOL="$LIBTOOL --preserve-dup-deps"
453 AC_CHECK_TOOL(AR, ar)
455 AC_MSG_ERROR([*** 'ar' missing. Install binutils, fix your \$PATH, or set \$AR manually. ***])
462 AC_CHECK_PROG(UNAME,uname,uname,:)
464 AC_CHECK_SIZEOF([int])
466 dnl Programs already checked by AM_INIT_AUTOMAKE:
468 dnl AC_PROG_MAKE_SET required with automake-ng
471 dnl Check for libiconv (which is usually included in glibc, but may be
472 dnl distributed separately). The libcharset check must come after the
473 dnl iconv check. This whole thing must come before the gettext check below.
477 if test "$am_cv_func_iconv" != yes; then
478 AC_MSG_ERROR([Iconv is missing. You can get libiconv from http://gnu.org/, \
479 or try using --with-libiconv-prefix.])
481 LIBS="$LIBS $LIBICONV"
484 ALL_LINGUAS="ar bg cs ca da de el en_GB eo es et fa fi fr ga gd he hu id it ja
485 ko lt nl nb pl pt pt_BR ro ru sr sv tr uk zh_CN zh_TW"
486 PODOMAINS="freeciv nations"
489 AS_HELP_STRING([--disable-nls], [do not add localization support]),
490 [case "${enableval}" in
494 dnl NLS disabled, but 'make dist' allowed. That dist will lack
495 dnl all generated localization files.
496 no-gmo-dist) USE_NLS=no
498 *) AC_MSG_ERROR([bad value ${enableval} for --enable-nls]) ;;
499 esac], [USE_NLS=yes])
501 if test "$USE_NLS" = "yes" ; then
504 dnl AM_GLIB_GNU_GETTEXT doesn't have all features we want
505 dnl or they don't behave correctly.
506 dnl Old gettext binaries don't understand plurals. (ngettext, msgid_plural)
507 dnl and there are some problems with missing ngettext.
508 dnl Is that ngettext part still true? AM_GLIB_GNU_GETTEXT does check for it
510 have_working_ngettext=0
511 AC_CHECK_LIB(c, ngettext,
512 [AC_MSG_CHECKING(whether libc's ngettext works at runtime)
513 FC_CHECK_NGETTEXT_RUNTIME(,have_working_ngettext=1,)],)
515 if test "$have_working_ngettext" = "0"; then
516 AC_CHECK_LIB(intl, ngettext,
517 [AC_MSG_CHECKING(whether libintl's ngettext works at runtime)
518 FC_CHECK_NGETTEXT_RUNTIME("-lintl",have_working_ngettext=1,)],)
521 if test "$have_working_ngettext" = "0"; then
522 AC_MSG_ERROR(I haven't found a working ngettext function in your system.
523 Try --disable-nls. Read ABOUT-NLS.)
526 if test "$IS_BETA_VERSION" = "1" || test "$IS_DEVEL_VERSION" = "1"; then
527 AC_MSG_CHECKING(for GNU xgettext version >= 0.10.36)
528 xgettext_version=`$XGETTEXT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'`
529 AC_RUN_IFELSE([AC_LANG_SOURCE([[
532 const char *version = "$xgettext_version";
535 const char *p = version;
536 int major = 0, minor = 0, patch = 0;
538 while (*p != '\0' && (*p < '0' || *p > '9')) {
544 sscanf(p, "%d.%d.%d", &major, &minor, &patch);
545 if (major < 1 && (minor < 10 || (minor == 10 && patch < 36))) {
550 ]])],[AC_MSG_RESULT(yes)
553 AC_MSG_WARN(You may have problems with creating pox files. \
554 Please update your gettext package.)
559 AC_MSG_CHECKING(for GNU msgfmt version >= 0.10.35)
560 msgfmt_version=`$MSGFMT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'`
561 AC_RUN_IFELSE([AC_LANG_SOURCE([[
564 const char *version = "$msgfmt_version";
568 const char *p = version;
569 int major = 0, minor = 0, patch = 0;
571 while (*p != '\0' && (*p < '0' || *p > '9')) {
577 sscanf(p, "%d.%d.%d", &major, &minor, &patch);
578 if (major < 1 && (minor < 10 || (minor == 10 && patch < 35))) {
583 ]])],[AC_MSG_RESULT(yes)
586 AC_MSG_ERROR(You are unable to create *.gmo files.
587 This is development version which doesn't include them. Please update your
588 gettext package. We recommend you versions >= 0.10.38. Or use
589 --disable-nls instead.)
595 dnl Setup POFILES even when NLS disabled.
596 dnl AM_GLIB_GNU_GETTEXT does this when NLS enabled.
597 for lang in $ALL_LINGUAS; do
598 POFILES="$POFILES $lang.po"
604 PKG_CHECK_MODULES([CURL], [libcurl >= 7.9.7],,
605 [AC_MSG_ERROR([libcurl development files required])])
606 UTILITY_CFLAGS="${UTILITY_CFLAGS} ${CURL_CFLAGS}"
607 UTILITY_LIBS="${UTILITY_LIBS} ${CURL_LIBS}"
609 dnl Set debug flags supported by compiler
610 EXTRA_DEBUG_CFLAGS=""
611 EXTRA_DEBUG_CXXFLAGS=""
612 EXTRA_DEBUG_LDFLAGS=""
618 AC_C99_VARIADIC_MACROS
619 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 guess it
842 if test "x$client" = "xauto" ; then
843 AC_MSG_ERROR([could not guess which client to compile])
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}],
897 if test "x$fc_mp" = "xcli" ; then
898 dnl Only cli requested -> no gui needed
902 for mp in $(echo $fc_mp | $SED 's/,/ /g') ; do
903 if test "x$mp" = "xno" ; then
905 elif test "x$mp" = "xauto" || test "x$mp" = "xyes" ; then
907 elif test "x$mp" = "xall" ; then
909 else if test "x$mp" = "xgtk2" ||
910 test "x$mp" = "xgtk2.0" ||
911 test "x$mp" = "xgtk20" ||
912 test "x$mp" = "xgtk-2.0" ; then
914 elif test "x$mp" = "xgtk3" ||
915 test "x$mp" = "xgtk3.0" ||
916 test "x$mp" = "xgtk30" ||
917 test "x$mp" = "xgtk-3.0" ; then
919 elif test "x$mp" = "xqt" ; then
921 elif test "x$mp" = "xcli" ; then
923 elif test "x$mp" != "xyes" ; then
924 AC_MSG_ERROR([bad value ${mp} for --enable-fcmp])
929 if test "x$req_fcmp_gtk2" = "xyes" ||
930 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
931 AM_PATH_GTK_2_0([2.12.0],
933 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
936 mp_gtk2_cflags="$GTK2_CFLAGS $GTHREAD_CFLAGS"
937 mp_gtk2_libs="$GTK2_LIBS $GTHREAD_LIBS"
938 if test "x$MINGW32" = "xyes"; then
939 dnl Required to compile gtk2 on Windows platform
940 mp_gtk2_cflags="$MP_gtk2_CFLAGS -mms-bitfields"
941 mp_gtk2_ldflags="$MP_gtk2_LDFLAGS -mwindows"
944 if test "x$modinst" = "xauto" ; then
950 if test "x$req_fcmp_gtk2" = "xyes" && test "x$fcmp_gtk2" != "xyes" ; then
951 AC_MSG_ERROR([Cannot build gtk2-version of freeciv-modpack as requested])
954 if test "x$req_fcmp_gtk3" = "xyes" ||
955 test "x$modinst" = "xall" || test "x$modinst" = "xauto" ; then
956 AM_PATH_GTK_3_0([3.0.0],
958 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
961 mp_gtk3_cflags="$GTK3_CFLAGS $GHTREAD_CFLAGS"
962 mp_gtk3_libs="$GTK3_LIBS $GTHREAD_LIBS"
963 if test "x$MINGW32" = "xyes"; then
964 dnl Required to compile gtk3 on Windows platform
965 mp_gtk3_cflags="$mp_gtk3_cflags -mms-bitfields"
966 mp_gtk3_ldflags="$mp_gtk3_ldflags -mwindows"
969 if test "x$modinst" = "xauto" ; then
975 if test "x$req_fcmp_gtk3" = "xyes" && test "x$fcmp_gtk3" != "xyes" ; then
976 AC_MSG_ERROR([Cannot build gtk3-version of freeciv-modpack as requested])
979 if test "x$req_fcmp_qt" = "xyes" ||
980 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
982 if test "x$cxx_works" = "xyes" ; then
985 if test "x$fc_qt5_usable" = "xtrue" ; then
988 mp_qt_cppflags=$FC_QT5_CPPFLAGS
989 mp_qt_cxxflags=$FC_QT5_CXXFLAGS
990 mp_qt_libs=$FC_QT5_LIBS
992 if test "x$modinst" = "xauto" ; then
1000 if test "x$req_fcmp_qt" = "xyes" && test "x$fcmp_qt" != "xyes" ; then
1001 AC_MSG_ERROR([Cannot build Qt-version of freeciv-modpack as requested])
1004 dnl Cli does not satisfy --enable-fcmp=auto as it's not an gui.
1005 if test "x$req_fcmp_cli" = "xyes" || test "x$modinst" = "xall" ; then
1009 if test "x$modinst" != "xfound" &&
1010 test "x$modinst" != "xno" &&
1011 test "x$modinst" != "xcli" &&
1012 test "x$fcmp_gtk3" != "xyes" &&
1013 test "x$fcmp_gtk2" != "xyes" &&
1014 test "x$fcmp_qt" != "xyes" ;then
1015 AC_MSG_ERROR([Cannot build modpack installer with any gui])
1018 if test "x$modinst" != "xno" && test "x$MINGW32" != "xyes" ; then
1019 dnl Hack to get a run-time icon -- not needed on Windows
1020 mp_gtk2_cflags="$mp_gtk2_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1021 mp_gtk3_cflags="$mp_gtk3_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1024 AM_CONDITIONAL([MODINST], [test "x$modinst" != "xno"])
1025 AM_CONDITIONAL([MODINST_GTK3], [test "x$fcmp_gtk3" = "xyes"])
1026 AM_CONDITIONAL([MODINST_GTK2], [test "x$fcmp_gtk2" = "xyes"])
1027 AM_CONDITIONAL([MODINST_QT], [test "x$fcmp_qt" = "xyes"])
1028 AM_CONDITIONAL([MODINST_CLI], [test "x$fcmp_cli" = "xyes"])
1030 AC_SUBST([gui_gtk2_cflags])
1031 AC_SUBST([gui_gtk2_libs])
1032 AC_SUBST([gui_gtk2_ldflags])
1033 AC_SUBST([gui_gtk3_cflags])
1034 AC_SUBST([gui_gtk3_libs])
1035 AC_SUBST([gui_gtk3_ldflags])
1036 AC_SUBST([gui_sdl_cflags])
1037 AC_SUBST([gui_sdl_libs])
1038 AC_SUBST([gui_sdl_ldflags])
1039 AC_SUBST([gui_xaw_cflags])
1040 AC_SUBST([gui_xaw_libs])
1041 AC_SUBST([gui_xaw_ldflags])
1042 AC_SUBST([gui_qt_cppflags])
1043 AC_SUBST([gui_qt_cflags])
1044 AC_SUBST([gui_qt_cxxflags])
1045 AC_SUBST([gui_qt_libs])
1046 AC_SUBST([gui_qt_ldflags])
1047 AC_SUBST([gui_stub_cflags])
1048 AC_SUBST([gui_stub_libs])
1049 AC_SUBST([gui_stub_ldflags])
1050 AC_SUBST([mp_cli_cflags])
1051 AC_SUBST([mp_cli_libs])
1052 AC_SUBST([mp_cli_ldflags])
1053 AC_SUBST([mp_gtk2_cflags])
1054 AC_SUBST([mp_gtk2_libs])
1055 AC_SUBST([mp_gtk2_ldflags])
1056 AC_SUBST([mp_gtk3_cflags])
1057 AC_SUBST([mp_gtk3_libs])
1058 AC_SUBST([mp_gtk3_ldflags])
1059 AC_SUBST([mp_qt_cppflags])
1060 AC_SUBST([mp_qt_cxxflags])
1061 AC_SUBST([mp_qt_libs])
1062 AC_SUBST([SOUND_CFLAGS])
1063 AC_SUBST([SOUND_LIBS])
1064 AC_SUBST([VERSION_WITHOUT_LABEL])
1065 AC_SUBST([VERSION_LABEL])
1066 AC_SUBST([HOST_PATH_SEPARATOR])
1067 AM_CONDITIONAL(AUDIO_SDL, test "x$SDL_mixer" != "xno")
1068 AM_CONDITIONAL(CLIENT_GUI_SDL, test "x$gui_sdl" = "xyes")
1069 AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "x$gui_gtk2" = "xyes")
1070 AM_CONDITIONAL(CLIENT_GUI_GTK_3_0, test "x$gui_gtk3" = "xyes")
1071 AM_CONDITIONAL(CLIENT_GUI_XAW, test "x$gui_xaw" = "xyes")
1072 AM_CONDITIONAL(CLIENT_GUI_QT, test "x$gui_qt" = "xyes")
1073 AM_CONDITIONAL(CLIENT_GUI_STUB, test "x$gui_stub" = "xyes")
1074 AM_CONDITIONAL(MINGW32, test x"$MINGW32" = "xyes")
1076 dnl Additional client libraries:
1077 if test "x$client" = "xyes"; then
1079 AC_SUBST(CLIENT_LIBS)
1082 dnl Checks for additional server libraries:
1083 if test "x$server" = "xyes"; then
1084 SERVER_LIBS="-lm ${SERVER_LIBS}"
1086 dnl Some systems (e.g., BeOS) need this lib
1087 AC_CHECK_LIB(bind, gethostbyaddr, SERVER_LIBS="-lbind $SERVER_LIBS")
1089 dnl Readline library and header files.
1091 AC_SUBST([SERVER_LIBS])
1092 AC_SUBST([SRV_LIB_LIBS])
1095 AC_CHECK_LIB(nls,main)
1097 dnl Checks for header files.
1100 AC_CHECK_HEADERS([fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \
1101 sys/file.h libintl.h signal.h strings.h execinfo.h \
1104 dnl Avoid including the unix emulation layer if we build mingw executables
1105 dnl There would be type conflicts between winsock and bsd/unix includes
1106 if test "x$MINGW32" != "xyes"; then
1107 AC_CHECK_HEADERS(arpa/inet.h netdb.h netinet/in.h pwd.h sys/ioctl.h \
1108 sys/select.h sys/signal.h sys/socket.h sys/termio.h \
1109 sys/uio.h termios.h)
1111 if test "x$gui_xaw" = "xyes" ; then
1112 dnl Want to get appropriate -I flags:
1113 fc_save_CPPFLAGS="$CPPFLAGS"
1114 CPPFLAGS="$CPPFLAGS $gui_xaw_cflags"
1115 AC_CHECK_HEADER(X11/xpm.h, ,
1116 AC_MSG_ERROR(need X11/xpm.h header; perhaps try/adjust --with-xpm-include))
1117 CPPFLAGS="$fc_save_CPPFLAGS"
1120 dnl Checks for typedefs, structures, and compiler characteristics.
1124 AC_CHECK_TYPES(socklen_t, [], [],
1125 [#include <sys/types.h>
1126 #include <sys/socket.h>
1129 dnl Headers that might contain the intptr_t definition found earlier
1130 AC_CHECK_HEADERS([inttypes.h stdint.h])
1132 dnl Checks for library functions.
1137 dnl Windows vsnprintf doesn't support argument reordering (see PR#12932)
1138 if test "x$MINGW32" != "xyes"; then
1140 AC_CHECK_FUNCS([vsnprintf])
1143 AC_CHECK_FUNCS([bind connect fileno flock ftime gethostbyname gethostname \
1144 getpwuid inet_aton select snooze strcasecmp strcasestr \
1145 strerror strlcat strlcpy strncasecmp strstr uname usleep \
1146 getline _strcoll stricoll _stricoll strcasecoll getaddrinfo \
1149 AC_MSG_CHECKING(for working gettimeofday)
1150 FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
1151 [Define if the gettimeofday function works and is sane.]),)
1153 dnl Check for extra socket libraries.
1154 dnl If the AC_CHECK_FUNCS check finds the function, we don't look any
1155 dnl further. This is rumoured to prevent choosing the wrong libs on IRIX.
1156 if test $ac_cv_func_gethostbyname = no; then
1157 AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS")
1159 if test $ac_cv_func_connect = no; then
1160 AC_CHECK_LIB(socket, connect, LIBS="-lsocket $LIBS")
1162 if test $ac_cv_func_bind = no; then
1163 AC_CHECK_LIB(bind, gethostbyaddr, LIBS="-lbind $LIBS")
1166 dnl The use of both AC_FUNC_VSNPRINTF and AC_CHECK_FUNCS(vsnprintf) is
1169 dnl Windows fdopen does not work with sockets.
1170 if test "x$MINGW32" != "xyes"; then
1171 AC_CHECK_FUNCS(fdopen)
1174 dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated
1175 dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS,
1176 dnl and not in LIBS.
1178 dnl Now check if non blocking sockets are possible
1179 dnl (if fcntl or ioctl exists)
1181 AC_CHECK_FUNC([fcntl],
1182 [AC_DEFINE([HAVE_FCNTL], [1], [fcntl support])
1183 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])],
1184 [AC_CHECK_FUNC([ioctl],
1185 [AC_DEFINE([HAVE_IOCTL], [1], [ioctl support])
1186 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])])])
1188 dnl Checks if SIGPIPE is usable
1189 AC_MSG_CHECKING([for SIGPIPE])
1190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[signal (SIGPIPE, SIG_IGN)]])],[AC_MSG_RESULT([yes])
1191 AC_DEFINE([HAVE_SIGPIPE], [1], [sigpipe support])],[AC_MSG_RESULT([no])])
1193 dnl export where the datadir is going to be installed
1194 FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
1196 if test x"$MINGW32" = xyes; then
1197 DEFAULT_SAVE_PATH=".;~/.freeciv/saves"
1198 if test x$crosser = xyes ; then
1199 FC_CONF_PATH="../etc/freeciv"
1200 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv;../share/freeciv"
1201 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios;../share/freeciv/scenarios"
1203 FC_CONF_PATH="etc/freeciv"
1204 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv"
1205 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios"
1208 FC_CONF_PATH="$sysconfdir/freeciv"
1209 DEFAULT_DATA_PATH=".:data:~/.freeciv/$DATASUBDIR:$datadir/freeciv"
1210 DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
1211 DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
1213 CPPFLAGS="$CPPFLAGS -DFC_CONF_PATH=\"\\\"$FC_CONF_PATH\\\"\""
1214 CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\""
1215 CPPFLAGS="$CPPFLAGS -DDEFAULT_SAVES_PATH=\"\\\"$DEFAULT_SAVES_PATH\\\"\""
1216 CPPFLAGS="$CPPFLAGS -DDEFAULT_SCENARIO_PATH=\"\\\"$DEFAULT_SCENARIO_PATH\\\"\""
1218 dnl This has to be last library
1219 if test -n "$WITH_EFENCE"; then
1220 AC_CHECK_LIB(efence, malloc, [
1221 if test "x$LIBS" = "x"; then
1224 LIBS="$LIBS -lefence"
1228 dnl Checks needed for Lua. Get rid of these if system lua is ever used.
1230 if test x$gl_cv_func_working_mkstemp = xyes ; then
1231 AC_DEFINE([HAVE_MKSTEMP], [1], [Have working mkstemp])
1233 AC_CHECK_FUNCS([isatty popen _longjmp])
1235 AC_ARG_ENABLE([sys-lua],
1236 AS_HELP_STRING([--enable-sys-lua], [use lua from system instead of one from freeciv tree [false]]),
1237 [case "${enableval}" in
1244 *) AC_MSG_ERROR([bad value ${enableval} for --enable-sys-lua]) ;;
1245 esac], [sys_lua=false])
1247 dnl There's wide divergence on what the pkg-config file for Lua is called
1248 dnl See http://lua-users.org/lists/lua-l/2008-09/msg00184.html
1249 if test "x$sys_lua" = "xtrue" || test "x$sys_lua" = "xtest" ; then
1250 PKG_CHECK_MODULES([LUA], [lua5.2], [sys_lua=true],
1251 [PKG_CHECK_MODULES([LUA], [lua-5.2], [sys_lua=true],
1252 [PKG_CHECK_MODULES([LUA], [lua >= 5.2 lua < 5.3], [sys_lua=true],
1253 [if test "x$sys_lua" = "xtrue" ; then
1254 AC_MSG_ERROR([Use of included lua disabled, and no lua found from system])
1256 feature_syslua=missing
1260 if test "x$sys_lua" = "xfalse" ; then
1261 LUA_CFLAGS="-I\$(top_srcdir)/dependencies/lua-5.2/src"
1262 LUA_LIBS="\$(top_builddir)/dependencies/lua-5.2/src/liblua.la"
1265 AC_SUBST([LUA_CFLAGS])
1266 AC_SUBST([LUA_LIBS])
1267 AM_CONDITIONAL([SYS_LUA], [test "x$sys_lua" = "xtrue"])
1269 if test x$enable_fcdb = xyes ; then
1270 LUASQL_CFLAGS="-I\$(top_srcdir)/dependencies/luasql/src"
1271 LUASQL_LIBS="\$(top_builddir)/dependencies/luasql/src/libluasql_base.la"
1272 if test x$fcdb_mysql = xyes ; then
1273 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_mysql.la"
1275 if test x$fcdb_postgres = xyes ; then
1276 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_postgres.la"
1278 if test x$fcdb_sqlite3 = xyes ; then
1279 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_sqlite3.la"
1281 LUASQL_AS_DEPENDENCY="$LUASQL_LIBS"
1282 LUASQL_LIBS="$LUASQL_LIBS $FCDB_MYSQL_LIBS $FCDB_POSTGRES_LIBS $FCDB_SQLITE3_LIBS"
1284 AC_SUBST([LUASQL_CFLAGS])
1285 AC_SUBST([LUASQL_LIBS])
1286 AC_SUBST([LUASQL_AS_DEPENDENCY])
1289 TOLUA_CFLAGS="-I\$(top_srcdir)/dependencies/tolua-5.2/include"
1290 TOLUA_LIBS="\$(top_builddir)/dependencies/tolua-5.2/src/lib/libtolua.la"
1291 AC_SUBST([TOLUA_CFLAGS])
1292 AC_SUBST([TOLUA_LIBS])
1294 TOLUA="\$(top_builddir)/dependencies/tolua-5.2/src/bin/tolua$EXEEXT"
1297 dnl Freeciv uses a non-standard macro, Q_(), to handle cases of qualified
1298 dnl translatable strings and macro PL_() to handle plural forms.
1299 dnl Since the Gettext supplied Autoconf support
1300 dnl doesn't seem to have a way to add new keywords to its xgettext call,
1301 dnl we do the following.
1302 dnl The Gettext supplied Autoconf support starts with
1303 dnl 'translations/<domain>/Makefile.in.in', and builds
1304 dnl 'translations/<domain>/Makefile.in' then 'translations/<domain>/Makefile'.
1305 dnl In order for the commonly used _() and N_() macros to work, there
1306 dnl should be somewhere in that 'translations/<domain>/Makefile' a call
1307 dnl to xgettext with "--keyword=_" and "--keyword=N_" as arguments.
1308 dnl To support Q_() and PL_(), the following simply replaces instances of
1309 dnl "--keyword=N_" with "--keyword=N_ --keyword=Q_ --keyword=PL_:1,2"
1310 dnl in the 'translations/<domain>/Makefile' file.
1311 AC_CONFIG_COMMANDS([fc_default-1],[[for domain in $PODOMAINS ; do
1312 if test -f translations/${domain}/Makefile ; then
1313 if grep 'keyword=N_ --keyword=Q_ --keyword=PL_:1,2' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1314 # has already been extended
1317 echo extending translations/${domain}/Makefile
1318 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1319 sed -e 's/--keyword=N_/--keyword=N_ --keyword=Q_ --keyword=PL_:1,2/g' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1320 rm translations/${domain}/Makefile.tmp
1323 done]],[PODOMAINS="$PODOMAINS"])
1325 dnl Vast quantities of meaningless errors from xgettext is also annoying.
1326 dnl We fix this by forcing xgettext to assume all files are C source files.
1327 AC_CONFIG_COMMANDS([fc_default-2],[[for domain in $PODOMAINS ; do
1328 if test -f translations/freeciv/Makefile ; then
1329 if grep 'language=C --files-from=\$(srcdir)/POTFILES.in' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1330 # has already been silenced
1333 echo silencing translations/${domain}/Makefile
1334 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1335 sed -e 's/--files-from=$(srcdir)\/POTFILES.in/--language=C --files-from=$(srcdir)\/POTFILES.in/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1336 rm translations/${domain}/Makefile.tmp
1339 done]],[PODOMAINS="$PODOMAINS"])
1341 dnl Most of the C comments copied to freeciv.pot are spurious;
1342 dnl change to only copy those with prefix "TRANS:"
1343 dnl Also add --escape to the arguments to convert extended
1344 dnl characters to escape characters.
1345 AC_CONFIG_COMMANDS([fc_default-4],[[for domain in $PODOMAINS ; do
1346 if test -f translations/${domain}/Makefile ; then
1347 if grep 'add-comments="TRANS:" --escape' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1348 # has already been modified
1351 echo modifying translations/${domain}/Makefile add-comments/escape
1352 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1353 sed -e 's/add-comments/add-comments="TRANS:" --escape/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1354 rm translations/${domain}/Makefile.tmp
1357 done]],[PODOMAINS="$PODOMAINS"])
1359 dnl The BeOS sys/uio.h is broken. This kludges it out of existence.
1360 dnl (This still causes lots of spurious changes to fc_config.h on BeOS.)
1361 AC_CONFIG_COMMANDS([fc_default-5],[[if test x`uname -s` = xBeOS ; then
1362 if grep '#define HAVE_SYS_UIO_H 1' fc_config.h >/dev/null 2>&1 ; then
1363 echo kluging fc_config.h
1364 mv -f fc_config.h fc_config.h.tmp
1365 sed -e 's/#define HAVE_SYS_UIO_H 1/#undef HAVE_SYS_UIO_H/g' fc_config.h.tmp > fc_config.h
1370 CFLAGS="$EXTRA_DEBUG_CFLAGS $CFLAGS"
1371 CXXFLAGS="$EXTRA_DEBUG_CXXFLAGS $CXXFLAGS"
1372 LDFLAGS="$EXTRA_DEBUG_LDFLAGS $LDFLAGS"
1374 dnl Rebuild 'configure' whenever fc_version changes, if maintainer mode enabled.
1375 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/fc_version"])
1377 dnl Make sure that fc_config.h changes when ever CPPFLAGS, CFLAGS or CXXFLAGS
1378 dnl change so everything gets rebuilt. LDFLAGS is not handled here
1379 dnl since change in it should not cause recompilation, only relinking.
1380 dnl Note: Variables are named FC_STORE_* instead of FC_*_STORE in order to
1381 dnl make them appear next to each other in fc_config.h. Also single-quotes are
1382 dnl used because some " may appear unescaped within the flag strings.
1383 AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ['$CPPFLAGS'],
1384 [These are the CPPFLAGS used in compilation])
1385 AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ['$CFLAGS'],
1386 [These are the CFLAGS used in compilation])
1387 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'],
1388 [These are the CXXFLAGS used in compilation])
1390 AC_CONFIG_FILES([Makefile
1396 data/amplio2/Makefile
1397 data/buildings/Makefile
1400 data/cimpletoon/Makefile
1401 data/trident/Makefile
1402 data/isophex/Makefile
1403 data/isotrident/Makefile
1404 data/stdsounds/Makefile
1405 data/default/Makefile
1406 data/classic/Makefile
1407 data/multiplayer/Makefile
1408 data/experimental/Makefile
1409 data/civ2civ3/Makefile
1412 data/scenarios/Makefile
1413 data/nation/Makefile
1414 data/themes/Makefile
1415 data/themes/gui-gtk-2.0/Makefile
1416 data/themes/gui-gtk-2.0/Freeciv/Makefile
1417 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Makefile
1418 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Arrows/Makefile
1419 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Buttons/Makefile
1420 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Check-Radio/Makefile
1421 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Combo/Makefile
1422 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Frame-Gap/Makefile
1423 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Handles/Makefile
1424 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Lines/Makefile
1425 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ListHeaders/Makefile
1426 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Menu-Menubar/Makefile
1427 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Others/Makefile
1428 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Panel/Makefile
1429 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ProgressBar/Makefile
1430 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Range/Makefile
1431 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Scrollbars/Makefile
1432 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Shadows/Makefile
1433 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Spin/Makefile
1434 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Tabs/Makefile
1435 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Toolbar/Makefile
1436 data/themes/gui-gtk-3.0/Makefile
1437 data/themes/gui-gtk-3.0/Freeciv/Makefile
1438 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Makefile
1439 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Arrows/Makefile
1440 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Buttons/Makefile
1441 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Check-Radio/Makefile
1442 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Combo/Makefile
1443 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Frame-Gap/Makefile
1444 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Handles/Makefile
1445 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Lines/Makefile
1446 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ListHeaders/Makefile
1447 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Menu-Menubar/Makefile
1448 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Others/Makefile
1449 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Panel/Makefile
1450 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ProgressBar/Makefile
1451 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Range/Makefile
1452 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Scrollbars/Makefile
1453 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Shadows/Makefile
1454 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Spin/Makefile
1455 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile
1456 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile
1457 data/themes/gui-sdl/Makefile
1458 data/themes/gui-sdl/human/Makefile
1459 data/wonders/Makefile
1462 dependencies/Makefile
1463 dependencies/lua-5.2/Makefile
1464 dependencies/lua-5.2/src/Makefile
1465 dependencies/tolua-5.2/Makefile
1466 dependencies/tolua-5.2/src/Makefile
1467 dependencies/tolua-5.2/src/lib/Makefile
1468 dependencies/tolua-5.2/src/bin/Makefile
1469 dependencies/luasql/Makefile
1470 dependencies/luasql/src/Makefile
1471 dependencies/cvercmp/Makefile
1473 common/aicore/Makefile
1474 common/scriptcore/Makefile
1479 ai/threaded/Makefile
1483 client/agents/Makefile
1484 client/include/Makefile
1485 client/gui-sdl/Makefile
1486 client/gui-gtk-2.0/Makefile
1487 client/gui-gtk-3.0/Makefile
1488 client/gui-xaw/Makefile
1489 client/gui-qt/Makefile
1490 client/gui-stub/Makefile
1491 client/luascript/Makefile
1493 server/advisors/Makefile
1494 server/generator/Makefile
1495 server/scripting/Makefile
1497 translations/Makefile
1498 translations/freeciv/Makefile.in
1499 translations/nations/Makefile.in
1502 doc/man/freeciv-client.6
1503 doc/man/freeciv-server.6
1504 doc/man/freeciv-manual.6
1505 doc/man/freeciv-modpack.6
1513 freeciv.spec:bootstrap/freeciv.spec.in
1515 client/freeciv.desktop:bootstrap/freeciv.desktop.in
1516 client/freeciv-gtk2.desktop:bootstrap/freeciv-gtk2.desktop.in
1517 client/freeciv-sdl.desktop:bootstrap/freeciv-sdl.desktop.in
1518 client/freeciv-qt.desktop:bootstrap/freeciv-qt.desktop.in
1519 server/freeciv-server.desktop:bootstrap/freeciv-server.desktop.in
1520 tools/freeciv-mp-gtk2.desktop:bootstrap/freeciv-mp-gtk2.desktop.in
1521 tools/freeciv-mp-gtk3.desktop:bootstrap/freeciv-mp-gtk3.desktop.in
1522 tools/freeciv-mp-qt.desktop:bootstrap/freeciv-mp-qt.desktop.in
1523 client/freeciv-gtk2.appdata.xml:bootstrap/freeciv-gtk2.appdata.xml.in
1524 client/freeciv-gtk3.appdata.xml:bootstrap/freeciv-gtk3.appdata.xml.in
1525 client/freeciv-sdl.appdata.xml:bootstrap/freeciv-sdl.appdata.xml.in
1526 client/freeciv-qt.appdata.xml:bootstrap/freeciv-qt.appdata.xml.in
1527 server/freeciv-server.appdata.xml:bootstrap/freeciv-server.appdata.xml.in
1528 tools/freeciv-mp-gtk2.appdata.xml:bootstrap/freeciv-mp-gtk2.appdata.xml.in
1529 tools/freeciv-mp-gtk3.appdata.xml:bootstrap/freeciv-mp-gtk3.appdata.xml.in
1530 tools/freeciv-mp-qt.appdata.xml:bootstrap/freeciv-mp-qt.appdata.xml.in])
1531 AC_CONFIG_FILES([fcgui:bootstrap/fcgui.in], [chmod +x fcgui])
1532 AC_CONFIG_FILES([fcser:bootstrap/fcser.in], [chmod +x fcser])
1534 if test "$USE_NLS" != "yes" ; then
1536 dnl Produced config.status will have constant value of FORCE_DIST,
1537 dnl but it still checks 'if test x$FORCE_DIST = xyes'. We cannot
1538 dnl do that check in configure when producing config.status.
1539 AC_CONFIG_COMMANDS([translations/freeciv/Makefile], [
1540 for domain in $PODOMAINS ; do
1541 dnl Usually glib-gettext.m4:AM_GLIB_GNU_GETTEXT outputs commands to
1542 dnl generate translations/${domain}/Makefile.
1543 dnl If NLS is disabled, we generate one here.
1544 rm -f translations/${domain}/Makefile
1546 dnl - Add nonls_warn as dependency to dist -target
1547 dnl - Remove dependencies from update-po, so it is never rebuilt
1548 dnl - Set list of distributed files (no generated files)
1549 sed -e 's/^dist distdir:.*/dist distdir: nonls_warn/' \
1550 -e 's/^update-po:.*/update-po:/' \
1551 -e 's/^DISTFILES =.*/DISTFILES = Makefile.in.in POTFILES.in POTFILES.skip \$(POFILES)/' \
1552 translations/${domain}/Makefile.in > translations/${domain}/Makefile
1554 dnl Create nonls_warn target.
1555 echo >> translations/${domain}/Makefile
1556 echo nonls_warn: >> translations/${domain}/Makefile
1557 if test "x$FORCE_DIST" = "xyes" ; then
1558 echo " @echo Building dist without generated localization files!" >> translations/${domain}/Makefile
1560 echo " @echo Cannot build dist with NLS disabled! && /bin/false" >> translations/${domain}/Makefile
1563 ], [FORCE_DIST=$FORCE_DIST
1564 PODOMAINS="$PODOMAINS"])
1570 ****************** Configuration Summary ******************
1572 == General build options ==
1573 Shared libraries: $enable_shared
1574 Debugging support: $enable_debug
1575 Profiling support: $enable_gprof
1576 IPv6 support: $enable_ipv6
1577 Map image toolkits: $enable_mapimg
1579 MagickWand: $mapimg_magickwand
1582 Build freeciv client: $client
1584 Maintained client frontends:
1591 In-development client frontends:
1592 (these are not yet ready for general use)
1596 Build freeciv server: $server
1597 AI modules support: $enable_aimodules
1598 Database support: $enable_fcdb
1600 postgres: $fcdb_postgres
1601 sqlite3: $fcdb_sqlite3