1 dnl configure.ac for freeciv
2 dnl Process this file with autoconf to produce a configure script.
4 dnl Initialize with some random file to ensure the source is here.
5 AC_INIT([freeciv], m4_esyscmd([./fc_version | tr -d '\n']))
7 AC_CONFIG_SRCDIR([common/game.c])
8 AC_CONFIG_AUX_DIR(bootstrap) # This can't be quoted or automake will fail
9 AC_CONFIG_MACRO_DIR([m4])
10 ifdef([AC_CONFIG_MACRO_DIRS],[AC_CONFIG_MACRO_DIRS([dependencies/m4])])
11 AC_CONFIG_HEADERS([fc_config.h])
13 AC_USE_SYSTEM_EXTENSIONS
16 BUG_URL="http://gna.org/projects/freeciv/"
17 WIKI_URL="http://www.freeciv.org/"
18 MAIL_ADDRESS="freeciv-dev AT gna.org"
20 AC_DEFINE(FC_CONFIG_H, 1, [Configuration autogenerated])
21 AC_DEFINE_UNQUOTED([BUG_URL], ["$BUG_URL"], [Bug reporting URL])
22 AC_DEFINE(META_URL, "http://meta.freeciv.org/metaserver.php", [Meta server URL])
23 AC_DEFINE_UNQUOTED([WIKI_URL], ["$WIKI_URL"], [Informational URL])
25 AC_DEFINE(DEFAULT_SOCK_PORT, 5556, [Connection TCP Port])
29 AC_SUBST([MAIL_ADDRESS])
31 dnl client/server should always have the same major and minor versions
32 dnl different patch versions are compatible
33 VERSION_SCRIPT_SILENT=yes
34 m4_include(fc_version)
36 VERSION_WITHOUT_LABEL=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}
37 VERSION=${VERSION_WITHOUT_LABEL}${VERSION_LABEL}
39 AC_DEFINE_UNQUOTED([MAJOR_VERSION], [$MAJOR_VERSION], [Major version])
40 AC_DEFINE_UNQUOTED([MINOR_VERSION], [$MINOR_VERSION], [Minor version])
41 AC_DEFINE_UNQUOTED([PATCH_VERSION], [$PATCH_VERSION], [Patch version])
42 AC_DEFINE_UNQUOTED([VERSION_LABEL], ["${VERSION_LABEL}"], [Version label])
43 AC_DEFINE_UNQUOTED([VERSION_STRING], ["${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${VERSION_LABEL}"], [Version string])
44 AC_DEFINE_UNQUOTED([IS_DEVEL_VERSION], [$IS_DEVEL_VERSION], [Is this a devel version])
45 AC_DEFINE_UNQUOTED([IS_FREEZE_VERSION], [$IS_FREEZE_VERSION], [Is this a frozen version])
46 AC_DEFINE_UNQUOTED([IS_BETA_VERSION], [$IS_BETA_VERSION], [Is this a beta version])
47 AC_DEFINE_UNQUOTED([NEXT_STABLE_VERSION], ["$NEXT_STABLE_VERSION"], [Version number of next release])
48 AC_DEFINE_UNQUOTED([RELEASE_MONTH], [$RELEASE_MONTH], [Month next version will be released])
49 AC_SUBST([MAJOR_VERSION])
50 AC_SUBST([MINOR_VERSION])
52 AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_MANDATORY],
53 ["$NETWORK_CAPSTRING_MANDATORY"],
54 [Network capability string])
55 AC_SUBST([NETWORK_CAPSTRING_MANDATORY])
56 AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_OPTIONAL],
57 ["$NETWORK_CAPSTRING_OPTIONAL"],
58 [Additional optional network capabilities])
59 AC_SUBST([NETWORK_CAPSTRING_OPTIONAL])
61 AC_DEFINE_UNQUOTED([DATASUBDIR],
63 [Version specific subdir for default data path])
64 AC_SUBST([DATASUBDIR])
66 AC_DEFINE_UNQUOTED([FREECIV_DISTRIBUTOR], ["$FREECIV_DISTRIBUTOR"],
67 [Distribution this freeciv is built for])
69 dnl Initialize automake stuff
70 AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
72 dnl Use Automake 1.11 silent rules by default if available
73 dnl verbose build using make V=1
74 ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
80 dnl Sed is needed for the configuration
81 dnl of the clients, database setting and the mapimg toolkits.
84 dnl set default values
90 dnl checks for databases
91 dnl all: Autodetect as many as possible [default].
92 dnl mysql: use mysql database
93 dnl postgres: use postgres database
94 dnl comma-separated-list: Detect these or abort.
96 AS_HELP_STRING([--enable-fcdb[=no/all/mysql/postgres/sqlite3]],
97 [database backends [no](no, or list)]),
98 [databases=${enableval}],
101 for db in $(echo $databases | $SED 's/,/ /g') ; do
102 if test "x$db" = "xall" ; then
104 elif test "x$db" = "xno" ; then
106 elif test "x$db" = "xmysql" ; then
108 elif test "x$db" = "xpostgres" ; then
110 elif test "x$db" = "xsqlite3" ; then
113 AC_MSG_ERROR([bad value ${db} for --enable-fcdb])
117 dnl checks for database mysql
118 dnl sets FCDB_MYSQL(conditional), FCDB_MYSQL_CFLAGS
121 dnl checks for database postgres
122 dnl sets FCDB_POSTGRES(conditional), FCDB_POSTGRES_CFLAGS
125 dnl checks for database sqlite3
126 dnl sets FCDB_SQLITE3(conditional), FCDB_SQLITE3_CFLAGS
129 dnl check if a database backend is available
130 if test "x$fcdb_mysql" = "xyes" || test "x$fcdb_postgres" = "xyes" \
131 || test "x$fcdb_sqlite3" = "xyes"; then
133 AC_DEFINE([HAVE_FCDB], [1], [Database backend available])
137 AM_CONDITIONAL([FCDB_DB], [test "x$enable_fcdb" = "xyes"])
139 dnl no=do not compile server, yes=compile server, *=error
140 AC_ARG_ENABLE([server],
141 AS_HELP_STRING([--disable-server], [do not compile the server]),
142 [case "${enableval}" in
145 *) AC_MSG_ERROR(bad value ${enableval} for --disable-server) ;;
147 AM_CONDITIONAL(SERVER, test x$server = xyes)
149 dnl yes - Support for IPv6 required
150 dnl no - Legacy IPv4 support
151 dnl test - Try to enable IPv6 support
152 AC_ARG_ENABLE([ipv6],
153 AS_HELP_STRING([--enable-ipv6=yes/no/test], [use IPv6 [test]]),
154 [case "${enableval}" in
155 yes|no|test) ipv6=${enableval} ;;
156 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
158 if test x$ipv6 != xno ; then
160 dnl We check some functions (getaddrinfo) twice. Once unconditionally
161 dnl to get HAVE_xxx always correctly set. We need separate check here to
162 dnl correcly disable IPv6 when function is not available.
163 AC_CHECK_FUNCS([getaddrinfo inet_pton inet_ntop getnameinfo],
164 [], [enable_ipv6=no])
165 if test x$enable_ipv6 = xyes ; then
166 AC_MSG_CHECKING([for AF_INET6])
167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
168 #include <sys/types.h>
169 #include <sys/socket.h>
170 ]], [[return AF_INET6;]])], [AC_MSG_RESULT([yes])],
174 if test x$enable_ipv6 = xno && test x$ipv6 = xyes ; then
175 AC_MSG_ERROR([Cannot enable IPv6 functionality])
177 if test x$enable_ipv6 = xyes ; then
178 AC_DEFINE([IPV6_SUPPORT], [1], [IPv6 Support built in])
184 AC_ARG_WITH([readline],
185 AS_HELP_STRING([--with-readline], [support fancy command line editing]),
186 WITH_READLINE=$withval, dnl yes/no - required to use / never use
187 WITH_READLINE="maybe" dnl maybe - use if found [default]
190 FOLLOWTAG=${DEFAULT_FOLLOW_TAG}
191 AC_ARG_WITH([followtag],
192 AS_HELP_STRING([--with-followtag], [version tag to follow]),
193 [FOLLOWTAG=${withval}])
194 AC_DEFINE_UNQUOTED([FOLLOWTAG], ["${FOLLOWTAG}"], [Version tag to follow])
196 AC_ARG_WITH([desktopdir],
197 AS_HELP_STRING([--with-desktopdir], [install desktop files to given dir]),
198 [ DESKTOPDIR=${withval} ], [ DESKTOPDIR="\$(prefix)/share/applications" ])
199 AC_SUBST([DESKTOPDIR])
201 AC_ARG_WITH([appdatadir],
202 AS_HELP_STRING([--with-appdatadir], [install appdata files to given dir]),
203 [ APPDATADIR=${withval} ], [ APPDATADIR="\$(prefix)/share/appdata" ])
204 AC_SUBST([APPDATADIR])
206 dnl set default values
211 dnl all: Autodetect as many as possible [default].
212 dnl no: No additional toolkits.
213 dnl magickwand: compile magickwand (imagemagick) support.
214 dnl comma-separated-list: Detect these or abort.
215 AC_ARG_ENABLE([mapimg],
216 AS_HELP_STRING([--enable-mapimg=no/auto/magickwand],
217 [additional map image toolkits to compile [auto](no, or list)]),
218 [toolkits=${enableval}],
219 [enable_mapimg=auto])
221 for toolkit in $(echo $toolkits | $SED 's/,/ /g') ; do
222 if test "x$toolkit" = "xauto" ; then
224 elif test "x$toolkit" = "xno" ; then
227 enable_mapimg=selected
230 if test "x$toolkit" = "xmagickwand" ; then
231 mapimg_magickwand=yes
235 dnl checks for MagickWand mapimg support
236 dnl sets MAPIMG_WAND_CFLAGS, MAPIMG_WAND_LIBS
239 dnl no: Do not compile client.
240 dnl auto: Autodetect one.
241 dnl all: Autodetect as many as possible.
242 dnl comma-separated-list: Detect these or abort.
243 AC_ARG_ENABLE([client],
244 AS_HELP_STRING([--enable-client=auto/all/gtk2/gtk3/sdl/xaw/qt/stub],
245 [clients to compile [auto](list for multiple)]),
246 [clients=${enableval}],
256 for gui in $(echo $clients | $SED 's/,/ /g') ; do
257 if test "x$gui" = "xno" ; then
259 elif test "x$gui" = "xauto" ; then
261 elif test "x$gui" = "xall" ; then
264 if test "x$gui" = "xgtk2" ||
265 test "x$gui" = "xgtk2.0" ||
266 test "x$gui" = "xgtk20" ||
267 test "x$gui" = "xgtk-2.0" ; then
269 elif test "x$gui" = "xgtk3" ||
270 test "x$gui" = "xgtk3.0" ||
271 test "x$gui" = "xgtk30" ||
272 test "x$gui" = "xgtk-3.0" ; then
274 elif test "x$gui" = "xgtk" ; then
275 AC_MSG_WARN([for requested client 'gtk' enabled gtk2-client, but that default changes in the future])
278 if test ! -d "${srcdir}/client/gui-$gui" ; then
279 AC_MSG_ERROR(bad value ${gui} for --enable-client)
288 AS_HELP_STRING([--with-xaw], [use the Xaw widget set for the xaw client]),
293 AS_HELP_STRING([--with-xaw3d], [use the Xaw3d widget set for the xaw client]),
297 if test "x$WITH_XAW" != "x" && test "x$WITH_XAW3D" != "x" ; then
298 AC_MSG_ERROR(Cannot use both --with-xaw and --with-xaw3d at the same time)
301 AC_ARG_ENABLE([svnrev],
302 AS_HELP_STRING([--enable-svnrev], [get svn revision to version information]),
303 [case "${enableval}" in
306 *) AC_MSG_ERROR([bad value ${enableval} for --enable-svnrev]) ;;
307 esac], [svnrev=false])
308 AM_CONDITIONAL([SVNREV], [test x$svnrev = xtrue])
309 if test x$svnrev = xtrue ; then
310 AC_DEFINE([SVNREV], [1], [Get svn revision information to version number])
313 AC_ARG_ENABLE([gitrev],
314 AS_HELP_STRING([--enable-gitrev], [get git revision to version information]),
315 [case "${enableval}" in
318 *) AC_MSG_ERROR([bad value ${enableval} for --enable-gitrev]) ;;
319 esac], [gitrev=false])
320 AM_CONDITIONAL([GITREV], [test x$gitrev = xtrue])
321 if test x$gitrev = xtrue ; then
322 AC_DEFINE([GITREV], [1], [Get git revision information to version number])
325 AC_ARG_ENABLE([make_data],
326 AS_HELP_STRING([--disable-make-data], [do not recurse make into data directories]),
327 [case "${enableval}" in
328 yes) make_data=true ;;
329 no) make_data=false ;;
330 *) AC_MSG_ERROR(bad value ${enableval} for --disable-make-data) ;;
331 esac], [make_data=true])
332 AM_CONDITIONAL(MAKE_DATA, test x$make_data = xtrue)
334 AC_ARG_ENABLE([make_include],
335 AS_HELP_STRING([--enable-make-include], [force make to recurse into include directory]),
336 [case "${enableval}" in
337 yes) make_include=true ;;
338 no) make_include=false ;;
339 *) AC_MSG_ERROR(bad value ${enableval} for --enable-make-include) ;;
340 esac], [make_include=false])
341 AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test "$make_include" = "true")
343 AC_ARG_WITH([efence],
344 AS_HELP_STRING([--with-efence], [use Electric Fence, malloc debugger]),
348 AC_ARG_ENABLE([aimodules],
349 AS_HELP_STRING([--enable-aimodules=yes/no/experimental], [support for ai modules [no]]),
350 [case "${enableval}" in
351 yes) enable_aimodules=yes ;;
352 no) enable_aimodules=no ;;
353 experimental) enable_aimodules=yes
355 *) AC_MSG_ERROR([bad value ${enable_aimodules} for --enable-aimodules]) ;;
356 esac], [enable_aimodules=no])
357 aimoduledir="${libdir}/fcai"
358 AC_SUBST(aimoduledir)
359 AM_CONDITIONAL(AI_MODULES, test "x$enable_aimodules" = "xyes")
360 if test $enable_aimodules = yes ; then
361 if test x$enable_shared != xyes ; then
362 AC_MSG_ERROR([cannot enable ai module support if also build of shared libraries is not enabled with --enable-shared])
366 AC_MSG_CHECKING([whether can build modules])
367 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ltdl.h>]],
368 [[lt_dlopenext(NULL);]])],
369 [AC_MSG_RESULT([yes])],
371 AC_MSG_ERROR([cannot build loadable AI modules as requested])])
373 SERVER_LIBS="${SERVER_LIBS} -lltdl"
374 AC_DEFINE([AI_MODULES], [1], [Enable ai modules])
375 CPPFLAGS="${CPPFLAGS} -DAI_MODULEDIR=\"\\\"${aimoduledir}\\\"\""
376 ai_mod_default_needed=yes
378 AM_CONDITIONAL(EXP_AI_MODULES, test "x$exp_aimodules" = "xyes")
380 AC_ARG_ENABLE([ai-static],
381 AS_HELP_STRING([--enable-ai-static], [statically link listed modules to server]),
382 [static_modules="${enableval}"],
383 [static_modules="classic"])
385 ai_mod_static_classic=no
386 ai_mod_static_threaded=no
388 for module in $(echo $static_modules | $SED 's/,/ /g') ; do
389 if test "x$module" = "xclassic" ; then
390 ai_mod_static_classic=yes
391 ai_mod_default_needed=yes
392 AC_DEFINE([AI_MOD_STATIC_CLASSIC], [1],
393 [classic ai module statically linked])
394 elif test "x$module" = "xthreaded" ; then
395 ai_mod_static_threaded=yes
396 ai_mod_default_needed=yes
397 AC_DEFINE([AI_MOD_STATIC_THREADED], [1],
398 [threaded ai module statically linked])
400 AC_MSG_ERROR([bad value ${module} for --enable-ai-static])
402 if test "x$default_ai_set" = "x" ; then
403 dnl Make first static module default ai type
404 default_ai_set="${module}"
407 AM_CONDITIONAL([AI_MOD_STATIC_CLASSIC],
408 [test "x$ai_mod_static_classic" = "xyes" || test "x$enable_aimodules" != "xyes"])
409 AM_CONDITIONAL([AI_MOD_STATIC_THREADED],
410 [test "x$ai_mod_static_threaded" = "xyes"])
412 AC_ARG_WITH([default-ai],
413 AS_HELP_STRING([--with-default-ai], [default ai type [first static]]),
414 [default_ai_set="${withval}"],
417 AC_ARG_WITH([ai-lib],
418 AS_HELP_STRING([--with-ai-lib], [build in default AI code [if needed]]),
419 [ai_mod_default_needed=yes], [])
421 AM_CONDITIONAL([AI_MOD_DEFAULT_NEEDED],
422 [test "x${ai_mod_default_needed}" = "xyes" || test "x${default_ai_set}" = "x"])
424 if test "x${default_ai_set}" = "x" ; then
425 default_ai_set="classic"
429 if test "x$ai_mod_static_classic" = "xyes" ; then
430 fc_ai_last=$fc_ai_last+1
432 if test "x$ai_mod_static_threaded" = "xyes" ; then
433 fc_ai_last=$fc_ai_last+1
435 if test "x$enable_aimodules" = "xyes" ; then
436 dnl Dynamic modules allowed, give slots for them
437 fc_ai_last=$fc_ai_last+3
439 AC_DEFINE_UNQUOTED([FC_AI_LAST], [(${fc_ai_last})], [Max number of AI modules])
441 AC_DEFINE_UNQUOTED([AI_MOD_DEFAULT], ["${default_ai_set}"], [Default ai type name])
443 dnl Checks for programs.
449 dnl Replace AC_PROG_LIBTOOL with LT_INIT when minimum libtool
452 LIBTOOL="$LIBTOOL --preserve-dup-deps"
454 AC_CHECK_TOOL(AR, ar)
456 AC_MSG_ERROR([*** 'ar' missing. Install binutils, fix your \$PATH, or set \$AR manually. ***])
463 AC_CHECK_PROG(UNAME,uname,uname,:)
465 AC_CHECK_SIZEOF([int])
467 dnl Programs already checked by AM_INIT_AUTOMAKE:
469 dnl AC_PROG_MAKE_SET required with automake-ng
472 dnl Check for libiconv (which is usually included in glibc, but may be
473 dnl distributed separately). The libcharset check must come after the
474 dnl iconv check. This whole thing must come before the gettext check below.
478 if test "$am_cv_func_iconv" != yes; then
479 AC_MSG_ERROR([Iconv is missing. You can get libiconv from http://gnu.org/, \
480 or try using --with-libiconv-prefix.])
482 LIBS="$LIBS $LIBICONV"
485 ALL_LINGUAS="ar bg cs ca da de el en_GB eo es et fa fi fr ga gd he hu id it ja
486 ko lt nl nb pl pt pt_BR ro ru sr sv tr uk zh_CN zh_TW"
487 PODOMAINS="freeciv nations"
490 AS_HELP_STRING([--disable-nls], [do not add localization support]),
491 [case "${enableval}" in
495 dnl NLS disabled, but 'make dist' allowed. That dist will lack
496 dnl all generated localization files.
497 no-gmo-dist) USE_NLS=no
499 *) AC_MSG_ERROR([bad value ${enableval} for --enable-nls]) ;;
500 esac], [USE_NLS=yes])
502 if test "$USE_NLS" = "yes" ; then
505 dnl AM_GLIB_GNU_GETTEXT doesn't have all features we want
506 dnl or they don't behave correctly.
507 dnl Old gettext binaries don't understand plurals. (ngettext, msgid_plural)
508 dnl and there are some problems with missing ngettext.
509 dnl Is that ngettext part still true? AM_GLIB_GNU_GETTEXT does check for it
511 have_working_ngettext=0
512 AC_CHECK_LIB(c, ngettext,
513 [AC_MSG_CHECKING(whether libc's ngettext works at runtime)
514 FC_CHECK_NGETTEXT_RUNTIME(,have_working_ngettext=1,)],)
516 if test "$have_working_ngettext" = "0"; then
517 AC_CHECK_LIB([intl], [ngettext],
518 [AC_MSG_CHECKING([whether libintl's ngettext works at runtime])
519 FC_CHECK_NGETTEXT_RUNTIME(["-lintl"],[have_working_ngettext=1
520 UTILITY_LIBS="${UTILITY_LIBS} -lintl"],)],)
523 if test "$have_working_ngettext" = "0"; then
524 AC_MSG_ERROR(I haven't found a working ngettext function in your system.
525 Try --disable-nls. Read ABOUT-NLS.)
528 if test "$IS_BETA_VERSION" = "1" || test "$IS_DEVEL_VERSION" = "1"; then
529 AC_MSG_CHECKING(for GNU xgettext version >= 0.10.36)
530 xgettext_version=`$XGETTEXT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'`
531 AC_RUN_IFELSE([AC_LANG_SOURCE([[
534 const char *version = "$xgettext_version";
537 const char *p = version;
538 int major = 0, minor = 0, patch = 0;
540 while (*p != '\0' && (*p < '0' || *p > '9')) {
546 sscanf(p, "%d.%d.%d", &major, &minor, &patch);
547 if (major < 1 && (minor < 10 || (minor == 10 && patch < 36))) {
552 ]])],[AC_MSG_RESULT(yes)
555 AC_MSG_WARN(You may have problems with creating pox files. \
556 Please update your gettext package.)
561 AC_MSG_CHECKING(for GNU msgfmt version >= 0.10.35)
562 msgfmt_version=`$MSGFMT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'`
563 AC_RUN_IFELSE([AC_LANG_SOURCE([[
566 const char *version = "$msgfmt_version";
570 const char *p = version;
571 int major = 0, minor = 0, patch = 0;
573 while (*p != '\0' && (*p < '0' || *p > '9')) {
579 sscanf(p, "%d.%d.%d", &major, &minor, &patch);
580 if (major < 1 && (minor < 10 || (minor == 10 && patch < 35))) {
585 ]])],[AC_MSG_RESULT(yes)
588 AC_MSG_ERROR(You are unable to create *.gmo files.
589 This is development version which doesn't include them. Please update your
590 gettext package. We recommend you versions >= 0.10.38. Or use
591 --disable-nls instead.)
597 dnl Setup POFILES even when NLS disabled.
598 dnl AM_GLIB_GNU_GETTEXT does this when NLS enabled.
599 for lang in $ALL_LINGUAS; do
600 POFILES="$POFILES $lang.po"
606 if test "x$PKG_CONFIG" = "x" ; then
607 AC_MSG_ERROR([pkg-config not found])
609 PKG_CHECK_MODULES([CURL], [libcurl >= 7.9.7],,
610 [AC_MSG_ERROR([libcurl development files required])])
611 UTILITY_CFLAGS="${UTILITY_CFLAGS} ${CURL_CFLAGS}"
612 UTILITY_LIBS="${UTILITY_LIBS} ${CURL_LIBS}"
614 dnl Set debug flags supported by compiler
615 EXTRA_DEBUG_CFLAGS=""
616 EXTRA_DEBUG_CXXFLAGS=""
617 EXTRA_DEBUG_LDFLAGS=""
623 AC_C99_VARIADIC_MACROS
624 AC_C99_VARIABLE_ARRAYS
630 dnl BeOS-specific settings
631 if test x`$UNAME -s` = xBeOS ; then
632 AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [BeOS-specific setting])
633 CFLAGS="$CFLAGS -Wno-multichar"
634 LDFLAGS="$LDFLAGS -x none"
635 if test x$enable_debug = xyes ; then
636 CFLAGS="$CFLAGS -gdwarf-2"
637 LDFLAGS="$LDFLAGS -gdwarf-2"
639 # We used to set ARFLAGS here, but under recent versions of automake this
640 # broke compilation on other systems. Setting ARFLAGS shouldn't be
641 # necessary with a working automake.
647 HOST_PATH_SEPARATOR=":"
649 dnl Settings specific to host OS
653 dnl Windows-specific settings
655 AC_CHECK_TOOL([WINDRES], [windres])
656 if test -z $WINDRES; then
657 AC_MSG_ERROR([*** 'windres' missing. Install binutils, fix your \$PATH, or set \$WINDRES manually. ***])
660 HOST_PATH_SEPARATOR=";"
662 AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [Mingw32-specific setting - stdin])
663 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw32])
664 AC_DEFINE([WIN32_NATIVE], [1], [Mingw32-specific setting - native])
665 AC_DEFINE([HAVE_WINSOCK], [1], [Mingw32-specific setting - winsock])
666 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])
667 LIBS="$LIBS -lwsock32"
671 dnl SkyOS specific settings
672 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - SkyOS])
676 dnl Haiku specific settings
677 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Haiku])
678 LIBS="$LIBS -lnetwork"
683 AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Amiga])
688 dnl Autoconf provides path separator for build system.
689 dnl Use that instead of our own guess in case of native build.
690 if test x$build = x$host ; then
691 HOST_PATH_SEPARATOR=$PATH_SEPARATOR
694 dnl note this has to match the path installed by translations/freeciv/Makefile
695 if test x"$MINGW32" != "xyes"; then
696 CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\"\\\"$localedir\\\"\""
698 AC_DEFINE_UNQUOTED([LOCALEDIR], ["./share/locale"], [Locale directory (windows)])
701 CPPFLAGS="$CPPFLAGS -DBINDIR=\"\\\"$bindir\\\"\""
706 AC_CHECK_LIB(z, gzgets,
707 [AC_DEFINE([HAVE_LIBZ], [1], [zlib is available])
708 UTILITY_LIBS="${UTILITY_LIBS} -lz"
709 COMMON_LIBS="$COMMON_LIBS -lz"],
710 AC_MSG_ERROR([Could not find zlib library.]))
712 AC_CHECK_HEADER(zlib.h, ,
713 AC_MSG_ERROR([zlib found but not zlib.h.
714 You may need to install a zlib devel package.]))
716 AC_PATH_PROG(GZIP, gzip, "no")
717 if test "$GZIP" = "no"; then
718 AC_MSG_ERROR([You need the gzip program for compilation.])
721 dnl Check for bzip2 compression
722 AC_CHECK_LIB(bz2, BZ2_bzReadOpen,
723 [AC_CHECK_HEADERS([bzlib.h],
724 [AC_DEFINE([HAVE_LIBBZ2], [1], [libbzip2 is available])
725 UTILITY_LIBS="${UTILITY_LIBS} -lbz2"
726 libbz2_available=true])])
727 if test "x$libbz2_available" != "xtrue" ; then
731 dnl Check for xz compression
732 AC_CHECK_LIB(lzma, lzma_code,
733 [AC_CHECK_HEADERS([lzma.h],
734 [AC_DEFINE([HAVE_LIBLZMA], [1], [liblzma is available])
735 UTILITY_LIBS="${UTILITY_LIBS} -llzma"
736 libxz_available=true])])
737 if test "x$libxz_available" != "xtrue" ; then
741 AC_SUBST([UTILITY_CFLAGS])
742 AC_SUBST([UTILITY_LIBS])
743 AC_SUBST([COMMON_LIBS])
745 AC_ARG_ENABLE([crosser],
746 AS_HELP_STRING([--enable-crosser], [build version to be used with crosser environment]),
747 [case "${enableval}" in
750 *) AC_MSG_ERROR([bad value ${enableval} for --enable-crosser]) ;;
752 if test x$crosser = xyes && test x$MINGW32 != xyes ; then
753 AC_MSG_ERROR([--enable-crosser is Windows build specific option])
756 dnl Check thread implementation
757 AC_MSG_CHECKING([for threads implementation])
760 CFLAGS_SAVE="${CFLAGS}"
763 if test x$crosser != xyes ; then
764 FC_C_FLAGS([-pthread], [], [CFLAGS])
765 FC_LD_FLAGS([-pthread], [], [LIBS])
766 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
767 [[return pthread_create(NULL, NULL, NULL, NULL);]])],
768 [AC_DEFINE([HAVE_PTHREAD], [1], [Use pthreads as thread implementation])
770 AC_MSG_RESULT([pthreads])
771 AC_DEFINE([HAVE_THREAD_COND], [1], [Has thread condition variable implementation])])
775 if test "x$thread_impl" = "xnone" ; then
776 CFLAGS="$CFLAGS_SAVE"
777 LDFLAGS="$LDFLAGS_SAVE"
779 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
780 [[CreateThread(NULL, 0, NULL, NULL, 0, NULL);]])],
781 [AC_DEFINE([HAVE_WINTHREADS], [1], [Use Windows threads as thread implementation])
783 AC_MSG_RESULT([windows])])
786 if test "x$thread_impl" = "xnone" ; then
787 AC_MSG_ERROR([No usable thread implementation available])
790 if test "x$thread_cond" != "xtrue" ; then
791 feature_thr_cond=missing
794 dnl Check and choose clients
795 if test "x$client" != "xno"; then
797 dnl Check for sound support, sets SOUND_CFLAGS, SOUND_LIBS, AUDIO_SDL
798 dnl Client gui checks need to know which mixer version this has selected
801 dnl if specified --with-xaw or --with-xaw3d, assume --enable-client=xaw
802 if test -n "$WITH_XAW" || test -n "$WITH_XAW3D"; then
803 if test "x$client" = "xauto" ; then
806 elif test "x$client" = "xall" ; then
811 dnl if need to guess client, announce checking
812 if test "x$client" = "xauto"; then
813 AS_MESSAGE([checking for which client to compile:...])
814 elif test "x$client" = "xall" ; then
815 AS_MESSAGE([checking for which clients to compile:...])
818 dnl Gtk-2.0-specific overrides
821 dnl Gtk-3.0-specific overrides
824 dnl SDL-specific overrides
827 dnl Xaw-specific overrides
830 dnl QT-specific overrides
833 dnl Stub-specific overrides
834 if test "x$gui_stub" = "xyes" || test "x$client" = "xall" ; then
837 if test "x$found_client" = "xyes"; then
839 if test "x$client" = "xauto" ; then
843 elif test "x$gui_stub" = "xyes"; then
844 AC_MSG_ERROR(specified client 'stub' not configurable)
848 dnl If client still "auto", error out since we couldn't select any of them
849 if test "x$client" = "xauto" ; then
850 AC_MSG_ERROR([can not build any of the clients])
854 if test "x$client" = "xall" ; then
855 if test "x$gui_gtk2" = "xyes" ||
856 test "x$gui_gtk3" = "xyes" ||
857 test "x$gui_sdl" = "xyes" ||
858 test "x$gui_xaw" = "xyes" ||
859 test "x$gui_qt" = "xyes" ||
860 test "x$gui_stub" = "xyes" ; then
868 if test "x$gui_gtk2" = "xyes" || test "x$gui_gtk3" = "xyes" ; then
870 if test "x$gui_gtk2" = "xyes" ; then
871 gui_gtk2_LIBS="$gui_gtk2_libs $LIB_GGZ_GTK"
873 if test "x$gui_gtk3" = "xyes" ; then
874 gui_gtk3_libs="$gui_gtk3_libs $LIB_GGZ_GTK"
879 if test "$ggz_server" = "yes" ; then
880 AC_CHECK_FUNCS([chdir mkdtemp])
883 FC_LD_FLAGS(["-Wl,-rpath=${lib_prefix}"], [], [LDFLAGS])
885 AM_CONDITIONAL([CLIENT], [test "x$client" = "xyes"])
887 AC_ARG_WITH([freeciv-manual],
888 AS_HELP_STRING([--without-freeciv-manual], [do not build freeciv-manual]),
889 [fcmanual=${withval}], [fcmanual=yes])
891 AM_CONDITIONAL([FCMANUAL], [test "x$fcmanual" = "xyes"])
893 dnl freeciv-modpack checks
894 AC_ARG_ENABLE([fcmp],
895 AS_HELP_STRING([--enable-fcmp=no/yes/gtk2/gtk3/qt/cli/all/auto], [build freeciv-modpack-program [auto]]),
896 [fc_mp=${enableval}],
905 if test "x$fc_mp" = "xcli" ; then
906 dnl Only cli requested -> no gui needed
910 for mp in $(echo $fc_mp | $SED 's/,/ /g') ; do
911 if test "x$mp" = "xno" ; then
913 elif test "x$mp" = "xauto" || test "x$mp" = "xyes" ; then
915 elif test "x$mp" = "xall" ; then
917 else if test "x$mp" = "xgtk2" ||
918 test "x$mp" = "xgtk2.0" ||
919 test "x$mp" = "xgtk20" ||
920 test "x$mp" = "xgtk-2.0" ; then
922 elif test "x$mp" = "xgtk3" ||
923 test "x$mp" = "xgtk3.0" ||
924 test "x$mp" = "xgtk30" ||
925 test "x$mp" = "xgtk-3.0" ; then
927 elif test "x$mp" = "xqt" ; then
929 elif test "x$mp" = "xcli" ; then
931 elif test "x$mp" != "xyes" ; then
932 AC_MSG_ERROR([bad value ${mp} for --enable-fcmp])
937 if test "x$req_fcmp_gtk2" = "xyes" ||
938 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
939 AM_PATH_GTK_2_0([2.12.0],
941 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
944 fcmp_list="$fcmp_list gtk2"
945 mp_gtk2_cflags="$GTK2_CFLAGS $GTHREAD_CFLAGS"
946 mp_gtk2_libs="$GTK2_LIBS $GTHREAD_LIBS"
947 if test "x$MINGW32" = "xyes"; then
948 dnl Required to compile gtk2 on Windows platform
949 mp_gtk2_cflags="$mp_gtk2_cflags -mms-bitfields"
950 mp_gtk2_ldflags="$mp_gtk2_ldflags -mwindows"
953 if test "x$modinst" = "xauto" ; then
959 if test "x$req_fcmp_gtk2" = "xyes" && test "x$fcmp_gtk2" != "xyes" ; then
960 AC_MSG_ERROR([Cannot build gtk2-version of freeciv-modpack as requested])
963 if test "x$req_fcmp_gtk3" = "xyes" ||
964 test "x$modinst" = "xall" || test "x$modinst" = "xauto" ; then
965 AM_PATH_GTK_3_0([3.0.0],
967 PKG_CHECK_MODULES([GTHREAD], [gthread-2.0],
970 fcmp_list="$fcmp_list gtk3"
971 mp_gtk3_cflags="$GTK3_CFLAGS $GHTREAD_CFLAGS"
972 mp_gtk3_libs="$GTK3_LIBS $GTHREAD_LIBS"
973 if test "x$MINGW32" = "xyes"; then
974 dnl Required to compile gtk3 on Windows platform
975 mp_gtk3_cflags="$mp_gtk3_cflags -mms-bitfields"
976 mp_gtk3_ldflags="$mp_gtk3_ldflags -mwindows"
979 if test "x$modinst" = "xauto" ; then
985 if test "x$req_fcmp_gtk3" = "xyes" && test "x$fcmp_gtk3" != "xyes" ; then
986 AC_MSG_ERROR([Cannot build gtk3-version of freeciv-modpack as requested])
989 if test "x$req_fcmp_qt" = "xyes" ||
990 test "x$modinst" = "xauto" || test "x$modinst" = "xall" ; then
992 if test "x$cxx_works" = "xyes" ; then
995 if test "x$fc_qt5_usable" = "xtrue" ; then
997 fcmp_list="$fcmp_list qt"
999 mp_qt_cppflags=$FC_QT5_CPPFLAGS
1000 mp_qt_cxxflags=$FC_QT5_CXXFLAGS
1001 mp_qt_libs=$FC_QT5_LIBS
1003 if test "x$modinst" = "xauto" ; then
1011 if test "x$req_fcmp_qt" = "xyes" && test "x$fcmp_qt" != "xyes" ; then
1012 AC_MSG_ERROR([Cannot build Qt-version of freeciv-modpack as requested])
1015 dnl Cli does not satisfy --enable-fcmp=auto as it's not an gui.
1016 if test "x$req_fcmp_cli" = "xyes" || test "x$modinst" = "xall" ; then
1018 fcmp_list="$fcmp_list cli"
1021 if test "x$modinst" != "xfound" &&
1022 test "x$modinst" != "xno" &&
1023 test "x$modinst" != "xcli" &&
1024 test "x$fcmp_gtk3" != "xyes" &&
1025 test "x$fcmp_gtk2" != "xyes" &&
1026 test "x$fcmp_qt" != "xyes" ;then
1027 AC_MSG_ERROR([Cannot build modpack installer with any gui])
1030 if test "x$modinst" != "xno" && test "x$MINGW32" != "xyes" ; then
1031 dnl Hack to get a run-time icon -- not needed on Windows
1032 mp_gtk2_cflags="$mp_gtk2_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1033 mp_gtk3_cflags="$mp_gtk3_cflags -DMPICON_PATH=\"\\\"$datadir/freeciv/misc/mpicon.png\\\"\""
1036 if test "x$fcmp_list" = "x" ; then
1040 AM_CONDITIONAL([MODINST], [test "x$modinst" != "xno"])
1041 AM_CONDITIONAL([MODINST_GTK3], [test "x$fcmp_gtk3" = "xyes"])
1042 AM_CONDITIONAL([MODINST_GTK2], [test "x$fcmp_gtk2" = "xyes"])
1043 AM_CONDITIONAL([MODINST_QT], [test "x$fcmp_qt" = "xyes"])
1044 AM_CONDITIONAL([MODINST_CLI], [test "x$fcmp_cli" = "xyes"])
1046 AC_SUBST([gui_gtk2_cflags])
1047 AC_SUBST([gui_gtk2_libs])
1048 AC_SUBST([gui_gtk2_ldflags])
1049 AC_SUBST([gui_gtk3_cflags])
1050 AC_SUBST([gui_gtk3_libs])
1051 AC_SUBST([gui_gtk3_ldflags])
1052 AC_SUBST([gui_sdl_cflags])
1053 AC_SUBST([gui_sdl_libs])
1054 AC_SUBST([gui_sdl_ldflags])
1055 AC_SUBST([gui_xaw_cflags])
1056 AC_SUBST([gui_xaw_libs])
1057 AC_SUBST([gui_xaw_ldflags])
1058 AC_SUBST([gui_qt_cppflags])
1059 AC_SUBST([gui_qt_cflags])
1060 AC_SUBST([gui_qt_cxxflags])
1061 AC_SUBST([gui_qt_libs])
1062 AC_SUBST([gui_qt_ldflags])
1063 AC_SUBST([gui_stub_cflags])
1064 AC_SUBST([gui_stub_libs])
1065 AC_SUBST([gui_stub_ldflags])
1066 AC_SUBST([mp_cli_cflags])
1067 AC_SUBST([mp_cli_libs])
1068 AC_SUBST([mp_cli_ldflags])
1069 AC_SUBST([mp_gtk2_cflags])
1070 AC_SUBST([mp_gtk2_libs])
1071 AC_SUBST([mp_gtk2_ldflags])
1072 AC_SUBST([mp_gtk3_cflags])
1073 AC_SUBST([mp_gtk3_libs])
1074 AC_SUBST([mp_gtk3_ldflags])
1075 AC_SUBST([mp_qt_cppflags])
1076 AC_SUBST([mp_qt_cxxflags])
1077 AC_SUBST([mp_qt_libs])
1078 AC_SUBST([SOUND_CFLAGS])
1079 AC_SUBST([SOUND_LIBS])
1080 AC_SUBST([VERSION_WITHOUT_LABEL])
1081 AC_SUBST([VERSION_LABEL])
1082 AC_SUBST([HOST_PATH_SEPARATOR])
1083 AM_CONDITIONAL(AUDIO_SDL, test "x$SDL_mixer" != "xno")
1084 AM_CONDITIONAL(CLIENT_GUI_SDL, test "x$gui_sdl" = "xyes")
1085 AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "x$gui_gtk2" = "xyes")
1086 AM_CONDITIONAL(CLIENT_GUI_GTK_3_0, test "x$gui_gtk3" = "xyes")
1087 AM_CONDITIONAL(CLIENT_GUI_XAW, test "x$gui_xaw" = "xyes")
1088 AM_CONDITIONAL(CLIENT_GUI_QT, test "x$gui_qt" = "xyes")
1089 AM_CONDITIONAL(CLIENT_GUI_STUB, test "x$gui_stub" = "xyes")
1090 AM_CONDITIONAL(MINGW32, test x"$MINGW32" = "xyes")
1092 dnl Additional client libraries:
1093 if test "x$client" = "xyes"; then
1095 AC_SUBST(CLIENT_LIBS)
1098 dnl Checks for additional server libraries:
1099 if test "x$server" = "xyes"; then
1100 SERVER_LIBS="-lm ${SERVER_LIBS}"
1102 dnl Some systems (e.g., BeOS) need this lib
1103 AC_CHECK_LIB(bind, gethostbyaddr, SERVER_LIBS="-lbind $SERVER_LIBS")
1105 dnl Readline library and header files.
1107 AC_SUBST([SERVER_LIBS])
1108 AC_SUBST([SRV_LIB_LIBS])
1111 AC_CHECK_LIB(nls,main)
1113 dnl Checks for header files.
1116 AC_CHECK_HEADERS([fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \
1117 sys/file.h libintl.h signal.h strings.h execinfo.h \
1120 dnl Avoid including the unix emulation layer if we build mingw executables
1121 dnl There would be type conflicts between winsock and bsd/unix includes
1122 if test "x$MINGW32" != "xyes"; then
1123 AC_CHECK_HEADERS(arpa/inet.h netdb.h netinet/in.h pwd.h sys/ioctl.h \
1124 sys/select.h sys/signal.h sys/socket.h sys/termio.h \
1125 sys/uio.h termios.h)
1127 if test "x$gui_xaw" = "xyes" ; then
1128 dnl Want to get appropriate -I flags:
1129 fc_save_CPPFLAGS="$CPPFLAGS"
1130 CPPFLAGS="$CPPFLAGS $gui_xaw_cflags"
1131 AC_CHECK_HEADER(X11/xpm.h, ,
1132 AC_MSG_ERROR(need X11/xpm.h header; perhaps try/adjust --with-xpm-include))
1133 CPPFLAGS="$fc_save_CPPFLAGS"
1136 dnl Checks for typedefs, structures, and compiler characteristics.
1140 AC_CHECK_TYPES(socklen_t, [], [],
1141 [#include <sys/types.h>
1142 #include <sys/socket.h>
1145 dnl Headers that might contain the intptr_t definition found earlier
1146 AC_CHECK_HEADERS([inttypes.h stdint.h])
1148 dnl Checks for library functions.
1153 dnl Windows vsnprintf doesn't support argument reordering (see PR#12932)
1154 if test "x$MINGW32" != "xyes"; then
1156 AC_CHECK_FUNCS([vsnprintf])
1159 AC_CHECK_FUNCS([bind connect fileno flock ftime gethostbyname gethostname \
1160 getpwuid inet_aton select snooze strcasecmp strcasestr \
1161 strerror strlcat strlcpy strncasecmp strstr uname usleep \
1162 getline _strcoll stricoll _stricoll strcasecoll getaddrinfo \
1165 AC_MSG_CHECKING(for working gettimeofday)
1166 FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE([HAVE_GETTIMEOFDAY], [1],
1167 [Define if the gettimeofday function works and is sane.]),)
1169 dnl Check for extra socket libraries.
1170 dnl If the AC_CHECK_FUNCS check finds the function, we don't look any
1171 dnl further. This is rumoured to prevent choosing the wrong libs on IRIX.
1172 if test $ac_cv_func_gethostbyname = no; then
1173 AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS")
1175 if test $ac_cv_func_connect = no; then
1176 AC_CHECK_LIB(socket, connect, LIBS="-lsocket $LIBS")
1178 if test $ac_cv_func_bind = no; then
1179 AC_CHECK_LIB(bind, gethostbyaddr, LIBS="-lbind $LIBS")
1182 dnl The use of both AC_FUNC_VSNPRINTF and AC_CHECK_FUNCS(vsnprintf) is
1185 dnl Windows fdopen does not work with sockets.
1186 if test "x$MINGW32" != "xyes"; then
1187 AC_CHECK_FUNCS(fdopen)
1190 dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated
1191 dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS,
1192 dnl and not in LIBS.
1194 dnl Now check if non blocking sockets are possible
1195 dnl (if fcntl or ioctl exists)
1197 AC_CHECK_FUNC([fcntl],
1198 [AC_DEFINE([HAVE_FCNTL], [1], [fcntl support])
1199 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])],
1200 [AC_CHECK_FUNC([ioctl],
1201 [AC_DEFINE([HAVE_IOCTL], [1], [ioctl support])
1202 AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])])])
1204 dnl Checks if SIGPIPE is usable
1205 AC_MSG_CHECKING([for SIGPIPE])
1206 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[signal (SIGPIPE, SIG_IGN)]])],[AC_MSG_RESULT([yes])
1207 AC_DEFINE([HAVE_SIGPIPE], [1], [sigpipe support])],[AC_MSG_RESULT([no])])
1209 dnl export where the datadir is going to be installed
1210 FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
1212 if test x"$MINGW32" = xyes; then
1213 DEFAULT_SAVE_PATH=".;~/.freeciv/saves"
1214 if test x$crosser = xyes ; then
1215 FC_CONF_PATH="../etc/freeciv"
1216 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv;../share/freeciv"
1217 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios;../share/freeciv/scenarios"
1219 FC_CONF_PATH="etc/freeciv"
1220 DEFAULT_DATA_PATH=".;data;~/.freeciv/$DATASUBDIR;$datadir/freeciv"
1221 DEFAULT_SCENARIO_PATH=".;data/scenarios;~/.freeciv/$DATASUBDIR/scenarios;~/.freeciv/scenarios;$datadir/freeciv/scenarios"
1224 FC_CONF_PATH="$sysconfdir/freeciv"
1225 DEFAULT_DATA_PATH=".:data:~/.freeciv/$DATASUBDIR:$datadir/freeciv"
1226 DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
1227 DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
1229 CPPFLAGS="$CPPFLAGS -DFC_CONF_PATH=\"\\\"$FC_CONF_PATH\\\"\""
1230 CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\""
1231 CPPFLAGS="$CPPFLAGS -DDEFAULT_SAVES_PATH=\"\\\"$DEFAULT_SAVES_PATH\\\"\""
1232 CPPFLAGS="$CPPFLAGS -DDEFAULT_SCENARIO_PATH=\"\\\"$DEFAULT_SCENARIO_PATH\\\"\""
1234 dnl This has to be last library
1235 if test -n "$WITH_EFENCE"; then
1236 AC_CHECK_LIB(efence, malloc, [
1237 if test "x$LIBS" = "x"; then
1240 LIBS="$LIBS -lefence"
1244 dnl Checks needed for Lua. Get rid of these if system lua is ever used.
1246 if test x$gl_cv_func_working_mkstemp = xyes ; then
1247 AC_DEFINE([HAVE_MKSTEMP], [1], [Have working mkstemp])
1249 AC_CHECK_FUNCS([isatty popen _longjmp _setjmp])
1251 AC_ARG_ENABLE([sys-lua],
1252 AS_HELP_STRING([--enable-sys-lua], [use lua from system instead of one from freeciv tree [false]]),
1253 [case "${enableval}" in
1260 *) AC_MSG_ERROR([bad value ${enableval} for --enable-sys-lua]) ;;
1261 esac], [sys_lua=false])
1263 dnl There's wide divergence on what the pkg-config file for Lua is called
1264 dnl See http://lua-users.org/lists/lua-l/2008-09/msg00184.html
1265 if test "x$sys_lua" = "xtrue" || test "x$sys_lua" = "xtest" ; then
1266 PKG_CHECK_MODULES([LUA], [lua5.2], [sys_lua=true],
1267 [PKG_CHECK_MODULES([LUA], [lua-5.2], [sys_lua=true],
1268 [PKG_CHECK_MODULES([LUA], [lua >= 5.2 lua < 5.3], [sys_lua=true],
1269 [if test "x$sys_lua" = "xtrue" ; then
1270 AC_MSG_ERROR([Use of included lua disabled, and no lua found from system])
1272 feature_syslua=missing
1276 if test "x$sys_lua" = "xfalse" ; then
1277 LUA_CFLAGS="-I\$(top_srcdir)/dependencies/lua-5.2/src"
1278 LUA_LIBS="\$(top_builddir)/dependencies/lua-5.2/src/liblua.la"
1281 AC_SUBST([LUA_CFLAGS])
1282 AC_SUBST([LUA_LIBS])
1283 AM_CONDITIONAL([SYS_LUA], [test "x$sys_lua" = "xtrue"])
1285 if test x$enable_fcdb = xyes ; then
1286 LUASQL_CFLAGS="-I\$(top_srcdir)/dependencies/luasql/src"
1287 LUASQL_LIBS="\$(top_builddir)/dependencies/luasql/src/libluasql_base.la"
1288 if test x$fcdb_mysql = xyes ; then
1289 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_mysql.la"
1291 if test x$fcdb_postgres = xyes ; then
1292 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_postgres.la"
1294 if test x$fcdb_sqlite3 = xyes ; then
1295 LUASQL_LIBS="$LUASQL_LIBS \$(top_builddir)/dependencies/luasql/src/libluasql_sqlite3.la"
1297 LUASQL_AS_DEPENDENCY="$LUASQL_LIBS"
1298 LUASQL_LIBS="$LUASQL_LIBS $FCDB_MYSQL_LIBS $FCDB_POSTGRES_LIBS $FCDB_SQLITE3_LIBS"
1300 AC_SUBST([LUASQL_CFLAGS])
1301 AC_SUBST([LUASQL_LIBS])
1302 AC_SUBST([LUASQL_AS_DEPENDENCY])
1305 TOLUA_CFLAGS="-I\$(top_srcdir)/dependencies/tolua-5.2/include"
1306 TOLUA_LIBS="\$(top_builddir)/dependencies/tolua-5.2/src/lib/libtolua.la"
1307 AC_SUBST([TOLUA_CFLAGS])
1308 AC_SUBST([TOLUA_LIBS])
1310 TOLUA="\$(top_builddir)/dependencies/tolua-5.2/src/bin/tolua$EXEEXT"
1313 dnl Freeciv uses a non-standard macro, Q_(), to handle cases of qualified
1314 dnl translatable strings and macro PL_() to handle plural forms.
1315 dnl Since the Gettext supplied Autoconf support
1316 dnl doesn't seem to have a way to add new keywords to its xgettext call,
1317 dnl we do the following.
1318 dnl The Gettext supplied Autoconf support starts with
1319 dnl 'translations/<domain>/Makefile.in.in', and builds
1320 dnl 'translations/<domain>/Makefile.in' then 'translations/<domain>/Makefile'.
1321 dnl In order for the commonly used _() and N_() macros to work, there
1322 dnl should be somewhere in that 'translations/<domain>/Makefile' a call
1323 dnl to xgettext with "--keyword=_" and "--keyword=N_" as arguments.
1324 dnl To support Q_() and PL_(), the following simply replaces instances of
1325 dnl "--keyword=N_" with "--keyword=N_ --keyword=Q_ --keyword=PL_:1,2"
1326 dnl in the 'translations/<domain>/Makefile' file.
1327 AC_CONFIG_COMMANDS([fc_default-1],[[for domain in $PODOMAINS ; do
1328 if test -f translations/${domain}/Makefile ; then
1329 if grep 'keyword=N_ --keyword=Q_ --keyword=PL_:1,2' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1330 # has already been extended
1333 echo extending translations/${domain}/Makefile
1334 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1335 sed -e 's/--keyword=N_/--keyword=N_ --keyword=Q_ --keyword=PL_:1,2/g' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1336 rm translations/${domain}/Makefile.tmp
1339 done]],[PODOMAINS="$PODOMAINS"])
1341 dnl Vast quantities of meaningless errors from xgettext is also annoying.
1342 dnl We fix this by forcing xgettext to assume all files are C source files.
1343 AC_CONFIG_COMMANDS([fc_default-2],[[for domain in $PODOMAINS ; do
1344 if test -f translations/freeciv/Makefile ; then
1345 if grep 'language=C --files-from=\$(srcdir)/POTFILES.in' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1346 # has already been silenced
1349 echo silencing translations/${domain}/Makefile
1350 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1351 sed -e 's/--files-from=$(srcdir)\/POTFILES.in/--language=C --files-from=$(srcdir)\/POTFILES.in/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1352 rm translations/${domain}/Makefile.tmp
1355 done]],[PODOMAINS="$PODOMAINS"])
1357 dnl Most of the C comments copied to freeciv.pot are spurious;
1358 dnl change to only copy those with prefix "TRANS:"
1359 dnl Also add --escape to the arguments to convert extended
1360 dnl characters to escape characters.
1361 AC_CONFIG_COMMANDS([fc_default-4],[[for domain in $PODOMAINS ; do
1362 if test -f translations/${domain}/Makefile ; then
1363 if grep 'add-comments="TRANS:" --escape' translations/${domain}/Makefile >/dev/null 2>&1 ; then
1364 # has already been modified
1367 echo modifying translations/${domain}/Makefile add-comments/escape
1368 mv -f translations/${domain}/Makefile translations/${domain}/Makefile.tmp
1369 sed -e 's/add-comments/add-comments="TRANS:" --escape/' translations/${domain}/Makefile.tmp > translations/${domain}/Makefile
1370 rm translations/${domain}/Makefile.tmp
1373 done]],[PODOMAINS="$PODOMAINS"])
1375 dnl The BeOS sys/uio.h is broken. This kludges it out of existence.
1376 dnl (This still causes lots of spurious changes to fc_config.h on BeOS.)
1377 AC_CONFIG_COMMANDS([fc_default-5],[[if test x`uname -s` = xBeOS ; then
1378 if grep '#define HAVE_SYS_UIO_H 1' fc_config.h >/dev/null 2>&1 ; then
1379 echo kluging fc_config.h
1380 mv -f fc_config.h fc_config.h.tmp
1381 sed -e 's/#define HAVE_SYS_UIO_H 1/#undef HAVE_SYS_UIO_H/g' fc_config.h.tmp > fc_config.h
1386 CFLAGS="$EXTRA_DEBUG_CFLAGS $CFLAGS"
1387 CXXFLAGS="$EXTRA_DEBUG_CXXFLAGS $CXXFLAGS"
1388 LDFLAGS="$EXTRA_DEBUG_LDFLAGS $LDFLAGS"
1390 dnl Rebuild 'configure' whenever fc_version changes, if maintainer mode enabled.
1391 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/fc_version"])
1393 dnl Make sure that fc_config.h changes when ever CPPFLAGS, CFLAGS or CXXFLAGS
1394 dnl change so everything gets rebuilt. LDFLAGS is not handled here
1395 dnl since change in it should not cause recompilation, only relinking.
1396 dnl Note: Variables are named FC_STORE_* instead of FC_*_STORE in order to
1397 dnl make them appear next to each other in fc_config.h. Also single-quotes are
1398 dnl used because some " may appear unescaped within the flag strings.
1399 AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ['$CPPFLAGS'],
1400 [These are the CPPFLAGS used in compilation])
1401 AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ['$CFLAGS'],
1402 [These are the CFLAGS used in compilation])
1403 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'],
1404 [These are the CXXFLAGS used in compilation])
1406 AC_CONFIG_FILES([Makefile
1412 data/amplio2/Makefile
1413 data/buildings/Makefile
1416 data/cimpletoon/Makefile
1417 data/trident/Makefile
1418 data/isophex/Makefile
1419 data/isotrident/Makefile
1420 data/stdsounds/Makefile
1421 data/default/Makefile
1422 data/classic/Makefile
1423 data/multiplayer/Makefile
1424 data/experimental/Makefile
1425 data/civ2civ3/Makefile
1428 data/scenarios/Makefile
1429 data/nation/Makefile
1430 data/themes/Makefile
1431 data/themes/gui-gtk-2.0/Makefile
1432 data/themes/gui-gtk-2.0/Freeciv/Makefile
1433 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Makefile
1434 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Arrows/Makefile
1435 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Buttons/Makefile
1436 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Check-Radio/Makefile
1437 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Combo/Makefile
1438 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Frame-Gap/Makefile
1439 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Handles/Makefile
1440 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Lines/Makefile
1441 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ListHeaders/Makefile
1442 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Menu-Menubar/Makefile
1443 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Others/Makefile
1444 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Panel/Makefile
1445 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ProgressBar/Makefile
1446 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Range/Makefile
1447 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Scrollbars/Makefile
1448 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Shadows/Makefile
1449 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Spin/Makefile
1450 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Tabs/Makefile
1451 data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Toolbar/Makefile
1452 data/themes/gui-gtk-3.0/Makefile
1453 data/themes/gui-gtk-3.0/Freeciv/Makefile
1454 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Makefile
1455 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Arrows/Makefile
1456 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Buttons/Makefile
1457 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Check-Radio/Makefile
1458 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Combo/Makefile
1459 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Frame-Gap/Makefile
1460 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Handles/Makefile
1461 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Lines/Makefile
1462 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ListHeaders/Makefile
1463 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Menu-Menubar/Makefile
1464 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Others/Makefile
1465 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Panel/Makefile
1466 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/ProgressBar/Makefile
1467 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Range/Makefile
1468 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Scrollbars/Makefile
1469 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Shadows/Makefile
1470 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Spin/Makefile
1471 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Tabs/Makefile
1472 data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/Toolbar/Makefile
1473 data/themes/gui-qt/Makefile
1474 data/themes/gui-qt/icons/Makefile
1475 data/themes/gui-sdl/Makefile
1476 data/themes/gui-sdl/human/Makefile
1477 data/wonders/Makefile
1480 dependencies/Makefile
1481 dependencies/lua-5.2/Makefile
1482 dependencies/lua-5.2/src/Makefile
1483 dependencies/tolua-5.2/Makefile
1484 dependencies/tolua-5.2/src/Makefile
1485 dependencies/tolua-5.2/src/lib/Makefile
1486 dependencies/tolua-5.2/src/bin/Makefile
1487 dependencies/luasql/Makefile
1488 dependencies/luasql/src/Makefile
1489 dependencies/cvercmp/Makefile
1491 common/aicore/Makefile
1492 common/scriptcore/Makefile
1497 ai/threaded/Makefile
1501 client/agents/Makefile
1502 client/include/Makefile
1503 client/gui-sdl/Makefile
1504 client/gui-gtk-2.0/Makefile
1505 client/gui-gtk-3.0/Makefile
1506 client/gui-xaw/Makefile
1507 client/gui-qt/Makefile
1508 client/gui-stub/Makefile
1509 client/luascript/Makefile
1511 server/advisors/Makefile
1512 server/generator/Makefile
1513 server/scripting/Makefile
1515 translations/Makefile
1516 translations/freeciv/Makefile.in
1517 translations/nations/Makefile.in
1520 doc/man/freeciv-client.6
1521 doc/man/freeciv-server.6
1522 doc/man/freeciv-manual.6
1523 doc/man/freeciv-modpack.6
1531 freeciv.spec:bootstrap/freeciv.spec.in
1533 client/freeciv.desktop:bootstrap/freeciv.desktop.in
1534 client/freeciv-gtk2.desktop:bootstrap/freeciv-gtk2.desktop.in
1535 client/freeciv-sdl.desktop:bootstrap/freeciv-sdl.desktop.in
1536 client/freeciv-qt.desktop:bootstrap/freeciv-qt.desktop.in
1537 server/freeciv-server.desktop:bootstrap/freeciv-server.desktop.in
1538 tools/freeciv-mp-gtk2.desktop:bootstrap/freeciv-mp-gtk2.desktop.in
1539 tools/freeciv-mp-gtk3.desktop:bootstrap/freeciv-mp-gtk3.desktop.in
1540 tools/freeciv-mp-qt.desktop:bootstrap/freeciv-mp-qt.desktop.in
1541 client/freeciv-gtk2.appdata.xml:bootstrap/freeciv-gtk2.appdata.xml.in
1542 client/freeciv-gtk3.appdata.xml:bootstrap/freeciv-gtk3.appdata.xml.in
1543 client/freeciv-sdl.appdata.xml:bootstrap/freeciv-sdl.appdata.xml.in
1544 client/freeciv-qt.appdata.xml:bootstrap/freeciv-qt.appdata.xml.in
1545 server/freeciv-server.appdata.xml:bootstrap/freeciv-server.appdata.xml.in
1546 tools/freeciv-mp-gtk2.appdata.xml:bootstrap/freeciv-mp-gtk2.appdata.xml.in
1547 tools/freeciv-mp-gtk3.appdata.xml:bootstrap/freeciv-mp-gtk3.appdata.xml.in
1548 tools/freeciv-mp-qt.appdata.xml:bootstrap/freeciv-mp-qt.appdata.xml.in])
1549 AC_CONFIG_FILES([fcgui:bootstrap/fcgui.in], [chmod +x fcgui])
1550 AC_CONFIG_FILES([fcser:bootstrap/fcser.in], [chmod +x fcser])
1552 if test "$USE_NLS" != "yes" ; then
1554 dnl Produced config.status will have constant value of FORCE_DIST,
1555 dnl but it still checks 'if test x$FORCE_DIST = xyes'. We cannot
1556 dnl do that check in configure when producing config.status.
1557 AC_CONFIG_COMMANDS([translations/freeciv/Makefile], [
1558 for domain in $PODOMAINS ; do
1559 dnl Usually glib-gettext.m4:AM_GLIB_GNU_GETTEXT outputs commands to
1560 dnl generate translations/${domain}/Makefile.
1561 dnl If NLS is disabled, we generate one here.
1562 rm -f translations/${domain}/Makefile
1564 dnl - Add nonls_warn as dependency to dist -target
1565 dnl - Remove dependencies from update-po, so it is never rebuilt
1566 dnl - Set list of distributed files (no generated files)
1567 sed -e 's/^dist distdir:.*/dist distdir: nonls_warn/' \
1568 -e 's/^update-po:.*/update-po:/' \
1569 -e 's/^DISTFILES =.*/DISTFILES = Makefile.in.in POTFILES.in POTFILES.skip \$(POFILES)/' \
1570 translations/${domain}/Makefile.in > translations/${domain}/Makefile
1572 dnl Create nonls_warn target.
1573 echo >> translations/${domain}/Makefile
1574 echo nonls_warn: >> translations/${domain}/Makefile
1575 if test "x$FORCE_DIST" = "xyes" ; then
1576 echo " @echo Building dist without generated localization files!" >> translations/${domain}/Makefile
1578 echo " @echo Cannot build dist with NLS disabled! && /bin/false" >> translations/${domain}/Makefile
1581 ], [FORCE_DIST=$FORCE_DIST
1582 PODOMAINS="$PODOMAINS"])
1588 ****************** Configuration Summary ******************
1590 == General build options ==
1591 Shared libraries: $enable_shared
1592 Debugging support: $enable_debug
1593 Profiling support: $enable_gprof
1594 IPv6 support: $enable_ipv6
1595 Map image toolkits: $enable_mapimg
1597 MagickWand: $mapimg_magickwand
1600 Build freeciv client: $client
1602 Maintained client frontends:
1609 Not maintained client frontends:
1613 Build freeciv server: $server
1614 AI modules support: $enable_aimodules
1615 Database support: $enable_fcdb
1617 postgres: $fcdb_postgres
1618 sqlite3: $fcdb_sqlite3
1621 Modpack installers: $fcmp_list
1622 Manual generator: $fcmanual