1 dnl configure.ac for freeciv
2 dnl Process this file with autoconf to produce a configure script.
4 dnl Initialize with some random file to ensure the source is here.
5 AC_INIT([freeciv], m4_esyscmd([./fc_version | tr -d '\n']))
7 AC_CONFIG_SRCDIR([common/game.c])
8 AC_CONFIG_AUX_DIR(bootstrap) # This can't be quoted or automake will fail
9 AC_CONFIG_MACRO_DIR([m4])
10 ifdef([AC_CONFIG_MACRO_DIRS],[AC_CONFIG_MACRO_DIRS([dependencies/m4])])
11 AC_CONFIG_HEADERS([fc_config.h])
13 AC_USE_SYSTEM_EXTENSIONS
16 BUG_URL="http://gna.org/projects/freeciv/"
17 WIKI_URL="http://www.freeciv.org/"
18 MAIL_ADDRESS="freeciv-dev AT gna.org"
20 AC_DEFINE(FC_CONFIG_H, 1, [Configuration autogenerated])
21 AC_DEFINE_UNQUOTED([BUG_URL], ["$BUG_URL"], [Bug reporting URL])
22 AC_DEFINE(META_URL, "http://meta.freeciv.org/metaserver.php", [Meta server URL])
23 AC_DEFINE_UNQUOTED([WIKI_URL], ["$WIKI_URL"], [Informational URL])
25 AC_DEFINE(DEFAULT_SOCK_PORT, 5556, [Connection TCP Port])
29 AC_SUBST([MAIL_ADDRESS])
31 dnl client/server should always have the same major and minor versions
32 dnl different patch versions are compatible
33 VERSION_SCRIPT_SILENT=yes
34 m4_include(fc_version)
36 VERSION_WITHOUT_LABEL=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}
37 VERSION=${VERSION_WITHOUT_LABEL}${VERSION_LABEL}
39 AC_DEFINE_UNQUOTED([MAJOR_VERSION], [$MAJOR_VERSION], [Major version])
40 AC_DEFINE_UNQUOTED([MINOR_VERSION], [$MINOR_VERSION], [Minor version])
41 AC_DEFINE_UNQUOTED([PATCH_VERSION], [$PATCH_VERSION], [Patch version])
42 AC_DEFINE_UNQUOTED([VERSION_LABEL], ["${VERSION_LABEL}"], [Version label])
43 AC_DEFINE_UNQUOTED([VERSION_STRING], ["${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${VERSION_LABEL}"], [Version string])
44 AC_DEFINE_UNQUOTED([IS_DEVEL_VERSION], [$IS_DEVEL_VERSION], [Is this a devel version])
45 AC_DEFINE_UNQUOTED([IS_FREEZE_VERSION], [$IS_FREEZE_VERSION], [Is this a frozen version])
46 AC_DEFINE_UNQUOTED([IS_BETA_VERSION], [$IS_BETA_VERSION], [Is this a beta version])
47 AC_DEFINE_UNQUOTED([NEXT_STABLE_VERSION], ["$NEXT_STABLE_VERSION"], [Version number of next release])
48 AC_DEFINE_UNQUOTED([RELEASE_MONTH], [$RELEASE_MONTH], [Month next version will be released])
49 AC_SUBST([MAJOR_VERSION])
50 AC_SUBST([MINOR_VERSION])
52 AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_MANDATORY],
53 ["$NETWORK_CAPSTRING_MANDATORY"],
54 [Network capability string])
55 AC_SUBST([NETWORK_CAPSTRING_MANDATORY])
56 AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_OPTIONAL],
57 ["$NETWORK_CAPSTRING_OPTIONAL"],
58 [Additional optional network capabilities])
59 AC_SUBST([NETWORK_CAPSTRING_OPTIONAL])
61 AC_DEFINE_UNQUOTED([DATASUBDIR],
63 [Version specific subdir for default data path])
64 AC_SUBST([DATASUBDIR])
66 AC_DEFINE_UNQUOTED([FREECIV_DISTRIBUTOR], ["$FREECIV_DISTRIBUTOR"],
67 [Distribution this freeciv is built for])
69 dnl Initialize automake stuff
70 AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
72 dnl Use Automake 1.11 silent rules by default if available
73 dnl verbose build using make V=1
74 ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
80 dnl Sed is needed for the configuration
81 dnl of the clients, database setting and the mapimg toolkits.
84 dnl set default values
90 dnl checks for databases
91 dnl all: Autodetect as many as possible [default].
92 dnl mysql: use mysql database
93 dnl postgres: use postgres database
94 dnl comma-separated-list: Detect these or abort.
96 AS_HELP_STRING([--enable-fcdb[=no/all/mysql/postgres/sqlite3]],
97 [database backends [no](no, or list)]),
98 [databases=${enableval}],
101 for db in $(echo $databases | $SED 's/,/ /g') ; do
102 if test "x$db" = "xall" ; then
104 elif test "x$db" = "xno" ; then
106 elif test "x$db" = "xmysql" ; then
108 elif test "x$db" = "xpostgres" ; then
110 elif test "x$db" = "xsqlite3" ; then
113 AC_MSG_ERROR([bad value ${db} for --enable-fcdb])
117 dnl checks for database mysql
118 dnl sets FCDB_MYSQL(conditional), FCDB_MYSQL_CFLAGS
121 dnl checks for database postgres
122 dnl sets FCDB_POSTGRES(conditional), FCDB_POSTGRES_CFLAGS
125 dnl checks for database sqlite3
126 dnl sets FCDB_SQLITE3(conditional), FCDB_SQLITE3_CFLAGS
129 dnl check if a database backend is available
130 if test "x$fcdb_mysql" = "xyes" || test "x$fcdb_postgres" = "xyes" \
131 || test "x$fcdb_sqlite3" = "xyes"; then
133 AC_DEFINE([HAVE_FCDB], [1], [Database backend available])
137 AM_CONDITIONAL([FCDB_DB], [test "x$enable_fcdb" = "xyes"])
139 dnl no=do not compile server, yes=compile server, *=error
140 AC_ARG_ENABLE([server],
141 AS_HELP_STRING([--disable-server], [do not compile the server]),
142 [case "${enableval}" in
145 *) AC_MSG_ERROR(bad value ${enableval} for --disable-server) ;;
147 AM_CONDITIONAL(SERVER, test x$server = xyes)
149 dnl yes - Support for IPv6 required
150 dnl no - Legacy IPv4 support
151 dnl test - Try to enable IPv6 support
152 AC_ARG_ENABLE([ipv6],
153 AS_HELP_STRING([--enable-ipv6=yes/no/test], [use IPv6 [test]]),
154 [case "${enableval}" in
155 yes|no|test) ipv6=${enableval} ;;
156 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
158 if test x$ipv6 != xno ; then
160 dnl We check some functions (getaddrinfo) twice. Once unconditionally
161 dnl to get HAVE_xxx always correctly set. We need separate check here to
162 dnl correcly disable IPv6 when function is not available.
163 AC_CHECK_FUNCS([getaddrinfo inet_pton inet_ntop getnameinfo],
164 [], [enable_ipv6=no])
165 if test x$enable_ipv6 = xyes ; then
166 AC_MSG_CHECKING([for AF_INET6])
167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
168 #include <sys/types.h>
169 #include <sys/socket.h>
170 ]], [[return AF_INET6;]])], [AC_MSG_RESULT([yes])],
174 if test x$enable_ipv6 = xno && test x$ipv6 = xyes ; then
175 AC_MSG_ERROR([Cannot enable IPv6 functionality])
177 if test x$enable_ipv6 = xyes ; then
178 AC_DEFINE([IPV6_SUPPORT], [1], [IPv6 Support built in])
184 AC_ARG_WITH([readline],
185 AS_HELP_STRING([--with-readline], [support fancy command line editing]),
186 WITH_READLINE=$withval, dnl yes/no - required to use / never use
187 WITH_READLINE="maybe" dnl maybe - use if found [default]
190 FOLLOWTAG=${DEFAULT_FOLLOW_TAG}
191 AC_ARG_WITH([followtag],
192 AS_HELP_STRING([--with-followtag], [version tag to follow]),
193 [FOLLOWTAG=${withval}])
194 AC_DEFINE_UNQUOTED([FOLLOWTAG], ["${FOLLOWTAG}"], [Version tag to follow])
196 AC_ARG_WITH([desktopdir],
197 AS_HELP_STRING([--with-desktopdir], [install desktop files to given dir]),
198 [ DESKTOPDIR=${withval} ], [ DESKTOPDIR="\$(prefix)/share/applications" ])
199 AC_SUBST([DESKTOPDIR])
201 AC_ARG_WITH([appdatadir],
202 AS_HELP_STRING([--with-appdatadir], [install appdata files to given dir]),
203 [ APPDATADIR=${withval} ], [ APPDATADIR="\$(prefix)/share/appdata" ])
204 AC_SUBST([APPDATADIR])
206 dnl set default values
211 dnl all: Autodetect as many as possible [default].
212 dnl no: No additional toolkits.
213 dnl magickwand: compile magickwand (imagemagick) support.
214 dnl comma-separated-list: Detect these or abort.
215 AC_ARG_ENABLE([mapimg],
216 AS_HELP_STRING([--enable-mapimg=no/auto/magickwand],
217 [additional map image toolkits to compile [auto](no, or list)]),
218 [toolkits=${enableval}],
219 [enable_mapimg=auto])
221 for toolkit in $(echo $toolkits | $SED 's/,/ /g') ; do
222 if test "x$toolkit" = "xauto" ; then
224 elif test "x$toolkit" = "xno" ; then
227 enable_mapimg=selected
230 if test "x$toolkit" = "xmagickwand" ; then
231 mapimg_magickwand=yes
235 dnl checks for MagickWand mapimg support
236 dnl sets MAPIMG_WAND_CFLAGS, MAPIMG_WAND_LIBS
239 AC_ARG_ENABLE([fcweb],
240 AS_HELP_STRING([--enable-fcweb], [build fcweb version of server [false]]),
241 [case "${enableval}" in
246 *) AC_MSG_ERROR([bad value ${enableval} for --enable-fcweb]) ;;
247 esac], [fcweb=false])
251 dnl no: Do not compile client.
252 dnl auto: Autodetect one.
253 dnl all: Autodetect as many as possible.
254 dnl comma-separated-list: Detect these or abort.
255 AC_ARG_ENABLE([client],
256 AS_HELP_STRING([--enable-client=auto/all/gtk2/gtk3/sdl/xaw/qt/stub],
257 [clients to compile [auto](list for multiple)]),
258 [clients=${enableval}],
261 if test "x$fcweb" = "xtrue" ; then
262 if test "x$clients" != "x" && test "x$clients" != "xauto" &&
263 test "x$clients" != "xno" ; then
264 AC_MSG_ERROR([One cannot enable any clients for freeciv-web build])
276 for gui in $(echo $clients | $SED 's/,/ /g') ; do
277 if test "x$gui" = "xno" ; then
279 elif test "x$gui" = "xauto" ; then
281 elif test "x$gui" = "xall" ; then
284 if test "x$gui" = "xgtk2" ||
285 test "x$gui" = "xgtk2.0" ||
286 test "x$gui" = "xgtk20" ||
287 test "x$gui" = "xgtk-2.0" ; then
289 elif test "x$gui" = "xgtk3" ||
290 test "x$gui" = "xgtk3.0" ||
291 test "x$gui" = "xgtk30" ||
292 test "x$gui" = "xgtk-3.0" ; then
294 elif test "x$gui" = "xgtk" ; then
295 AC_MSG_WARN([for requested client 'gtk' enabled gtk2-client, but that default changes in the future])
298 if test ! -d "${srcdir}/client/gui-$gui" ; then
299 AC_MSG_ERROR(bad value ${gui} for --enable-client)
308 AS_HELP_STRING([--with-xaw], [use the Xaw widget set for the xaw client]),
313 AS_HELP_STRING([--with-xaw3d], [use the Xaw3d widget set for the xaw client]),
317 if test "x$WITH_XAW" != "x" && test "x$WITH_XAW3D" != "x" ; then
318 AC_MSG_ERROR(Cannot use both --with-xaw and --with-xaw3d at the same time)
321 AC_ARG_ENABLE([svnrev],
322 AS_HELP_STRING([--enable-svnrev], [get svn revision to version information]),
323 [case "${enableval}" in
326 *) AC_MSG_ERROR([bad value ${enableval} for --enable-svnrev]) ;;
327 esac], [svnrev=false])
328 AM_CONDITIONAL([SVNREV], [test x$svnrev = xtrue])
329 if test x$svnrev = xtrue ; then
330 AC_DEFINE([SVNREV], [1], [Get svn revision information to version number])
333 AC_ARG_ENABLE([gitrev],
334 AS_HELP_STRING([--enable-gitrev], [get git revision to version information]),
335 [case "${enableval}" in
338 *) AC_MSG_ERROR([bad value ${enableval} for --enable-gitrev]) ;;
339 esac], [gitrev=false])
340 AM_CONDITIONAL([GITREV], [test x$gitrev = xtrue])
341 if test x$gitrev = xtrue ; then
342 AC_DEFINE([GITREV], [1], [Get git revision information to version number])
345 AC_ARG_ENABLE([make_data],
346 AS_HELP_STRING([--disable-make-data], [do not recurse make into data directories]),
347 [case "${enableval}" in
348 yes) make_data=true ;;
349 no) make_data=false ;;
350 *) AC_MSG_ERROR(bad value ${enableval} for --disable-make-data) ;;
351 esac], [make_data=true])
352 AM_CONDITIONAL(MAKE_DATA, test x$make_data = xtrue)
354 AC_ARG_ENABLE([make_include],
355 AS_HELP_STRING([--enable-make-include], [force make to recurse into include directory]),
356 [case "${enableval}" in
357 yes) make_include=true ;;
358 no) make_include=false ;;
359 *) AC_MSG_ERROR(bad value ${enableval} for --enable-make-include) ;;
360 esac], [make_include=false])
361 AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test "$make_include" = "true")
363 AC_ARG_WITH([efence],
364 AS_HELP_STRING([--with-efence], [use Electric Fence, malloc debugger]),
368 AC_ARG_ENABLE([aimodules],
369 AS_HELP_STRING([--enable-aimodules=yes/no/experimental], [support for ai modules [no]]),
370 [case "${enableval}" in
371 yes) enable_aimodules=yes ;;
372 no) enable_aimodules=no ;;
373 experimental) enable_aimodules=yes
375 *) AC_MSG_ERROR([bad value ${enable_aimodules} for --enable-aimodules]) ;;
376 esac], [enable_aimodules=no])
377 aimoduledir="${libdir}/fcai"
378 AC_SUBST(aimoduledir)
379 AM_CONDITIONAL(AI_MODULES, test "x$enable_aimodules" = "xyes")
380 if test $enable_aimodules = yes ; then
381 if test x$enable_shared != xyes ; then
382 AC_MSG_ERROR([cannot enable ai module support if also build of shared libraries is not enabled with --enable-shared])
386 AC_MSG_CHECKING([whether can build modules])
387 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ltdl.h>]],
388 [[lt_dlopenext(NULL);]])],
389 [AC_MSG_RESULT([yes])],
391 AC_MSG_ERROR([cannot build loadable AI modules as requested])])
393 SERVER_LIBS="${SERVER_LIBS} -lltdl"
394 AC_DEFINE([AI_MODULES], [1], [Enable ai modules])
395 CPPFLAGS="${CPPFLAGS} -DAI_MODULEDIR=\"\\\"${aimoduledir}\\\"\""
396 ai_mod_default_needed=yes
398 AM_CONDITIONAL(EXP_AI_MODULES, test "x$exp_aimodules" = "xyes")
400 AC_ARG_ENABLE([ai-static],
401 AS_HELP_STRING([--enable-ai-static], [statically link listed modules to server]),
402 [static_modules="${enableval}"],
403 [static_modules="classic"])
405 ai_mod_static_classic=no
406 ai_mod_static_threaded=no
408 for module in $(echo $static_modules | $SED 's/,/ /g') ; do
409 if test "x$module" = "xclassic" ; then
410 ai_mod_static_classic=yes
411 ai_mod_default_needed=yes
412 AC_DEFINE([AI_MOD_STATIC_CLASSIC], [1],
413 [classic ai module statically linked])
414 elif test "x$module" = "xthreaded" ; then
415 ai_mod_static_threaded=yes
416 ai_mod_default_needed=yes
417 AC_DEFINE([AI_MOD_STATIC_THREADED], [1],
418 [threaded ai module statically linked])
420 AC_MSG_ERROR([bad value ${module} for --enable-ai-static])
422 if test "x$default_ai_set" = "x" ; then
423 dnl Make first static module default ai type
424 default_ai_set="${module}"
427 AM_CONDITIONAL([AI_MOD_STATIC_CLASSIC],
428 [test "x$ai_mod_static_classic" = "xyes" || test "x$enable_aimodules" != "xyes"])
429 AM_CONDITIONAL([AI_MOD_STATIC_THREADED],
430 [test "x$ai_mod_static_threaded" = "xyes"])
432 AC_ARG_WITH([default-ai],
433 AS_HELP_STRING([--with-default-ai], [default ai type [first static]]),
434 [default_ai_set="${withval}"],
437 AM_CONDITIONAL([AI_MOD_DEFAULT_NEEDED],
438 [test "x${ai_mod_default_needed}" = "xyes" || test "x${default_ai_set}" = "x"])
440 if test "x${default_ai_set}" = "x" ; then
441 default_ai_set="classic"
445 if test "x$ai_mod_static_classic" = "xyes" ; then
446 fc_ai_last=$fc_ai_last+1
448 if test "x$ai_mod_static_threaded" = "xyes" ; then
449 fc_ai_last=$fc_ai_last+1
451 if test "x$enable_aimodules" = "xyes" ; then
452 dnl Dynamic modules allowed, give slots for them
453 fc_ai_last=$fc_ai_last+3
455 AC_DEFINE_UNQUOTED([FC_AI_LAST], [(${fc_ai_last})], [Max number of AI modules])
457 AC_DEFINE_UNQUOTED([AI_MOD_DEFAULT], ["${default_ai_set}"], [Default ai type name])
459 dnl Checks for programs.
465 dnl Replace AC_PROG_LIBTOOL with LT_INIT when minimum libtool
468 LIBTOOL="$LIBTOOL --preserve-dup-deps"
470 AC_CHECK_TOOL(AR, ar)
472 AC_MSG_ERROR([*** 'ar' missing. Install binutils, fix your \$PATH, or set \$AR manually. ***])
479 AC_CHECK_PROG(UNAME,uname,uname,:)
481 AC_CHECK_SIZEOF([int])
483 dnl Programs already checked by AM_INIT_AUTOMAKE:
485 dnl AC_PROG_MAKE_SET required with automake-ng
488 dnl Check for libiconv (which is usually included in glibc, but may be
489 dnl distributed separately). The libcharset check must come after the
490 dnl iconv check. This whole thing must come before the gettext check below.
494 if test "$am_cv_func_iconv" != yes; then
495 AC_MSG_ERROR([Iconv is missing. You can get libiconv from http://gnu.org/, \
496 or try using --with-libiconv-prefix.])
498 LIBS="$LIBS $LIBICONV"
501 ALL_LINGUAS="ar bg cs ca da de el en_GB eo es et fa fi fr ga gd he hu id it ja
502 ko lt nl nb pl pt pt_BR ro ru sr sv tr uk zh_CN zh_TW"
503 PODOMAINS="freeciv nations"
506 AS_HELP_STRING([--disable-nls], [do not add localization support]),
507 [case "${enableval}" in
511 dnl NLS disabled, but 'make dist' allowed. That dist will lack
512 dnl all generated localization files.
513 no-gmo-dist) USE_NLS=no
515 *) AC_MSG_ERROR([bad value ${enableval} for --enable-nls]) ;;
516 esac], [USE_NLS=yes])
518 if test "$USE_NLS" = "yes" ; then
521 dnl AM_GLIB_GNU_GETTEXT doesn't have all features we want
522 dnl or they don't behave correctly.
523 dnl Old gettext binaries don't understand plurals. (ngettext, msgid_plural)
524 dnl and there are some problems with missing ngettext.
525 dnl Is that ngettext part still true? AM_GLIB_GNU_GETTEXT does check for it
527 have_working_ngettext=0
528 AC_CHECK_LIB(c, ngettext,
529 [AC_MSG_CHECKING(whether libc's ngettext works at runtime)
530 FC_CHECK_NGETTEXT_RUNTIME(,have_working_ngettext=1,)],)
532 if test "$have_working_ngettext" = "0"; then
533 AC_CHECK_LIB([intl], [ngettext],
534 [AC_MSG_CHECKING([whether libintl's ngettext works at runtime])
535 FC_CHECK_NGETTEXT_RUNTIME(["-lintl"],[have_working_ngettext=1
536 UTILITY_LIBS="${UTILITY_LIBS} -lintl"],)],)
539 if test "$have_working_ngettext" = "0"; then
540 AC_MSG_ERROR(I haven't found a working ngettext function in your system.
541 Try --disable-nls. Read ABOUT-NLS.)
544 if test "$IS_BETA_VERSION" = "1" || test "$IS_DEVEL_VERSION" = "1"; then
545 AC_MSG_CHECKING(for GNU xgettext version >= 0.10.36)
546 xgettext_version=`$XGETTEXT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'`
547 AC_RUN_IFELSE([AC_LANG_SOURCE([[
550 const char *version = "$xgettext_version";
553 const char *p = version;
554 int major = 0, minor = 0, patch = 0;
556 while (*p != '\0' && (*p < '0' || *p > '9')) {
562 sscanf(p, "%d.%d.%d", &major, &minor, &patch);
563 if (major < 1 && (minor < 10 || (minor == 10 && patch < 36))) {
568 ]])],[AC_MSG_RESULT(yes)
571 AC_MSG_WARN(You may have problems with creating pox files. \
572 Please update your gettext package.)
577 AC_MSG_CHECKING(for GNU msgfmt version >= 0.10.35)
578 msgfmt_version=`$MSGFMT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'`
579 AC_RUN_IFELSE([AC_LANG_SOURCE([[
582 const char *version = "$msgfmt_version";
586 const char *p = version;
587 int major = 0, minor = 0, patch = 0;
589 while (*p != '\0' && (*p < '0' || *p > '9')) {
595 sscanf(p, "%d.%d.%d", &major, &minor, &patch);
596 if (major < 1 && (minor < 10 || (minor == 10 && patch < 35))) {
601 ]])],[AC_MSG_RESULT(yes)
604 AC_MSG_ERROR(You are unable to create *.gmo files.
605 This is development version which doesn't include them. Please update your
606 gettext package. We recommend you versions >= 0.10.38. Or use
607 --disable-nls instead.)
613 dnl Setup POFILES even when NLS disabled.
614 dnl AM_GLIB_GNU_GETTEXT does this when NLS enabled.
615 for lang in $ALL_LINGUAS; do
616 POFILES="$POFILES $lang.po"
622 PKG_CHECK_MODULES([CURL], [libcurl >= 7.9.7],,
623 [AC_MSG_ERROR([libcurl development files required])])
624 UTILITY_CFLAGS="${UTILITY_CFLAGS} ${CURL_CFLAGS}"
625 UTILITY_LIBS="${UTILITY_LIBS} ${CURL_LIBS}"
627 dnl Set debug flags supported by compiler
628 EXTRA_DEBUG_CFLAGS=""
629 EXTRA_DEBUG_CXXFLAGS=""
630 EXTRA_DEBUG_LDFLAGS=""
636 AC_C99_VARIADIC_MACROS
637 AC_C99_VARIABLE_ARRAYS
641 dnl BeOS-specific settings
642 if test x`$UNAME -s` = xBeOS ; then
643 AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [BeOS-specific setting])
644 CFLAGS="$CFLAGS -Wno-multichar"
645 LDFLAGS="$LDFLAGS -x none"
646 if test x$enable_debug = xyes ; then
647 CFLAGS="$CFLAGS -gdwarf-2"
648 LDFLAGS="$LDFLAGS -gdwarf-2"
650 # We used to set ARFLAGS here, but under recent versions of automake this
651 # broke compilation on other systems. Setting ARFLAGS shouldn't be
652 # necessary with a working automake.
658 HOST_PATH_SEPARATOR=":"
660 dnl Settings specific to host OS
664 dnl Windows-specific settings
666 AC_CHECK_TOOL([WINDRES], [windres])
667 if test -z $WINDRES; then
668 AC_MSG_ERROR([*** 'windres' missing. Install binutils, fix your \$PATH, or set \$WINDRES manually. ***])
671 HOST_PATH_SEPARATOR=";"
673 AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [Mingw32-specific setting - stdin])
674 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw32])
675 AC_DEFINE([WIN32_NATIVE], [1], [Mingw32-specific setting - native])
676 AC_DEFINE([HAVE_WINSOCK], [1], [Mingw32-specific setting - winsock])
677 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])
678 LIBS="$LIBS -lwsock32"
682 dnl SkyOS specific settings
683 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - SkyOS])
687 dnl Haiku specific settings
688 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Haiku])
689 LIBS="$LIBS -lnetwork"
694 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Amiga])
699 dnl Autoconf provides path separator for build system.
700 dnl Use that instead of our own guess in case of native build.
701 if test x$build = x$host ; then
702 HOST_PATH_SEPARATOR=$PATH_SEPARATOR
705 dnl note this has to match the path installed by translations/freeciv/Makefile
706 if test x"$MINGW32" != "xyes"; then
707 CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\"\\\"$localedir\\\"\""
709 AC_DEFINE_UNQUOTED([LOCALEDIR], ["./share/locale"], [Locale directory (windows)])
712 CPPFLAGS="$CPPFLAGS -DBINDIR=\"\\\"$bindir\\\"\""
717 AC_CHECK_LIB(z, gzgets,
718 [AC_DEFINE([HAVE_LIBZ], [1], [zlib is available])
719 UTILITY_LIBS="${UTILITY_LIBS} -lz"
720 COMMON_LIBS="$COMMON_LIBS -lz"],
721 AC_MSG_ERROR([Could not find zlib library.]))
723 AC_CHECK_HEADER(zlib.h, ,
724 AC_MSG_ERROR([zlib found but not zlib.h.
725 You may need to install a zlib devel package.]))
727 AC_PATH_PROG(GZIP, gzip, "no")
728 if test "$GZIP" = "no"; then
729 AC_MSG_ERROR([You need the gzip program for compilation.])
732 dnl Check for bzip2 compression
733 AC_CHECK_LIB(bz2, BZ2_bzReadOpen,
734 [AC_CHECK_HEADERS([bzlib.h],
735 [AC_DEFINE([HAVE_LIBBZ2], [1], [libbzip2 is available])
736 UTILITY_LIBS="${UTILITY_LIBS} -lbz2"
737 libbz2_available=true])])
738 if test "x$libbz2_available" != "xtrue" ; then
742 dnl Check for xz compression
743 AC_CHECK_LIB(lzma, lzma_code,
744 [AC_CHECK_HEADERS([lzma.h],
745 [AC_DEFINE([HAVE_LIBLZMA], [1], [liblzma is available])
746 UTILITY_LIBS="${UTILITY_LIBS} -llzma"
747 libxz_available=true])])
748 if test "x$libxz_available" != "xtrue" ; then
752 AC_SUBST([UTILITY_CFLAGS])
753 AC_SUBST([UTILITY_LIBS])
754 AC_SUBST([COMMON_LIBS])
756 AC_ARG_ENABLE([crosser],
757 AS_HELP_STRING([--enable-crosser], [build version to be used with crosser environment]),
758 [case "${enableval}" in
761 *) AC_MSG_ERROR([bad value ${enableval} for --enable-crosser]) ;;
763 if test x$crosser = xyes && test x$MINGW32 != xyes ; then
764 AC_MSG_ERROR([--enable-crosser is Windows build specific option])
767 dnl Check thread implementation
768 AC_MSG_CHECKING([for threads implementation])
771 CFLAGS_SAVE="${CFLAGS}"
774 if test x$crosser != xyes ; then
775 FC_C_FLAGS([-pthread], [], [CFLAGS])
776 FC_LD_FLAGS([-pthread], [], [LIBS])
777 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
778 [[return pthread_create(NULL, NULL, NULL, NULL);]])],
779 [AC_DEFINE([HAVE_PTHREAD], [1], [Use pthreads as thread implementation])
781 AC_MSG_RESULT([pthreads])
782 AC_DEFINE([HAVE_THREAD_COND], [1], [Has thread condition variable implementation])])
786 if test "x$thread_impl" = "xnone" ; then
787 CFLAGS="$CFLAGS_SAVE"
788 LDFLAGS="$LDFLAGS_SAVE"
790 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
791 [[CreateThread(NULL, 0, NULL, NULL, 0, NULL);]])],
792 [AC_DEFINE([HAVE_WINTHREADS], [1], [Use Windows threads as thread implementation])
794 AC_MSG_RESULT([windows])])
797 if test "x$thread_impl" = "xnone" ; then
798 AC_MSG_ERROR([No usable thread implementation available])
801 if test "x$thread_cond" != "xtrue" ; then
802 feature_thr_cond=missing
805 dnl Check and choose clients
806 if test "x$client" != "xno"; then
808 dnl Check for sound support, sets SOUND_CFLAGS, SOUND_LIBS, AUDIO_SDL
809 dnl Client gui checks need to know which mixer version this has selected
812 dnl if specified --with-xaw or --with-xaw3d, assume --enable-client=xaw
813 if test -n "$WITH_XAW" || test -n "$WITH_XAW3D"; then
814 if test "x$client" = "xauto" ; then
817 elif test "x$client" = "xall" ; then
822 dnl if need to guess client, announce checking
823 if test "x$client" = "xauto"; then
824 AS_MESSAGE([checking for which client to compile:...])
825 elif test "x$client" = "xall" ; then
826 AS_MESSAGE([checking for which clients to compile:...])
829 dnl Gtk-2.0-specific overrides
832 dnl Gtk-3.0-specific overrides
835 dnl SDL-specific overrides
838 dnl Xaw-specific overrides
841 dnl QT-specific overrides
844 dnl Stub-specific overrides
845 if test "x$gui_stub" = "xyes" || test "x$client" = "xall" ; then
848 if test "x$found_client" = "xyes"; then
850 if test "x$client" = "xauto" ; then
854 elif test "x$gui_stub" = "xyes"; then
855 AC_MSG_ERROR(specified client 'stub' not configurable)
859 dnl If client still "auto", error out since we couldn't select any of them
860 if test "x$client" = "xauto" ; then
861 AC_MSG_ERROR([can not build any of the clients])
865 if test "x$client" = "xall" ; then
866 if test "x$gui_gtk2" = "xyes" ||
867 test "x$gui_gtk3" = "xyes" ||
868 test "x$gui_sdl" = "xyes" ||
869 test "x$gui_xaw" = "xyes" ||
870 test "x$gui_qt" = "xyes" ||
871 test "x$gui_stub" = "xyes" ; then
879 if test "x$gui_gtk2" = "xyes" || test "x$gui_gtk3" = "xyes" ; then
881 if test "x$gui_gtk2" = "xyes" ; then
882 gui_gtk2_LIBS="$gui_gtk2_libs $LIB_GGZ_GTK"
884 if test "x$gui_gtk3" = "xyes" ; then
885 gui_gtk3_libs="$gui_gtk3_libs $LIB_GGZ_GTK"
890 if test "$ggz_server" = "yes" ; then
891 AC_CHECK_FUNCS([chdir mkdtemp])
894 FC_LD_FLAGS(["-Wl,-rpath=${lib_prefix}"], [], [LDFLAGS])
896 AM_CONDITIONAL([CLIENT], [test "x$client" = "xyes"])
898 AC_ARG_WITH([freeciv-manual],
899 AS_HELP_STRING([--without-freeciv-manual], [do not build freeciv-manual]),
900 [fcmanual=${withval}], [fcmanual=yes])
902 AM_CONDITIONAL([FCMANUAL], [test "x$fcmanual" = "xyes"])
904 dnl freeciv-modpack checks
905 AC_ARG_ENABLE([fcmp],
906 AS_HELP_STRING([--enable-fcmp=no/yes/gtk2/gtk3/qt/cli/all/auto], [build freeciv-modpack-program [auto]]),
907 [fc_mp=${enableval}],
916 if test "x$fc_mp" = "xcli" ; then
917 dnl Only cli requested -> no gui needed
921 for mp in $(echo $fc_mp | $SED 's/,/ /g') ; do
922 if test "x$mp" = "xno" ; then
924 elif test "x$mp" = "xauto" || test "x$mp" = "xyes" ; then
926 elif test "x$mp" = "xall" ; then
928 else if test "x$mp" = "xgtk2" ||
929 test "x$mp" = "xgtk2.0" ||
930 test "x$mp" = "xgtk20" ||
931 test "x$mp" = "xgtk-2.0" ; then
933 elif test "x$mp" = "xgtk3" ||
934 test "x$mp" = "xgtk3.0" ||
935 test "x$mp" = "xgtk30" ||
936 test "x$mp" = "xgtk-3.0" ; then
938 elif test "x$mp" = "xqt" ; then
940 elif test "x$mp" = "xcli" ; then
942 elif test "x$mp" != "xyes" ; then
943 AC_MSG_ERROR([bad value ${mp} for --enable-fcmp])
948 if test "x$req_fcmp_gtk2" = "xyes" ||
949 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
950 AM_PATH_GTK_2_0([2.12.0],
952 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
955 fcmp_list="$fcmp_list gtk2"
956 mp_gtk2_cflags="$GTK2_CFLAGS $GTHREAD_CFLAGS"
957 mp_gtk2_libs="$GTK2_LIBS $GTHREAD_LIBS"
958 if test "x$MINGW32" = "xyes"; then
959 dnl Required to compile gtk2 on Windows platform
960 mp_gtk2_cflags="$mp_gtk2_cflags -mms-bitfields"
961 mp_gtk2_ldflags="$mp_gtk2_ldflags -mwindows"
964 if test "x$modinst" = "xauto" ; then
970 if test "x$req_fcmp_gtk2" = "xyes" && test "x$fcmp_gtk2" != "xyes" ; then
971 AC_MSG_ERROR([Cannot build gtk2-version of freeciv-modpack as requested])
974 if test "x$req_fcmp_gtk3" = "xyes" ||
975 test "x$modinst" = "xall" || test "x$modinst" = "xauto" ; then
976 AM_PATH_GTK_3_0([3.0.0],
978 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
981 fcmp_list="$fcmp_list gtk3"
982 mp_gtk3_cflags="$GTK3_CFLAGS $GHTREAD_CFLAGS"
983 mp_gtk3_libs="$GTK3_LIBS $GTHREAD_LIBS"
984 if test "x$MINGW32" = "xyes"; then
985 dnl Required to compile gtk3 on Windows platform
986 mp_gtk3_cflags="$mp_gtk3_cflags -mms-bitfields"
987 mp_gtk3_ldflags="$mp_gtk3_ldflags -mwindows"
990 if test "x$modinst" = "xauto" ; then
996 if test "x$req_fcmp_gtk3" = "xyes" && test "x$fcmp_gtk3" != "xyes" ; then
997 AC_MSG_ERROR([Cannot build gtk3-version of freeciv-modpack as requested])
1000 if test "x$req_fcmp_qt" = "xyes" ||
1001 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
1003 if test "x$cxx_works" = "xyes" ; then
1006 if test "x$fc_qt5_usable" = "xtrue" ; then
1008 fcmp_list="$fcmp_list qt"
1010 mp_qt_cppflags=$FC_QT5_CPPFLAGS
1011 mp_qt_cxxflags=$FC_QT5_CXXFLAGS
1012 mp_qt_libs=$FC_QT5_LIBS
1014 if test "x$modinst" = "xauto" ; then
1022 if test "x$req_fcmp_qt" = "xyes" && test "x$fcmp_qt" != "xyes" ; then
1023 AC_MSG_ERROR([Cannot build Qt-version of freeciv-modpack as requested])
1026 dnl Cli does not satisfy --enable-fcmp=auto as it's not an gui.
1027 if test "x$req_fcmp_cli" = "xyes" || test "x$modinst" = "xall" ; then
1029 fcmp_list="$fcmp_list cli"
1032 if test "x$modinst" != "xfound" &&
1033 test "x$modinst" != "xno" &&
1034 test "x$modinst" != "xcli" &&
1035 test "x$fcmp_gtk3" != "xyes" &&
1036 test "x$fcmp_gtk2" != "xyes" &&
1037 test "x$fcmp_qt" != "xyes" ;then
1038 AC_MSG_ERROR([Cannot build modpack installer with any gui])
1041 if test "x$modinst" != "xno" && test "x$MINGW32" != "xyes" ; then
1042 dnl Hack to get a run-time icon -- not needed on Windows
1043 mp_gtk2_cflags="$mp_gtk2_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1044 mp_gtk3_cflags="$mp_gtk3_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1047 if test "x$fcmp_list" = "x" ; then
1051 AM_CONDITIONAL([MODINST], [test "x$modinst" != "xno"])
1052 AM_CONDITIONAL([MODINST_GTK3], [test "x$fcmp_gtk3" = "xyes"])
1053 AM_CONDITIONAL([MODINST_GTK2], [test "x$fcmp_gtk2" = "xyes"])
1054 AM_CONDITIONAL([MODINST_QT], [test "x$fcmp_qt" = "xyes"])
1055 AM_CONDITIONAL([MODINST_CLI], [test "x$fcmp_cli" = "xyes"])
1057 AC_SUBST([gui_gtk2_cflags])
1058 AC_SUBST([gui_gtk2_libs])
1059 AC_SUBST([gui_gtk2_ldflags])
1060 AC_SUBST([gui_gtk3_cflags])
1061 AC_SUBST([gui_gtk3_libs])
1062 AC_SUBST([gui_gtk3_ldflags])
1063 AC_SUBST([gui_sdl_cflags])
1064 AC_SUBST([gui_sdl_libs])
1065 AC_SUBST([gui_sdl_ldflags])
1066 AC_SUBST([gui_xaw_cflags])
1067 AC_SUBST([gui_xaw_libs])
1068 AC_SUBST([gui_xaw_ldflags])
1069 AC_SUBST([gui_qt_cppflags])
1070 AC_SUBST([gui_qt_cflags])
1071 AC_SUBST([gui_qt_cxxflags])
1072 AC_SUBST([gui_qt_libs])
1073 AC_SUBST([gui_qt_ldflags])
1074 AC_SUBST([gui_stub_cflags])
1075 AC_SUBST([gui_stub_libs])
1076 AC_SUBST([gui_stub_ldflags])
1077 AC_SUBST([mp_cli_cflags])
1078 AC_SUBST([mp_cli_libs])
1079 AC_SUBST([mp_cli_ldflags])
1080 AC_SUBST([mp_gtk2_cflags])
1081 AC_SUBST([mp_gtk2_libs])
1082 AC_SUBST([mp_gtk2_ldflags])
1083 AC_SUBST([mp_gtk3_cflags])
1084 AC_SUBST([mp_gtk3_libs])
1085 AC_SUBST([mp_gtk3_ldflags])
1086 AC_SUBST([mp_qt_cppflags])
1087 AC_SUBST([mp_qt_cxxflags])
1088 AC_SUBST([mp_qt_libs])
1089 AC_SUBST([SOUND_CFLAGS])
1090 AC_SUBST([SOUND_LIBS])
1091 AC_SUBST([VERSION_WITHOUT_LABEL])
1092 AC_SUBST([VERSION_LABEL])
1093 AC_SUBST([HOST_PATH_SEPARATOR])
1094 AM_CONDITIONAL(AUDIO_SDL, test "x$SDL_mixer" != "xno")
1095 AM_CONDITIONAL(CLIENT_GUI_SDL, test "x$gui_sdl" = "xyes")
1096 AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "x$gui_gtk2" = "xyes")
1097 AM_CONDITIONAL(CLIENT_GUI_GTK_3_0, test "x$gui_gtk3" = "xyes")
1098 AM_CONDITIONAL(CLIENT_GUI_XAW, test "x$gui_xaw" = "xyes")
1099 AM_CONDITIONAL(CLIENT_GUI_QT, test "x$gui_qt" = "xyes")
1100 AM_CONDITIONAL(CLIENT_GUI_STUB, test "x$gui_stub" = "xyes")
1101 AM_CONDITIONAL(MINGW32, test x"$MINGW32" = "xyes")
1103 dnl Additional client libraries:
1104 if test "x$client" = "xyes"; then
1106 AC_SUBST(CLIENT_LIBS)
1109 dnl Checks for additional server libraries:
1110 if test "x$server" = "xyes"; then
1111 SERVER_LIBS="-lm ${SERVER_LIBS}"
1113 dnl Some systems (e.g., BeOS) need this lib
1114 AC_CHECK_LIB(bind, gethostbyaddr, SERVER_LIBS="-lbind $SERVER_LIBS")
1116 dnl Readline library and header files.
1118 AC_SUBST([SERVER_LIBS])
1119 AC_SUBST([SRV_LIB_LIBS])
1122 AC_CHECK_LIB(nls,main)
1124 dnl Checks for header files.
1127 AC_CHECK_HEADERS([fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \
1128 sys/file.h libintl.h signal.h strings.h execinfo.h \
1131 dnl Avoid including the unix emulation layer if we build mingw executables
1132 dnl There would be type conflicts between winsock and bsd/unix includes
1133 if test "x$MINGW32" != "xyes"; then
1134 AC_CHECK_HEADERS(arpa/inet.h netdb.h netinet/in.h pwd.h sys/ioctl.h \
1135 sys/select.h sys/signal.h sys/socket.h sys/termio.h \
1136 sys/uio.h termios.h)
1138 if test "x$gui_xaw" = "xyes" ; then
1139 dnl Want to get appropriate -I flags:
1140 fc_save_CPPFLAGS="$CPPFLAGS"
1141 CPPFLAGS="$CPPFLAGS $gui_xaw_cflags"
1142 AC_CHECK_HEADER(X11/xpm.h, ,
1143 AC_MSG_ERROR(need X11/xpm.h header; perhaps try/adjust --with-xpm-include))
1144 CPPFLAGS="$fc_save_CPPFLAGS"
1147 dnl Checks for typedefs, structures, and compiler characteristics.
1151 AC_CHECK_TYPES(socklen_t, [], [],
1152 [#include <sys/types.h>
1153 #include <sys/socket.h>
1156 dnl Headers that might contain the intptr_t definition found earlier
1157 AC_CHECK_HEADERS([inttypes.h stdint.h])
1159 dnl Checks for library functions.
1164 dnl Windows vsnprintf doesn't support argument reordering (see PR#12932)
1165 if test "x$MINGW32" != "xyes"; then
1167 AC_CHECK_FUNCS([vsnprintf])
1170 AC_CHECK_FUNCS([bind connect fileno flock ftime gethostbyname gethostname \
1171 getpwuid inet_aton select snooze strcasecmp strcasestr \
1172 strerror strlcat strlcpy strncasecmp strstr uname usleep \
1173 getline _strcoll stricoll _stricoll strcasecoll getaddrinfo \
1176 AC_MSG_CHECKING(for working gettimeofday)
1177 FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
1178 [Define if the gettimeofday function works and is sane.]),)
1180 dnl Check for extra socket libraries.
1181 dnl If the AC_CHECK_FUNCS check finds the function, we don't look any
1182 dnl further. This is rumoured to prevent choosing the wrong libs on IRIX.
1183 if test $ac_cv_func_gethostbyname = no; then
1184 AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS")
1186 if test $ac_cv_func_connect = no; then
1187 AC_CHECK_LIB(socket, connect, LIBS="-lsocket $LIBS")
1189 if test $ac_cv_func_bind = no; then
1190 AC_CHECK_LIB(bind, gethostbyaddr, LIBS="-lbind $LIBS")
1193 dnl The use of both AC_FUNC_VSNPRINTF and AC_CHECK_FUNCS(vsnprintf) is
1196 dnl Windows fdopen does not work with sockets.
1197 if test "x$MINGW32" != "xyes"; then
1198 AC_CHECK_FUNCS(fdopen)
1201 dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated
1202 dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS,
1203 dnl and not in LIBS.
1205 dnl Now check if non blocking sockets are possible
1206 dnl (if fcntl or ioctl exists)
1208 AC_CHECK_FUNC([fcntl],
1209 [AC_DEFINE([HAVE_FCNTL], [1], [fcntl support])
1210 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])],
1211 [AC_CHECK_FUNC([ioctl],
1212 [AC_DEFINE([HAVE_IOCTL], [1], [ioctl support])
1213 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])])])
1215 dnl Checks if SIGPIPE is usable
1216 AC_MSG_CHECKING([for SIGPIPE])
1217 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[signal (SIGPIPE, SIG_IGN)]])],[AC_MSG_RESULT([yes])
1218 AC_DEFINE([HAVE_SIGPIPE], [1], [sigpipe support])],[AC_MSG_RESULT([no])])
1220 dnl export where the datadir is going to be installed
1221 FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
1223 if test x"$MINGW32" = xyes; then
1224 DEFAULT_SAVE_PATH=".;~/.freeciv/saves"
1225 if test x$crosser = xyes ; then
1226 FC_CONF_PATH="../etc/freeciv"
1227 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv;../share/freeciv"
1228 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios;../share/freeciv/scenarios"
1230 FC_CONF_PATH="etc/freeciv"
1231 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv"
1232 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios"
1235 FC_CONF_PATH="$sysconfdir/freeciv"
1236 DEFAULT_DATA_PATH=".:data:~/.freeciv/$DATASUBDIR:$datadir/freeciv"
1237 DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
1238 DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
1240 CPPFLAGS="$CPPFLAGS -DFC_CONF_PATH=\"\\\"$FC_CONF_PATH\\\"\""
1241 CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\""
1242 CPPFLAGS="$CPPFLAGS -DDEFAULT_SAVES_PATH=\"\\\"$DEFAULT_SAVES_PATH\\\"\""
1243 CPPFLAGS="$CPPFLAGS -DDEFAULT_SCENARIO_PATH=\"\\\"$DEFAULT_SCENARIO_PATH\\\"\""
1245 dnl This has to be last library
1246 if test -n "$WITH_EFENCE"; then
1247 AC_CHECK_LIB(efence, malloc, [
1248 if test "x$LIBS" = "x"; then
1251 LIBS="$LIBS -lefence"
1255 dnl Checks needed for Lua. Get rid of these if system lua is ever used.
1257 if test x$gl_cv_func_working_mkstemp = xyes ; then
1258 AC_DEFINE([HAVE_MKSTEMP], [1], [Have working mkstemp])
1260 AC_CHECK_FUNCS([isatty popen _longjmp _setjmp])
1262 AC_ARG_ENABLE([sys-lua],
1263 AS_HELP_STRING([--enable-sys-lua], [use lua from system instead of one from freeciv tree [false]]),
1264 [case "${enableval}" in
1271 *) AC_MSG_ERROR([bad value ${enableval} for --enable-sys-lua]) ;;
1272 esac], [sys_lua=false])
1274 dnl There's wide divergence on what the pkg-config file for Lua is called
1275 dnl See http://lua-users.org/lists/lua-l/2008-09/msg00184.html
1276 if test "x$sys_lua" = "xtrue" || test "x$sys_lua" = "xtest" ; then
1277 PKG_CHECK_MODULES([LUA], [lua5.2], [sys_lua=true],
1278 [PKG_CHECK_MODULES([LUA], [lua-5.2], [sys_lua=true],
1279 [PKG_CHECK_MODULES([LUA], [lua >= 5.2 lua < 5.3], [sys_lua=true],
1280 [if test "x$sys_lua" = "xtrue" ; then
1281 AC_MSG_ERROR([Use of included lua disabled, and no lua found from system])
1283 feature_syslua=missing
1287 if test "x$sys_lua" = "xfalse" ; then
1288 LUA_CFLAGS="-I\$(top_srcdir)/dependencies/lua-5.2/src"
1289 LUA_LIBS="\$(top_builddir)/dependencies/lua-5.2/src/liblua.la"
1292 AC_SUBST([LUA_CFLAGS])
1293 AC_SUBST([LUA_LIBS])
1294 AM_CONDITIONAL([SYS_LUA], [test "x$sys_lua" = "xtrue"])
1296 if test x$enable_fcdb = xyes ; then
1297 LUASQL_CFLAGS="-I\$(top_srcdir)/dependencies/luasql/src"
1298 LUASQL_LIBS="\$(top_builddir)/dependencies/luasql/src/libluasql_base.la"
1299 if test x$fcdb_mysql = xyes ; then
1300 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_mysql.la"
1302 if test x$fcdb_postgres = xyes ; then
1303 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_postgres.la"
1305 if test x$fcdb_sqlite3 = xyes ; then
1306 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_sqlite3.la"
1308 LUASQL_AS_DEPENDENCY="$LUASQL_LIBS"
1309 LUASQL_LIBS="$LUASQL_LIBS $FCDB_MYSQL_LIBS $FCDB_POSTGRES_LIBS $FCDB_SQLITE3_LIBS"
1311 AC_SUBST([LUASQL_CFLAGS])
1312 AC_SUBST([LUASQL_LIBS])
1313 AC_SUBST([LUASQL_AS_DEPENDENCY])
1316 TOLUA_CFLAGS="-I\$(top_srcdir)/dependencies/tolua-5.2/include"
1317 TOLUA_LIBS="\$(top_builddir)/dependencies/tolua-5.2/src/lib/libtolua.la"
1318 AC_SUBST([TOLUA_CFLAGS])
1319 AC_SUBST([TOLUA_LIBS])
1321 TOLUA="\$(top_builddir)/dependencies/tolua-5.2/src/bin/tolua$EXEEXT"
1324 dnl Freeciv uses a non-standard macro, Q_(), to handle cases of qualified
1325 dnl translatable strings and macro PL_() to handle plural forms.
1326 dnl Since the Gettext supplied Autoconf support
1327 dnl doesn't seem to have a way to add new keywords to its xgettext call,
1328 dnl we do the following.
1329 dnl The Gettext supplied Autoconf support starts with
1330 dnl 'translations/<domain>/Makefile.in.in', and builds
1331 dnl 'translations/<domain>/Makefile.in' then 'translations/<domain>/Makefile'.
1332 dnl In order for the commonly used _() and N_() macros to work, there
1333 dnl should be somewhere in that 'translations/<domain>/Makefile' a call
1334 dnl to xgettext with "--keyword=_" and "--keyword=N_" as arguments.
1335 dnl To support Q_() and PL_(), the following simply replaces instances of
1336 dnl "--keyword=N_" with "--keyword=N_ --keyword=Q_ --keyword=PL_:1,2"
1337 dnl in the 'translations/<domain>/Makefile' file.
1338 AC_CONFIG_COMMANDS([fc_default-1],[[for domain in $PODOMAINS ; do
1339 if test -f translations/${domain}/Makefile ; then
1340 if grep 'keyword=N_ --keyword=Q_ --keyword=PL_:1,2' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1341 # has already been extended
1344 echo extending translations/${domain}/Makefile
1345 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1346 sed -e 's/--keyword=N_/--keyword=N_ --keyword=Q_ --keyword=PL_:1,2/g' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1347 rm translations/${domain}/Makefile.tmp
1350 done]],[PODOMAINS="$PODOMAINS"])
1352 dnl Vast quantities of meaningless errors from xgettext is also annoying.
1353 dnl We fix this by forcing xgettext to assume all files are C source files.
1354 AC_CONFIG_COMMANDS([fc_default-2],[[for domain in $PODOMAINS ; do
1355 if test -f translations/freeciv/Makefile ; then
1356 if grep 'language=C --files-from=\$(srcdir)/POTFILES.in' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1357 # has already been silenced
1360 echo silencing translations/${domain}/Makefile
1361 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1362 sed -e 's/--files-from=$(srcdir)\/POTFILES.in/--language=C --files-from=$(srcdir)\/POTFILES.in/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1363 rm translations/${domain}/Makefile.tmp
1366 done]],[PODOMAINS="$PODOMAINS"])
1368 dnl Most of the C comments copied to freeciv.pot are spurious;
1369 dnl change to only copy those with prefix "TRANS:"
1370 dnl Also add --escape to the arguments to convert extended
1371 dnl characters to escape characters.
1372 AC_CONFIG_COMMANDS([fc_default-4],[[for domain in $PODOMAINS ; do
1373 if test -f translations/${domain}/Makefile ; then
1374 if grep 'add-comments="TRANS:" --escape' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1375 # has already been modified
1378 echo modifying translations/${domain}/Makefile add-comments/escape
1379 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1380 sed -e 's/add-comments/add-comments="TRANS:" --escape/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1381 rm translations/${domain}/Makefile.tmp
1384 done]],[PODOMAINS="$PODOMAINS"])
1386 dnl The BeOS sys/uio.h is broken. This kludges it out of existence.
1387 dnl (This still causes lots of spurious changes to fc_config.h on BeOS.)
1388 AC_CONFIG_COMMANDS([fc_default-5],[[if test x`uname -s` = xBeOS ; then
1389 if grep '#define HAVE_SYS_UIO_H 1' fc_config.h >/dev/null 2>&1 ; then
1390 echo kluging fc_config.h
1391 mv -f fc_config.h fc_config.h.tmp
1392 sed -e 's/#define HAVE_SYS_UIO_H 1/#undef HAVE_SYS_UIO_H/g' fc_config.h.tmp > fc_config.h
1397 CFLAGS="$EXTRA_DEBUG_CFLAGS $CFLAGS"
1398 CXXFLAGS="$EXTRA_DEBUG_CXXFLAGS $CXXFLAGS"
1399 LDFLAGS="$EXTRA_DEBUG_LDFLAGS $LDFLAGS"
1401 dnl Rebuild 'configure' whenever fc_version changes, if maintainer mode enabled.
1402 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/fc_version"])
1404 dnl Make sure that fc_config.h changes when ever CPPFLAGS, CFLAGS or CXXFLAGS
1405 dnl change so everything gets rebuilt. LDFLAGS is not handled here
1406 dnl since change in it should not cause recompilation, only relinking.
1407 dnl Note: Variables are named FC_STORE_* instead of FC_*_STORE in order to
1408 dnl make them appear next to each other in fc_config.h. Also single-quotes are
1409 dnl used because some " may appear unescaped within the flag strings.
1410 AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ['$CPPFLAGS'],
1411 [These are the CPPFLAGS used in compilation])
1412 AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ['$CFLAGS'],
1413 [These are the CFLAGS used in compilation])
1414 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'],
1415 [These are the CXXFLAGS used in compilation])
1417 AC_CONFIG_FILES([Makefile
1423 data/amplio2/Makefile
1424 data/buildings/Makefile
1427 data/cimpletoon/Makefile
1428 data/trident/Makefile
1429 data/isophex/Makefile
1430 data/isotrident/Makefile
1431 data/stdsounds/Makefile
1432 data/default/Makefile
1433 data/classic/Makefile
1434 data/multiplayer/Makefile
1435 data/experimental/Makefile
1436 data/civ2civ3/Makefile
1439 data/scenarios/Makefile
1440 data/nation/Makefile
1441 data/themes/Makefile
1442 data/themes/gui-gtk-2.0/Makefile
1443 data/themes/gui-gtk-2.0/Freeciv/Makefile
1444 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Makefile
1445 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Arrows/Makefile
1446 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Buttons/Makefile
1447 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Check-Radio/Makefile
1448 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Combo/Makefile
1449 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Frame-Gap/Makefile
1450 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Handles/Makefile
1451 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Lines/Makefile
1452 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ListHeaders/Makefile
1453 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Menu-Menubar/Makefile
1454 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Others/Makefile
1455 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Panel/Makefile
1456 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ProgressBar/Makefile
1457 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Range/Makefile
1458 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Scrollbars/Makefile
1459 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Shadows/Makefile
1460 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Spin/Makefile
1461 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Tabs/Makefile
1462 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Toolbar/Makefile
1463 data/themes/gui-gtk-3.0/Makefile
1464 data/themes/gui-gtk-3.0/Freeciv/Makefile
1465 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Makefile
1466 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Arrows/Makefile
1467 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Buttons/Makefile
1468 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Check-Radio/Makefile
1469 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Combo/Makefile
1470 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Frame-Gap/Makefile
1471 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Handles/Makefile
1472 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Lines/Makefile
1473 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ListHeaders/Makefile
1474 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Menu-Menubar/Makefile
1475 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Others/Makefile
1476 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Panel/Makefile
1477 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ProgressBar/Makefile
1478 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Range/Makefile
1479 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Scrollbars/Makefile
1480 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Shadows/Makefile
1481 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Spin/Makefile
1482 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile
1483 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile
1484 data/themes/gui-sdl/Makefile
1485 data/themes/gui-sdl/human/Makefile
1486 data/wonders/Makefile
1489 dependencies/Makefile
1490 dependencies/lua-5.2/Makefile
1491 dependencies/lua-5.2/src/Makefile
1492 dependencies/tolua-5.2/Makefile
1493 dependencies/tolua-5.2/src/Makefile
1494 dependencies/tolua-5.2/src/lib/Makefile
1495 dependencies/tolua-5.2/src/bin/Makefile
1496 dependencies/luasql/Makefile
1497 dependencies/luasql/src/Makefile
1498 dependencies/cvercmp/Makefile
1500 common/aicore/Makefile
1501 common/scriptcore/Makefile
1506 ai/threaded/Makefile
1510 client/agents/Makefile
1511 client/include/Makefile
1512 client/gui-sdl/Makefile
1513 client/gui-gtk-2.0/Makefile
1514 client/gui-gtk-3.0/Makefile
1515 client/gui-xaw/Makefile
1516 client/gui-qt/Makefile
1517 client/gui-stub/Makefile
1518 client/luascript/Makefile
1520 server/advisors/Makefile
1521 server/generator/Makefile
1522 server/scripting/Makefile
1524 translations/Makefile
1525 translations/freeciv/Makefile.in
1526 translations/nations/Makefile.in
1529 doc/man/freeciv-client.6
1530 doc/man/freeciv-server.6
1531 doc/man/freeciv-manual.6
1532 doc/man/freeciv-modpack.6
1540 freeciv.spec:bootstrap/freeciv.spec.in
1542 client/freeciv.desktop:bootstrap/freeciv.desktop.in
1543 client/freeciv-gtk2.desktop:bootstrap/freeciv-gtk2.desktop.in
1544 client/freeciv-sdl.desktop:bootstrap/freeciv-sdl.desktop.in
1545 client/freeciv-qt.desktop:bootstrap/freeciv-qt.desktop.in
1546 server/freeciv-server.desktop:bootstrap/freeciv-server.desktop.in
1547 tools/freeciv-mp-gtk2.desktop:bootstrap/freeciv-mp-gtk2.desktop.in
1548 tools/freeciv-mp-gtk3.desktop:bootstrap/freeciv-mp-gtk3.desktop.in
1549 tools/freeciv-mp-qt.desktop:bootstrap/freeciv-mp-qt.desktop.in
1550 client/freeciv-gtk2.appdata.xml:bootstrap/freeciv-gtk2.appdata.xml.in
1551 client/freeciv-gtk3.appdata.xml:bootstrap/freeciv-gtk3.appdata.xml.in
1552 client/freeciv-sdl.appdata.xml:bootstrap/freeciv-sdl.appdata.xml.in
1553 client/freeciv-qt.appdata.xml:bootstrap/freeciv-qt.appdata.xml.in
1554 server/freeciv-server.appdata.xml:bootstrap/freeciv-server.appdata.xml.in
1555 tools/freeciv-mp-gtk2.appdata.xml:bootstrap/freeciv-mp-gtk2.appdata.xml.in
1556 tools/freeciv-mp-gtk3.appdata.xml:bootstrap/freeciv-mp-gtk3.appdata.xml.in
1557 tools/freeciv-mp-qt.appdata.xml:bootstrap/freeciv-mp-qt.appdata.xml.in])
1558 AC_CONFIG_FILES([fcgui:bootstrap/fcgui.in], [chmod +x fcgui])
1559 AC_CONFIG_FILES([fcser:bootstrap/fcser.in], [chmod +x fcser])
1561 if test "$USE_NLS" != "yes" ; then
1563 dnl Produced config.status will have constant value of FORCE_DIST,
1564 dnl but it still checks 'if test x$FORCE_DIST = xyes'. We cannot
1565 dnl do that check in configure when producing config.status.
1566 AC_CONFIG_COMMANDS([translations/freeciv/Makefile], [
1567 for domain in $PODOMAINS ; do
1568 dnl Usually glib-gettext.m4:AM_GLIB_GNU_GETTEXT outputs commands to
1569 dnl generate translations/${domain}/Makefile.
1570 dnl If NLS is disabled, we generate one here.
1571 rm -f translations/${domain}/Makefile
1573 dnl - Add nonls_warn as dependency to dist -target
1574 dnl - Remove dependencies from update-po, so it is never rebuilt
1575 dnl - Set list of distributed files (no generated files)
1576 sed -e 's/^dist distdir:.*/dist distdir: nonls_warn/' \
1577 -e 's/^update-po:.*/update-po:/' \
1578 -e 's/^DISTFILES =.*/DISTFILES = Makefile.in.in POTFILES.in POTFILES.skip \$(POFILES)/' \
1579 translations/${domain}/Makefile.in > translations/${domain}/Makefile
1581 dnl Create nonls_warn target.
1582 echo >> translations/${domain}/Makefile
1583 echo nonls_warn: >> translations/${domain}/Makefile
1584 if test "x$FORCE_DIST" = "xyes" ; then
1585 echo " @echo Building dist without generated localization files!" >> translations/${domain}/Makefile
1587 echo " @echo Cannot build dist with NLS disabled! && /bin/false" >> translations/${domain}/Makefile
1590 ], [FORCE_DIST=$FORCE_DIST
1591 PODOMAINS="$PODOMAINS"])
1597 ****************** Configuration Summary ******************
1599 == General build options ==
1600 Shared libraries: $enable_shared
1601 Debugging support: $enable_debug
1602 Profiling support: $enable_gprof
1603 IPv6 support: $enable_ipv6
1604 Map image toolkits: $enable_mapimg
1606 MagickWand: $mapimg_magickwand
1609 Build freeciv client: $client
1611 Maintained client frontends:
1618 In-development client frontends:
1619 (these are not yet ready for general use)
1623 Build freeciv server: $server
1624 AI modules support: $enable_aimodules
1625 Database support: $enable_fcdb
1627 postgres: $fcdb_postgres
1628 sqlite3: $fcdb_sqlite3
1631 Modpack installers: $fcmp_list