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:
469 dnl Check for libiconv (which is usually included in glibc, but may be
470 dnl distributed separately). The libcharset check must come after the
471 dnl iconv check. This whole thing must come before the gettext check below.
475 if test "$am_cv_func_iconv" != yes; then
476 AC_MSG_ERROR([Iconv is missing. You can get libiconv from http://gnu.org/, \
477 or try using --with-libiconv-prefix.])
479 LIBS="$LIBS $LIBICONV"
482 ALL_LINGUAS="ar bg cs ca da de el en_GB eo es et fa fi fr ga gd he hu id it ja
483 ko lt nl nb pl pt pt_BR ro ru sr sv tr uk zh_CN zh_TW"
484 PODOMAINS="freeciv nations"
487 AS_HELP_STRING([--disable-nls], [do not add localization support]),
488 [case "${enableval}" in
492 dnl NLS disabled, but 'make dist' allowed. That dist will lack
493 dnl all generated localization files.
494 no-gmo-dist) USE_NLS=no
496 *) AC_MSG_ERROR([bad value ${enableval} for --enable-nls]) ;;
497 esac], [USE_NLS=yes])
499 if test "$USE_NLS" = "yes" ; then
502 dnl AM_GLIB_GNU_GETTEXT doesn't have all features we want
503 dnl or they don't behave correctly.
504 dnl Old gettext binaries don't understand plurals. (ngettext, msgid_plural)
505 dnl and there are some problems with missing ngettext.
506 dnl Is that ngettext part still true? AM_GLIB_GNU_GETTEXT does check for it
508 have_working_ngettext=0
509 AC_CHECK_LIB(c, ngettext,
510 [AC_MSG_CHECKING(whether libc's ngettext works at runtime)
511 FC_CHECK_NGETTEXT_RUNTIME(,have_working_ngettext=1,)],)
513 if test "$have_working_ngettext" = "0"; then
514 AC_CHECK_LIB(intl, ngettext,
515 [AC_MSG_CHECKING(whether libintl's ngettext works at runtime)
516 FC_CHECK_NGETTEXT_RUNTIME("-lintl",have_working_ngettext=1,)],)
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
621 dnl BeOS-specific settings
622 if test x`$UNAME -s` = xBeOS ; then
623 AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [BeOS-specific setting])
624 CFLAGS="$CFLAGS -Wno-multichar"
625 LDFLAGS="$LDFLAGS -x none"
626 if test x$enable_debug = xyes ; then
627 CFLAGS="$CFLAGS -gdwarf-2"
628 LDFLAGS="$LDFLAGS -gdwarf-2"
630 # We used to set ARFLAGS here, but under recent versions of automake this
631 # broke compilation on other systems. Setting ARFLAGS shouldn't be
632 # necessary with a working automake.
638 HOST_PATH_SEPARATOR=":"
640 dnl Settings specific to host OS
644 dnl Windows-specific settings
646 AC_CHECK_TOOL([WINDRES], [windres])
647 if test -z $WINDRES; then
648 AC_MSG_ERROR([*** 'windres' missing. Install binutils, fix your \$PATH, or set \$WINDRES manually. ***])
651 HOST_PATH_SEPARATOR=";"
653 AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [Mingw32-specific setting - stdin])
654 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw32])
655 AC_DEFINE([WIN32_NATIVE], [1], [Mingw32-specific setting - native])
656 AC_DEFINE([HAVE_WINSOCK], [1], [Mingw32-specific setting - winsock])
657 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])
658 LIBS="$LIBS -lwsock32"
662 dnl SkyOS specific settings
663 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - SkyOS])
667 dnl Haiku specific settings
668 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Haiku])
669 LIBS="$LIBS -lnetwork"
674 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Amiga])
679 dnl Autoconf provides path separator for build system.
680 dnl Use that instead of our own guess in case of native build.
681 if test x$build = x$host ; then
682 HOST_PATH_SEPARATOR=$PATH_SEPARATOR
685 dnl note this has to match the path installed by translations/freeciv/Makefile
686 if test x"$MINGW32" != "xyes"; then
687 CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\"\\\"$localedir\\\"\""
689 AC_DEFINE_UNQUOTED([LOCALEDIR], ["./share/locale"], [Locale directory (windows)])
692 CPPFLAGS="$CPPFLAGS -DBINDIR=\"\\\"$bindir\\\"\""
697 AC_CHECK_LIB(z, gzgets,
698 [AC_DEFINE([HAVE_LIBZ], [1], [zlib is available])
699 UTILITY_LIBS="${UTILITY_LIBS} -lz"
700 COMMON_LIBS="$COMMON_LIBS -lz"],
701 AC_MSG_ERROR([Could not find zlib library.]))
703 AC_CHECK_HEADER(zlib.h, ,
704 AC_MSG_ERROR([zlib found but not zlib.h.
705 You may need to install a zlib devel package.]))
707 AC_PATH_PROG(GZIP, gzip, "no")
708 if test "$GZIP" = "no"; then
709 AC_MSG_ERROR([You need the gzip program for compilation.])
712 dnl Check for bzip2 compression
713 AC_CHECK_LIB(bz2, BZ2_bzReadOpen,
714 [AC_CHECK_HEADERS([bzlib.h],
715 [AC_DEFINE([HAVE_LIBBZ2], [1], [libbzip2 is available])
716 UTILITY_LIBS="${UTILITY_LIBS} -lbz2"
717 libbz2_available=true])])
718 if test "x$libbz2_available" != "xtrue" ; then
722 dnl Check for xz compression
723 AC_CHECK_LIB(lzma, lzma_code,
724 [AC_CHECK_HEADERS([lzma.h],
725 [AC_DEFINE([HAVE_LIBLZMA], [1], [liblzma is available])
726 UTILITY_LIBS="${UTILITY_LIBS} -llzma"
727 libxz_available=true])])
728 if test "x$libxz_available" != "xtrue" ; then
732 AC_SUBST([UTILITY_CFLAGS])
733 AC_SUBST([UTILITY_LIBS])
734 AC_SUBST([COMMON_LIBS])
736 AC_ARG_ENABLE([crosser],
737 AS_HELP_STRING([--enable-crosser], [build version to be used with crosser environment]),
738 [case "${enableval}" in
741 *) AC_MSG_ERROR([bad value ${enableval} for --enable-crosser]) ;;
743 if test x$crosser = xyes && test x$MINGW32 != xyes ; then
744 AC_MSG_ERROR([--enable-crosser is Windows build specific option])
747 dnl Check thread implementation
748 AC_MSG_CHECKING([for threads implementation])
751 CFLAGS_SAVE="${CFLAGS}"
754 if test x$crosser != xyes ; then
755 FC_C_FLAGS([-pthread], [], [CFLAGS])
756 FC_LD_FLAGS([-pthread], [], [LIBS])
757 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
758 [[return pthread_create(NULL, NULL, NULL, NULL);]])],
759 [AC_DEFINE([HAVE_PTHREAD], [1], [Use pthreads as thread implementation])
761 AC_MSG_RESULT([pthreads])
762 AC_DEFINE([HAVE_THREAD_COND], [1], [Has thread condition variable implementation])])
766 if test "x$thread_impl" = "xnone" ; then
767 CFLAGS="$CFLAGS_SAVE"
768 LDFLAGS="$LDFLAGS_SAVE"
770 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
771 [[CreateThread(NULL, 0, NULL, NULL, 0, NULL);]])],
772 [AC_DEFINE([HAVE_WINTHREADS], [1], [Use Windows threads as thread implementation])
774 AC_MSG_RESULT([windows])])
777 if test "x$thread_impl" = "xnone" ; then
778 AC_MSG_ERROR([No usable thread implementation available])
781 if test "x$thread_cond" != "xtrue" ; then
782 feature_thr_cond=missing
785 dnl Check and choose clients
786 if test "x$client" != "xno"; then
788 dnl Check for sound support, sets SOUND_CFLAGS, SOUND_LIBS, AUDIO_SDL
789 dnl Client gui checks need to know which mixer version this has selected
792 dnl if specified --with-xaw or --with-xaw3d, assume --enable-client=xaw
793 if test -n "$WITH_XAW" || test -n "$WITH_XAW3D"; then
794 if test "x$client" = "xauto" ; then
797 elif test "x$client" = "xall" ; then
802 dnl if need to guess client, announce checking
803 if test "x$client" = "xauto"; then
804 AS_MESSAGE([checking for which client to compile:...])
805 elif test "x$client" = "xall" ; then
806 AS_MESSAGE([checking for which clients to compile:...])
809 dnl Gtk-2.0-specific overrides
812 dnl Gtk-3.0-specific overrides
815 dnl SDL-specific overrides
818 dnl Xaw-specific overrides
821 dnl QT-specific overrides
824 dnl Stub-specific overrides
825 if test "x$gui_stub" = "xyes" || test "x$client" = "xall" ; then
828 if test "x$found_client" = "xyes"; then
830 if test "x$client" = "xauto" ; then
834 elif test "x$gui_stub" = "xyes"; then
835 AC_MSG_ERROR(specified client 'stub' not configurable)
839 dnl If client still "auto", error out since we couldn't guess it
840 if test "x$client" = "xauto" ; then
841 AC_MSG_ERROR([could not guess which client to compile])
845 if test "x$client" = "xall" ; then
846 if test "x$gui_gtk2" = "xyes" ||
847 test "x$gui_gtk3" = "xyes" ||
848 test "x$gui_sdl" = "xyes" ||
849 test "x$gui_xaw" = "xyes" ||
850 test "x$gui_qt" = "xyes" ||
851 test "x$gui_stub" = "xyes" ; then
859 if test "x$gui_gtk2" = "xyes" || test "x$gui_gtk3" = "xyes" ; then
861 if test "x$gui_gtk2" = "xyes" ; then
862 GUI_gtk2_LIBS="$GUI_gtk2_LIBS $LIB_GGZ_GTK"
864 if test "x$gui_gtk3" = "xyes" ; then
865 GUI_gtk3_LIBS="$GUI_gtk3_LIBS $LIB_GGZ_GTK"
870 if test "$ggz_server" = "yes" ; then
871 AC_CHECK_FUNCS([chdir mkdtemp])
874 FC_LD_FLAGS(["-Wl,-rpath=${lib_prefix}"], [], [LDFLAGS])
876 AM_CONDITIONAL([CLIENT], [test "x$client" = "xyes"])
878 AC_ARG_WITH([freeciv-manual],
879 AS_HELP_STRING([--without-freeciv-manual], [do not build freeciv-manual]),
880 [fcmanual=${withval}], [fcmanual=yes])
882 AM_CONDITIONAL([FCMANUAL], [test "x$fcmanual" = "xyes"])
884 dnl freeciv-modpack checks
885 AC_ARG_ENABLE([fcmp],
886 AS_HELP_STRING([--enable-fcmp=no/yes/gtk2/gtk3/qt/cli/all/auto], [build freeciv-modpack-program [auto]]),
887 [fc_mp=${enableval}],
895 if test "x$fc_mp" = "xcli" ; then
896 dnl Only cli requested -> no gui needed
900 for mp in $(echo $fc_mp | $SED 's/,/ /g') ; do
901 if test "x$mp" = "xno" ; then
903 elif test "x$mp" = "xauto" || test "x$mp" = "xyes" ; then
905 elif test "x$mp" = "xall" ; then
907 else if test "x$mp" = "xgtk2" ||
908 test "x$mp" = "xgtk2.0" ||
909 test "x$mp" = "xgtk20" ||
910 test "x$mp" = "xgtk-2.0" ; then
912 elif test "x$mp" = "xgtk3" ||
913 test "x$mp" = "xgtk3.0" ||
914 test "x$mp" = "xgtk30" ||
915 test "x$mp" = "xgtk-3.0" ; then
917 elif test "x$mp" = "xqt" ; then
919 elif test "x$mp" = "xcli" ; then
921 elif test "x$mp" != "xyes" ; then
922 AC_MSG_ERROR([bad value ${mp} for --enable-fcmp])
927 if test "x$req_fcmp_gtk2" = "xyes" ||
928 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
929 AM_PATH_GTK_2_0([2.12.0],
931 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
934 MP_gtk2_CFLAGS="$GTK2_CFLAGS $GTHREAD_CFLAGS"
935 MP_gtk2_LIBS="$GTK2_LIBS $GTHREAD_LIBS"
936 if test "x$MINGW32" = "xyes"; then
937 dnl Required to compile gtk2 on Windows platform
938 MP_gtk2_CFLAGS="$MP_gtk2_CFLAGS -mms-bitfields"
939 MP_gtk2_LDFLAGS="$MP_gtk2_LDFLAGS -mwindows"
942 if test "x$modinst" = "xauto" ; then
948 if test "x$req_fcmp_gtk2" = "xyes" && test "x$fcmp_gtk2" != "xyes" ; then
949 AC_MSG_ERROR([Cannot build gtk2-version of freeciv-modpack as requested])
952 if test "x$req_fcmp_gtk3" = "xyes" ||
953 test "x$modinst" = "xall" || test "x$modinst" = "xauto" ; then
954 AM_PATH_GTK_3_0([3.0.0],
956 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
959 MP_gtk3_CFLAGS="$GTK3_CFLAGS $GHTREAD_CFLAGS"
960 MP_gtk3_LIBS="$GTK3_LIBS $GTHREAD_LIBS"
961 if test "x$MINGW32" = "xyes"; then
962 dnl Required to compile gtk3 on Windows platform
963 MP_gtk3_CFLAGS="$MP_gtk3_CFLAGS -mms-bitfields"
964 MP_gtk3_LDFLAGS="$MP_gtk3_LDFLAGS -mwindows"
967 if test "x$modinst" = "xauto" ; then
973 if test "x$req_fcmp_gtk3" = "xyes" && test "x$fcmp_gtk3" != "xyes" ; then
974 AC_MSG_ERROR([Cannot build gtk3-version of freeciv-modpack as requested])
977 if test "x$req_fcmp_qt" = "xyes" ||
978 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
980 if test "x$cxx_works" = "xyes" ; then
983 if test "x$fc_qt5_usable" = "xtrue" ; then
986 MP_qt_CPPFLAGS=$FC_QT5_CPPFLAGS
987 MP_qt_CXXFLAGS=$FC_QT5_CXXFLAGS
988 MP_qt_LIBS=$FC_QT5_LIBS
990 if test "x$modinst" = "xauto" ; then
998 if test "x$req_fcmp_qt" = "xyes" && test "x$fcmp_qt" != "xyes" ; then
999 AC_MSG_ERROR([Cannot build Qt-version of freeciv-modpack as requested])
1002 dnl Cli does not satisfy --enable-fcmp=auto as it's not an gui.
1003 if test "x$req_fcmp_cli" = "xyes" || test "x$modinst" = "xall" ; then
1007 if test "x$modinst" != "xfound" &&
1008 test "x$modinst" != "xno" &&
1009 test "x$modinst" != "xcli" &&
1010 test "x$fcmp_gtk3" != "xyes" &&
1011 test "x$fcmp_gtk2" != "xyes" &&
1012 test "x$fcmp_qt" != "xyes" ;then
1013 AC_MSG_ERROR([Cannot build modpack installer with any gui])
1016 if test "x$modinst" != "xno" && test "x$MINGW32" != "xyes" ; then
1017 dnl Hack to get a run-time icon -- not needed on Windows
1018 MP_gtk2_CFLAGS="$MP_gtk2_CFLAGS -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1019 MP_gtk3_CFLAGS="$MP_gtk3_CFLAGS -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1022 AM_CONDITIONAL([MODINST], [test "x$modinst" != "xno"])
1023 AM_CONDITIONAL([MODINST_GTK3], [test "x$fcmp_gtk3" = "xyes"])
1024 AM_CONDITIONAL([MODINST_GTK2], [test "x$fcmp_gtk2" = "xyes"])
1025 AM_CONDITIONAL([MODINST_QT], [test "x$fcmp_qt" = "xyes"])
1026 AM_CONDITIONAL([MODINST_CLI], [test "x$fcmp_cli" = "xyes"])
1028 AC_SUBST([GUI_gtk2_CFLAGS])
1029 AC_SUBST([GUI_gtk2_LIBS])
1030 AC_SUBST([GUI_gtk2_LDFLAGS])
1031 AC_SUBST([GUI_gtk3_CFLAGS])
1032 AC_SUBST([GUI_gtk3_LIBS])
1033 AC_SUBST([GUI_gtk3_LDFLAGS])
1034 AC_SUBST([GUI_sdl_CFLAGS])
1035 AC_SUBST([GUI_sdl_LIBS])
1036 AC_SUBST([GUI_sdl_LDFLAGS])
1037 AC_SUBST([GUI_xaw_CFLAGS])
1038 AC_SUBST([GUI_xaw_LIBS])
1039 AC_SUBST([GUI_xaw_LDFLAGS])
1040 AC_SUBST([GUI_qt_CPPFLAGS])
1041 AC_SUBST([GUI_qt_CFLAGS])
1042 AC_SUBST([GUI_qt_CXXFLAGS])
1043 AC_SUBST([GUI_qt_LIBS])
1044 AC_SUBST([GUI_qt_LDFLAGS])
1045 AC_SUBST([GUI_stub_CFLAGS])
1046 AC_SUBST([GUI_stub_LIBS])
1047 AC_SUBST([GUI_stub_LDFLAGS])
1048 AC_SUBST([MP_cli_CFLAGS])
1049 AC_SUBST([MP_cli_LIBS])
1050 AC_SUBST([MP_cli_LDFLAGS])
1051 AC_SUBST([MP_gtk2_CFLAGS])
1052 AC_SUBST([MP_gtk2_LIBS])
1053 AC_SUBST([MP_gtk2_LDFLAGS])
1054 AC_SUBST([MP_gtk3_CFLAGS])
1055 AC_SUBST([MP_gtk3_LIBS])
1056 AC_SUBST([MP_gtk3_LDFLAGS])
1057 AC_SUBST([MP_qt_CPPFLAGS])
1058 AC_SUBST([MP_qt_CXXFLAGS])
1059 AC_SUBST([MP_qt_LIBS])
1060 AC_SUBST([SOUND_CFLAGS])
1061 AC_SUBST([SOUND_LIBS])
1062 AC_SUBST([VERSION_WITHOUT_LABEL])
1063 AC_SUBST([VERSION_LABEL])
1064 AC_SUBST([HOST_PATH_SEPARATOR])
1065 AM_CONDITIONAL(AUDIO_SDL, test "x$SDL_mixer" != "xno")
1066 AM_CONDITIONAL(CLIENT_GUI_SDL, test "x$gui_sdl" = "xyes")
1067 AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "x$gui_gtk2" = "xyes")
1068 AM_CONDITIONAL(CLIENT_GUI_GTK_3_0, test "x$gui_gtk3" = "xyes")
1069 AM_CONDITIONAL(CLIENT_GUI_XAW, test "x$gui_xaw" = "xyes")
1070 AM_CONDITIONAL(CLIENT_GUI_QT, test "x$gui_qt" = "xyes")
1071 AM_CONDITIONAL(CLIENT_GUI_STUB, test "x$gui_stub" = "xyes")
1072 AM_CONDITIONAL(MINGW32, test x"$MINGW32" = "xyes")
1074 dnl Additional client libraries:
1075 if test "x$client" = "xyes"; then
1077 AC_SUBST(CLIENT_LIBS)
1080 dnl Checks for additional server libraries:
1081 if test "x$server" = "xyes"; then
1082 SERVER_LIBS="-lm ${SERVER_LIBS}"
1084 dnl Some systems (e.g., BeOS) need this lib
1085 AC_CHECK_LIB(bind, gethostbyaddr, SERVER_LIBS="-lbind $SERVER_LIBS")
1087 dnl Readline library and header files.
1089 AC_SUBST([SERVER_LIBS])
1090 AC_SUBST([SRV_LIB_LIBS])
1093 AC_CHECK_LIB(nls,main)
1095 dnl Checks for header files.
1098 AC_CHECK_HEADERS([fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \
1099 sys/file.h libintl.h signal.h strings.h execinfo.h \
1102 dnl Avoid including the unix emulation layer if we build mingw executables
1103 dnl There would be type conflicts between winsock and bsd/unix includes
1104 if test "x$MINGW32" != "xyes"; then
1105 AC_CHECK_HEADERS(arpa/inet.h netdb.h netinet/in.h pwd.h sys/ioctl.h \
1106 sys/select.h sys/signal.h sys/socket.h sys/termio.h \
1107 sys/uio.h termios.h)
1109 if test "x$gui_xaw" = "xyes" ; then
1110 dnl Want to get appropriate -I flags:
1111 fc_save_CPPFLAGS="$CPPFLAGS"
1112 CPPFLAGS="$CPPFLAGS $GUI_xaw_CFLAGS"
1113 AC_CHECK_HEADER(X11/xpm.h, ,
1114 AC_MSG_ERROR(need X11/xpm.h header; perhaps try/adjust --with-xpm-include))
1115 CPPFLAGS="$fc_save_CPPFLAGS"
1118 dnl Checks for typedefs, structures, and compiler characteristics.
1122 AC_CHECK_TYPES(socklen_t, [], [],
1123 [#include <sys/types.h>
1124 #include <sys/socket.h>
1127 dnl Headers that might contain the intptr_t definition found earlier
1128 AC_CHECK_HEADERS([inttypes.h stdint.h])
1130 dnl Checks for library functions.
1135 dnl Windows vsnprintf doesn't support argument reordering (see PR#12932)
1136 if test "x$MINGW32" != "xyes"; then
1138 AC_CHECK_FUNCS([vsnprintf])
1141 AC_CHECK_FUNCS([bind connect fileno flock ftime gethostbyname gethostname \
1142 getpwuid inet_aton select snooze strcasecmp strcasestr \
1143 strerror strlcat strlcpy strncasecmp strstr uname usleep \
1144 getline _strcoll stricoll _stricoll strcasecoll getaddrinfo \
1147 AC_MSG_CHECKING(for working gettimeofday)
1148 FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
1149 [Define if the gettimeofday function works and is sane.]),)
1151 dnl Check for extra socket libraries.
1152 dnl If the AC_CHECK_FUNCS check finds the function, we don't look any
1153 dnl further. This is rumoured to prevent choosing the wrong libs on IRIX.
1154 if test $ac_cv_func_gethostbyname = no; then
1155 AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS")
1157 if test $ac_cv_func_connect = no; then
1158 AC_CHECK_LIB(socket, connect, LIBS="-lsocket $LIBS")
1160 if test $ac_cv_func_bind = no; then
1161 AC_CHECK_LIB(bind, gethostbyaddr, LIBS="-lbind $LIBS")
1164 dnl The use of both AC_FUNC_VSNPRINTF and AC_CHECK_FUNCS(vsnprintf) is
1167 dnl Windows fdopen does not work with sockets.
1168 if test "x$MINGW32" != "xyes"; then
1169 AC_CHECK_FUNCS(fdopen)
1172 dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated
1173 dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS,
1174 dnl and not in LIBS.
1176 dnl Now check if non blocking sockets are possible
1177 dnl (if fcntl or ioctl exists)
1179 AC_CHECK_FUNC([fcntl],
1180 [AC_DEFINE([HAVE_FCNTL], [1], [fcntl support])
1181 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])],
1182 [AC_CHECK_FUNC([ioctl],
1183 [AC_DEFINE([HAVE_IOCTL], [1], [ioctl support])
1184 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])])])
1186 dnl Checks if SIGPIPE is usable
1187 AC_MSG_CHECKING([for SIGPIPE])
1188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[signal (SIGPIPE, SIG_IGN)]])],[AC_MSG_RESULT([yes])
1189 AC_DEFINE([HAVE_SIGPIPE], [1], [sigpipe support])],[AC_MSG_RESULT([no])])
1191 dnl export where the datadir is going to be installed
1192 FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
1194 if test x"$MINGW32" = xyes; then
1195 DEFAULT_SAVE_PATH=".;~/.freeciv/saves"
1196 if test x$crosser = xyes ; then
1197 FC_CONF_PATH="../etc/freeciv"
1198 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv;../share/freeciv"
1199 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios;../share/freeciv/scenarios"
1201 FC_CONF_PATH="etc/freeciv"
1202 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv"
1203 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios"
1206 FC_CONF_PATH="$sysconfdir/freeciv"
1207 DEFAULT_DATA_PATH=".:data:~/.freeciv/$DATASUBDIR:$datadir/freeciv"
1208 DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
1209 DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
1211 CPPFLAGS="$CPPFLAGS -DFC_CONF_PATH=\"\\\"$FC_CONF_PATH\\\"\""
1212 CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\""
1213 CPPFLAGS="$CPPFLAGS -DDEFAULT_SAVES_PATH=\"\\\"$DEFAULT_SAVES_PATH\\\"\""
1214 CPPFLAGS="$CPPFLAGS -DDEFAULT_SCENARIO_PATH=\"\\\"$DEFAULT_SCENARIO_PATH\\\"\""
1216 dnl This has to be last library
1217 if test -n "$WITH_EFENCE"; then
1218 AC_CHECK_LIB(efence, malloc, [
1219 if test "x$LIBS" = "x"; then
1222 LIBS="$LIBS -lefence"
1226 dnl Checks needed for Lua. Get rid of these if system lua is ever used.
1228 if test x$gl_cv_func_working_mkstemp = xyes ; then
1229 AC_DEFINE([HAVE_MKSTEMP], [1], [Have working mkstemp])
1231 AC_CHECK_FUNCS([isatty popen _longjmp])
1233 AC_ARG_ENABLE([sys-lua],
1234 AS_HELP_STRING([--enable-sys-lua], [use lua from system instead of one from freeciv tree [false]]),
1235 [case "${enableval}" in
1242 *) AC_MSG_ERROR([bad value ${enableval} for --enable-sys-lua]) ;;
1243 esac], [sys_lua=false])
1245 dnl There's wide divergence on what the pkg-config file for Lua is called
1246 dnl See http://lua-users.org/lists/lua-l/2008-09/msg00184.html
1247 if test "x$sys_lua" = "xtrue" || test "x$sys_lua" = "xtest" ; then
1248 PKG_CHECK_MODULES([LUA], [lua5.2], [sys_lua=true],
1249 [PKG_CHECK_MODULES([LUA], [lua-5.2], [sys_lua=true],
1250 [PKG_CHECK_MODULES([LUA], [lua >= 5.2 lua < 5.3], [sys_lua=true],
1251 [if test "x$sys_lua" = "xtrue" ; then
1252 AC_MSG_ERROR([Use of included lua disabled, and no lua found from system])
1254 feature_syslua=missing
1258 if test "x$sys_lua" = "xfalse" ; then
1259 LUA_CFLAGS="-I\$(top_srcdir)/dependencies/lua-5.2/src"
1260 LUA_LIBS="\$(top_builddir)/dependencies/lua-5.2/src/liblua.la"
1263 AC_SUBST([LUA_CFLAGS])
1264 AC_SUBST([LUA_LIBS])
1265 AM_CONDITIONAL([SYS_LUA], [test "x$sys_lua" = "xtrue"])
1267 if test x$enable_fcdb = xyes ; then
1268 LUASQL_CFLAGS="-I\$(top_srcdir)/dependencies/luasql/src"
1269 LUASQL_LIBS="\$(top_builddir)/dependencies/luasql/src/libluasql_base.la"
1270 if test x$fcdb_mysql = xyes ; then
1271 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_mysql.la"
1273 if test x$fcdb_postgres = xyes ; then
1274 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_postgres.la"
1276 if test x$fcdb_sqlite3 = xyes ; then
1277 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_sqlite3.la"
1279 LUASQL_AS_DEPENDENCY="$LUASQL_LIBS"
1280 LUASQL_LIBS="$LUASQL_LIBS $FCDB_MYSQL_LIBS $FCDB_POSTGRES_LIBS $FCDB_SQLITE3_LIBS"
1282 AC_SUBST([LUASQL_CFLAGS])
1283 AC_SUBST([LUASQL_LIBS])
1284 AC_SUBST([LUASQL_AS_DEPENDENCY])
1287 TOLUA_CFLAGS="-I\$(top_srcdir)/dependencies/tolua-5.2/include"
1288 TOLUA_LIBS="\$(top_builddir)/dependencies/tolua-5.2/src/lib/libtolua.la"
1289 AC_SUBST([TOLUA_CFLAGS])
1290 AC_SUBST([TOLUA_LIBS])
1292 TOLUA="\$(top_builddir)/dependencies/tolua-5.2/src/bin/tolua$EXEEXT"
1295 dnl Freeciv uses a non-standard macro, Q_(), to handle cases of qualified
1296 dnl translatable strings and macro PL_() to handle plural forms.
1297 dnl Since the Gettext supplied Autoconf support
1298 dnl doesn't seem to have a way to add new keywords to its xgettext call,
1299 dnl we do the following.
1300 dnl The Gettext supplied Autoconf support starts with
1301 dnl 'translations/<domain>/Makefile.in.in', and builds
1302 dnl 'translations/<domain>/Makefile.in' then 'translations/<domain>/Makefile'.
1303 dnl In order for the commonly used _() and N_() macros to work, there
1304 dnl should be somewhere in that 'translations/<domain>/Makefile' a call
1305 dnl to xgettext with "--keyword=_" and "--keyword=N_" as arguments.
1306 dnl To support Q_() and PL_(), the following simply replaces instances of
1307 dnl "--keyword=N_" with "--keyword=N_ --keyword=Q_ --keyword=PL_:1,2"
1308 dnl in the 'translations/<domain>/Makefile' file.
1309 AC_CONFIG_COMMANDS([fc_default-1],[[for domain in $PODOMAINS ; do
1310 if test -f translations/${domain}/Makefile ; then
1311 if grep 'keyword=N_ --keyword=Q_ --keyword=PL_:1,2' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1312 # has already been extended
1315 echo extending translations/${domain}/Makefile
1316 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1317 sed -e 's/--keyword=N_/--keyword=N_ --keyword=Q_ --keyword=PL_:1,2/g' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1318 rm translations/${domain}/Makefile.tmp
1321 done]],[PODOMAINS="$PODOMAINS"])
1323 dnl Vast quantities of meaningless errors from xgettext is also annoying.
1324 dnl We fix this by forcing xgettext to assume all files are C source files.
1325 AC_CONFIG_COMMANDS([fc_default-2],[[for domain in $PODOMAINS ; do
1326 if test -f translations/freeciv/Makefile ; then
1327 if grep 'language=C --files-from=\$(srcdir)/POTFILES.in' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1328 # has already been silenced
1331 echo silencing translations/${domain}/Makefile
1332 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1333 sed -e 's/--files-from=$(srcdir)\/POTFILES.in/--language=C --files-from=$(srcdir)\/POTFILES.in/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1334 rm translations/${domain}/Makefile.tmp
1337 done]],[PODOMAINS="$PODOMAINS"])
1339 dnl Most of the C comments copied to freeciv.pot are spurious;
1340 dnl change to only copy those with prefix "TRANS:"
1341 dnl Also add --escape to the arguments to convert extended
1342 dnl characters to escape characters.
1343 AC_CONFIG_COMMANDS([fc_default-4],[[for domain in $PODOMAINS ; do
1344 if test -f translations/${domain}/Makefile ; then
1345 if grep 'add-comments="TRANS:" --escape' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1346 # has already been modified
1349 echo modifying translations/${domain}/Makefile add-comments/escape
1350 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1351 sed -e 's/add-comments/add-comments="TRANS:" --escape/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1352 rm translations/${domain}/Makefile.tmp
1355 done]],[PODOMAINS="$PODOMAINS"])
1357 dnl The BeOS sys/uio.h is broken. This kludges it out of existence.
1358 dnl (This still causes lots of spurious changes to fc_config.h on BeOS.)
1359 AC_CONFIG_COMMANDS([fc_default-5],[[if test x`uname -s` = xBeOS ; then
1360 if grep '#define HAVE_SYS_UIO_H 1' fc_config.h >/dev/null 2>&1 ; then
1361 echo kluging fc_config.h
1362 mv -f fc_config.h fc_config.h.tmp
1363 sed -e 's/#define HAVE_SYS_UIO_H 1/#undef HAVE_SYS_UIO_H/g' fc_config.h.tmp > fc_config.h
1368 CFLAGS="$EXTRA_DEBUG_CFLAGS $CFLAGS"
1369 CXXFLAGS="$EXTRA_DEBUG_CXXFLAGS $CXXFLAGS"
1370 LDFLAGS="$EXTRA_DEBUG_LDFLAGS $LDFLAGS"
1372 dnl Rebuild 'configure' whenever fc_version changes, if maintainer mode enabled.
1373 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/fc_version"])
1375 dnl Make sure that config.h changes when ever CPPFLAGS, CFLAGS or CXXFLAGS
1376 dnl change so everything gets rebuilt. LDFLAGS is not handled here
1377 dnl since change in it should not cause recompilation, only relinking.
1378 dnl Note: Variables are named FC_STORE_* instead of FC_*_STORE in order to
1379 dnl make them appear next to each other in fc_config.h. Also single-quotes are
1380 dnl used because some " may appear unescaped within the flag strings.
1381 AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ['$CPPFLAGS'],
1382 [These are the CPPFLAGS used in compilation])
1383 AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ['$CFLAGS'],
1384 [These are the CFLAGS used in compilation])
1385 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'],
1386 [These are the CXXFLAGS used in compilation])
1388 AC_CONFIG_FILES([Makefile
1394 data/amplio2/Makefile
1395 data/buildings/Makefile
1398 data/cimpletoon/Makefile
1399 data/trident/Makefile
1400 data/isophex/Makefile
1401 data/isotrident/Makefile
1402 data/stdsounds/Makefile
1403 data/default/Makefile
1404 data/classic/Makefile
1405 data/multiplayer/Makefile
1406 data/experimental/Makefile
1407 data/civ2civ3/Makefile
1410 data/scenarios/Makefile
1411 data/nation/Makefile
1412 data/themes/Makefile
1413 data/themes/gui-gtk-2.0/Makefile
1414 data/themes/gui-gtk-2.0/Freeciv/Makefile
1415 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Makefile
1416 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Arrows/Makefile
1417 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Buttons/Makefile
1418 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Check-Radio/Makefile
1419 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Combo/Makefile
1420 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Frame-Gap/Makefile
1421 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Handles/Makefile
1422 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Lines/Makefile
1423 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ListHeaders/Makefile
1424 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Menu-Menubar/Makefile
1425 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Others/Makefile
1426 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Panel/Makefile
1427 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ProgressBar/Makefile
1428 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Range/Makefile
1429 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Scrollbars/Makefile
1430 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Shadows/Makefile
1431 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Spin/Makefile
1432 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Tabs/Makefile
1433 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Toolbar/Makefile
1434 data/themes/gui-gtk-3.0/Makefile
1435 data/themes/gui-gtk-3.0/Freeciv/Makefile
1436 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Makefile
1437 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Arrows/Makefile
1438 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Buttons/Makefile
1439 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Check-Radio/Makefile
1440 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Combo/Makefile
1441 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Frame-Gap/Makefile
1442 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Handles/Makefile
1443 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Lines/Makefile
1444 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ListHeaders/Makefile
1445 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Menu-Menubar/Makefile
1446 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Others/Makefile
1447 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Panel/Makefile
1448 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ProgressBar/Makefile
1449 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Range/Makefile
1450 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Scrollbars/Makefile
1451 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Shadows/Makefile
1452 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Spin/Makefile
1453 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile
1454 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile
1455 data/themes/gui-sdl/Makefile
1456 data/themes/gui-sdl/human/Makefile
1457 data/wonders/Makefile
1460 dependencies/Makefile
1461 dependencies/lua-5.2/Makefile
1462 dependencies/lua-5.2/src/Makefile
1463 dependencies/tolua-5.2/Makefile
1464 dependencies/tolua-5.2/src/Makefile
1465 dependencies/tolua-5.2/src/lib/Makefile
1466 dependencies/tolua-5.2/src/bin/Makefile
1467 dependencies/luasql/Makefile
1468 dependencies/luasql/src/Makefile
1469 dependencies/cvercmp/Makefile
1471 common/aicore/Makefile
1472 common/scriptcore/Makefile
1477 ai/threaded/Makefile
1481 client/agents/Makefile
1482 client/include/Makefile
1483 client/gui-sdl/Makefile
1484 client/gui-gtk-2.0/Makefile
1485 client/gui-gtk-3.0/Makefile
1486 client/gui-xaw/Makefile
1487 client/gui-qt/Makefile
1488 client/gui-stub/Makefile
1489 client/luascript/Makefile
1491 server/advisors/Makefile
1492 server/generator/Makefile
1493 server/scripting/Makefile
1495 translations/Makefile
1496 translations/freeciv/Makefile.in
1497 translations/nations/Makefile.in
1500 doc/man/freeciv-client.6
1501 doc/man/freeciv-server.6
1502 doc/man/freeciv-manual.6
1503 doc/man/freeciv-modpack.6
1511 freeciv.spec:bootstrap/freeciv.spec.in
1513 client/freeciv.desktop:bootstrap/freeciv.desktop.in
1514 client/freeciv-gtk2.desktop:bootstrap/freeciv-gtk2.desktop.in
1515 client/freeciv-sdl.desktop:bootstrap/freeciv-sdl.desktop.in
1516 client/freeciv-qt.desktop:bootstrap/freeciv-qt.desktop.in
1517 server/freeciv-server.desktop:bootstrap/freeciv-server.desktop.in
1518 tools/freeciv-mp-gtk2.desktop:bootstrap/freeciv-mp-gtk2.desktop.in
1519 tools/freeciv-mp-gtk3.desktop:bootstrap/freeciv-mp-gtk3.desktop.in
1520 tools/freeciv-mp-qt.desktop:bootstrap/freeciv-mp-qt.desktop.in
1521 client/freeciv-gtk2.appdata.xml:bootstrap/freeciv-gtk2.appdata.xml.in
1522 client/freeciv-gtk3.appdata.xml:bootstrap/freeciv-gtk3.appdata.xml.in
1523 client/freeciv-sdl.appdata.xml:bootstrap/freeciv-sdl.appdata.xml.in
1524 client/freeciv-qt.appdata.xml:bootstrap/freeciv-qt.appdata.xml.in
1525 server/freeciv-server.appdata.xml:bootstrap/freeciv-server.appdata.xml.in
1526 tools/freeciv-mp-gtk2.appdata.xml:bootstrap/freeciv-mp-gtk2.appdata.xml.in
1527 tools/freeciv-mp-gtk3.appdata.xml:bootstrap/freeciv-mp-gtk3.appdata.xml.in
1528 tools/freeciv-mp-qt.appdata.xml:bootstrap/freeciv-mp-qt.appdata.xml.in])
1529 AC_CONFIG_FILES([fcgui:bootstrap/fcgui.in], [chmod +x fcgui])
1530 AC_CONFIG_FILES([fcser:bootstrap/fcser.in], [chmod +x fcser])
1532 if test "$USE_NLS" != "yes" ; then
1534 dnl Produced config.status will have constant value of FORCE_DIST,
1535 dnl but it still checks 'if test x$FORCE_DIST = xyes'. We cannot
1536 dnl do that check in configure when producing config.status.
1537 AC_CONFIG_COMMANDS([translations/freeciv/Makefile], [
1538 for domain in $PODOMAINS ; do
1539 dnl Usually glib-gettext.m4:AM_GLIB_GNU_GETTEXT outputs commands to
1540 dnl generate translations/${domain}/Makefile.
1541 dnl If NLS is disabled, we generate one here.
1542 rm -f translations/${domain}/Makefile
1544 dnl - Add nonls_warn as dependency to dist -target
1545 dnl - Remove dependencies from update-po, so it is never rebuilt
1546 dnl - Set list of distributed files (no generated files)
1547 sed -e 's/^dist distdir:.*/dist distdir: nonls_warn/' \
1548 -e 's/^update-po:.*/update-po:/' \
1549 -e 's/^DISTFILES =.*/DISTFILES = Makefile.in.in POTFILES.in POTFILES.skip \$(POFILES)/' \
1550 translations/${domain}/Makefile.in > translations/${domain}/Makefile
1552 dnl Create nonls_warn target.
1553 echo >> translations/${domain}/Makefile
1554 echo nonls_warn: >> translations/${domain}/Makefile
1555 if test "x$FORCE_DIST" = "xyes" ; then
1556 echo " @echo Building dist without generated localization files!" >> translations/${domain}/Makefile
1558 echo " @echo Cannot build dist with NLS disabled! && /bin/false" >> translations/${domain}/Makefile
1561 ], [FORCE_DIST=$FORCE_DIST
1562 PODOMAINS="$PODOMAINS"])
1568 ****************** Configuration Summary ******************
1570 == General build options ==
1571 Shared libraries: $enable_shared
1572 Debugging support: $enable_debug
1573 Profiling support: $enable_gprof
1574 IPv6 support: $enable_ipv6
1575 Map image toolkits: $enable_mapimg
1577 MagickWand: $mapimg_magickwand
1580 Build freeciv client: $client
1582 Maintained client frontends:
1589 In-development client frontends:
1590 (these are not yet ready for general use)
1594 Build freeciv server: $server
1595 AI modules support: $enable_aimodules
1596 Database support: $enable_fcdb
1598 postgres: $fcdb_postgres
1599 sqlite3: $fcdb_sqlite3