dnl configure.ac for freeciv, for use with autoconf 2.50+ dnl Process this file with autoconf to produce a configure script. dnl Initialize with some random file to ensure the source is here. AC_INIT AC_PREREQ(2.55) AC_CONFIG_SRCDIR([common/game.c]) AC_CONFIG_AUX_DIR(bootstrap) # This can't be quoted or automake will fail AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST AC_GNU_SOURCE PACKAGE=freeciv AC_DEFINE(FC_CONFIG_H, 1, [Configuration autogenerated]) AC_DEFINE(BUG_URL, "http://bugs.freeciv.org/", [Bug reporting URL]) m4_include([m4/version.m4]) dnl no=do not compile server, yes=compile server, *=error AC_ARG_ENABLE(server, [ --disable-server do not compile the server], [case "${enableval}" in yes) server=true ;; no) server=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --disable-server) ;; esac], [server=true]) AM_CONDITIONAL(SERVER, test x$server = xtrue) AC_ARG_WITH(readline, [ --with-readline support fancy command line editing], WITH_READLINE=$withval, dnl yes/no - required to use / never use WITH_READLINE="maybe" dnl maybe - use if found [default] ) dnl no=do not compile client, yes=guess it, *=use this client or error AC_ARG_ENABLE(client, [ --enable-client[=no/yes/xaw3d/xaw/gtk/win32/sdl/ftwl/warclient] compile a client [default=yes] (if yes, guess type)], [case "${enableval}" in yes) client=yes ;; no) client=no ;; xaw3d) client=xaw WITH_XAW3D=1 ;; ftwl) client=ftwl ;; gtk) client=gtk-2.0 ;; gtk2) client=gtk-2.0 ;; gtk2.0) client=gtk-2.0 ;; gtk20) client=gtk-2.0 ;; warclient) client=warclient-gtk-2.0 ;; *) client="${enableval}" if test ! -d "${srcdir}/client/gui-$client" ; then AC_MSG_ERROR(bad value ${enableval} for --enable-client) fi ;; esac], [client=yes]) AM_CONDITIONAL(CLIENT, test x$client != xno) AC_ARG_ENABLE(warclient, [ --enable-warclient Enable Warclient Patch for server (If client warclient is asked this option is enable by default)], [with_warclient=true], [with_warclient=false] ) if ( test x$with_warclient = xtrue && test x$server = xtrue && test x$client = xno ) || ( test "$client" = warclient-gtk-2.0 ) ; then with_warclient=true AC_DEFINE(WARCLIENT, 1, [Warclient patch enabled]) elif ( test x$with_warclient = xtrue && test "$client" != warclient-gtk-2.0 ) ; then AC_MSG_ERROR( --enable-warclient can only be used with --enable-client=no ; with --enable-client=warclient this option is enable by default ) fi if test x$with_warclient = xtrue ; then cp -f common/packets.def.warclient common/packets.def cp -f version.in.warclient version.in dnl client/server should always have the same major and minor versions dnl different patch versions are compatible m4_include(version.in.warclient) else cp -f common/packets.def.freeciv common/packets.def cp -f version.in.freeciv version.in dnl client/server should always have the same major and minor versions dnl different patch versions are compatible m4_include(version.in.freeciv) fi VERSION_WITHOUT_LABEL=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION} VERSION=${VERSION_WITHOUT_LABEL}${VERSION_LABEL} dnl Similar to following are already done by AM_INIT_AUTOMAKE: dnl (but different in terms of producing quoted vs bare strings) dnl AC_DEFINE_UNQUOTED(PACKAGE, $PACKAGE, [Package name]) dnl AC_DEFINE_UNQUOTED(VERSION, $VERSION, [Version number]) dnl AC_SUBST(VERSION) AC_DEFINE_UNQUOTED([MAJOR_VERSION], [$MAJOR_VERSION], [Major version]) AC_DEFINE_UNQUOTED([MINOR_VERSION], [$MINOR_VERSION], [Minor version]) AC_DEFINE_UNQUOTED([PATCH_VERSION], [$PATCH_VERSION], [Patch version]) AC_DEFINE_UNQUOTED([VERSION_LABEL], ["${VERSION_LABEL}"], [Version label]) AC_DEFINE_UNQUOTED([VERSION_STRING], ["${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${VERSION_LABEL}"], [Version string]) AC_DEFINE_UNQUOTED([IS_DEVEL_VERSION], [$IS_DEVEL_VERSION], [Is this a devel version]) AC_DEFINE_UNQUOTED([IS_BETA_VERSION], [$IS_BETA_VERSION], [Is this a beta version]) AC_DEFINE_UNQUOTED([NEXT_STABLE_VERSION], ["$NEXT_STABLE_VERSION"], [Version number of next release]) AC_DEFINE_UNQUOTED([RELEASE_MONTH], [$RELEASE_MONTH], [Month next version will be released]) AC_SUBST([MAJOR_VERSION]) AC_SUBST([MINOR_VERSION]) AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_MANDATORY], ["$NETWORK_CAPSTRING_MANDATORY"], [Network capability string]) AC_SUBST([NETWORK_CAPSTRING_MANDATORY]) AC_DEFINE_UNQUOTED([NETWORK_CAPSTRING_OPTIONAL], ["$NETWORK_CAPSTRING_OPTIONAL"], [Additional optional network capabilities]) AC_SUBST([NETWORK_CAPSTRING_OPTIONAL]) dnl Initialize automake stuff AM_INIT_AUTOMAKE($PACKAGE, $VERSION) AM_MAINTAINER_MODE dnl checks for mysql, sets AUTH_LIBS, AUTH_CFLAGS FC_CHECK_AUTH dnl You MUST build ftwl to use the ftwl client AC_ARG_ENABLE(ftwl, [ --enable-ftwl[=no/x11/sdl/opengl] compile ftwl [default=no]], [case "${enableval}" in x11) ftwl=x11 ;; sdl) ftwl=sdl ;; opengl) ftwl=opengl ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-ftwl) ;; esac], [ftwl=no]) AM_CONDITIONAL(FTWL, test x$ftwl != xno) if test "$ftwl" = no && test "$client" = ftwl ; then AC_MSG_ERROR(You must use --enable-ftwl to use the ftwl client) fi AC_ARG_WITH(xaw, [ --with-xaw use the Xaw widget set for the xaw client], WITH_XAW=1 ) AC_ARG_WITH(xaw3d, [ --with-xaw3d use the Xaw3d widget set for the xaw client], WITH_XAW3D=1 ) AC_ARG_ENABLE(make_data, [ --disable-make-data do not recurse make into data directories (ok to disable unless you will 'make install')], [case "${enableval}" in yes) make_data=true ;; no) make_data=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --disable-make-data) ;; esac], [make_data=true]) AM_CONDITIONAL(MAKE_DATA, test x$make_data = xtrue) AC_ARG_ENABLE(make_include, [ --enable-make-include force make to recurse into include directory (useful for 'make tags')], [case "${enableval}" in yes) make_include=true ;; no) make_include=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-make-include) ;; esac], [make_include=false]) AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test "$make_include" = "true") AC_ARG_ENABLE([auto_deps], [ --disable-auto-deps remove automatic deps calcs, which require gmake,gcc], [case "${enableval}" in yes) enable_auto_deps=true ;; no) enable_auto_deps=false;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-auto-deps]) ;; esac], [enable_auto_deps="maybe"]) AUTO_DEPS=$enable_auto_deps AC_ARG_WITH(efence, [ --with-efence use Electric Fence, malloc debugger ], WITH_EFENCE=1 ) dnl Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AC_PROG_LN_S AC_PROG_RANLIB AC_CHECK_TOOL(AR, ar) if test -z $AR; then AC_MSG_ERROR([*** 'ar' missing. Install binutils, fix your \$PATH, or set \$AR manually. ***]) fi AC_CHECK_PROG(UNAME,uname,uname,:) dnl Programs already checked by AM_INIT_AUTOMAKE: dnl AC_PROG_MAKE_SET dnl Check for libiconv (which is usually included in glibc, but may be dnl distributed separately). The libcharset check must come after the dnl iconv check. This whole thing must come before the gettext check below. AM_ICONV AM_LIBCHARSET AM_LANGINFO_CODESET if test "$am_cv_func_iconv" != yes; then AC_MSG_ERROR([Iconv is missing. You can get libiconv from http://gnu.org/, \ or try using --with-libiconv-prefix.]) fi LIBS="$LIBS $LIBICONV" dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we dnl have to define it here, so that it can be used in po/Makefile. dnl You cannot use localedir above this line or it will fail for old ac's. if test -z "$localedir"; then localedir="$datadir/locale" AC_SUBST(localedir) fi dnl I18n support ALL_LINGUAS="ar cs ca da de el en_GB eo es et fa fi fr he hu it ja ko lt nl nb no pl pt pt_BR ro ru sv tr uk zh_CN" AM_GNU_GETTEXT(,need-ngettext) dnl AM_GNU_GETTEXT doesn't have all features we want dnl or they don't behave correctly. dnl Old gettext binaries don't understand plurals. (ngettext, msgid_plural) dnl and there are some problems with missing ngettext. if test "$USE_NLS" = "yes"; then dnl nls_cv_force_use_gnu_gettext is set by AM_GNU_GETTEXT dnl it is "yes" when --with-included-gettext is given if test "$nls_cv_force_use_gnu_gettext" != "yes"; then have_working_ngettext=0 AC_CHECK_LIB(c, ngettext, [AC_MSG_CHECKING(whether libc's ngettext works at runtime) FC_CHECK_NGETTEXT_RUNTIME(,have_working_ngettext=1,)],) if test "$have_working_ngettext" = "0"; then AC_CHECK_LIB(intl, ngettext, [AC_MSG_CHECKING(whether libintl's ngettext works at runtime) FC_CHECK_NGETTEXT_RUNTIME("-lintl",have_working_ngettext=1,)],) fi if test "$have_working_ngettext" = "0"; then AC_MSG_ERROR(I haven't found a working ngettext function in your system. Try --with-included-gettext or --disable-nls. Read ABOUT-NLS.) fi fi if test "$IS_BETA_VERSION" = "1" || test "$IS_DEVEL_VERSION" = "1"; then AC_MSG_CHECKING(for GNU xgettext version >= 0.10.36) xgettext_version=`$XGETTEXT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'` AC_TRY_RUN([ #include const char *version = "$xgettext_version"; int main() { const char *p = version; int major = 0, minor = 0, patch = 0; while (*p != '\0' && (*p < '0' || *p > '9')) { p++; } if (*p == '\0') { return 1; } sscanf(p, "%d.%d.%d", &major, &minor, &patch); if (major < 1 && (minor < 10 || (minor == 10 && patch < 36))) { return 1; } return 0; } ], AC_MSG_RESULT(yes) , [ AC_MSG_RESULT(no) AC_MSG_WARN(You may have problems with creating pox files. \ Please update your gettext package.) ] , echo error ) AC_MSG_CHECKING(for GNU msgfmt version >= 0.10.35) msgfmt_version=`$MSGFMT --version 2>&1 | grep GNU | head -n 1 | sed 's/"/ /g'` AC_TRY_RUN([ #include const char *version = "$msgfmt_version"; int main() { const char *p = version; int major = 0, minor = 0, patch = 0; while (*p != '\0' && (*p < '0' || *p > '9')) { p++; } if (*p == '\0') { return 1; } sscanf(p, "%d.%d.%d", &major, &minor, &patch); if (major < 1 && (minor < 10 || (minor == 10 && patch < 35))) { return 1; } return 0; } ], AC_MSG_RESULT(yes) , [ AC_MSG_RESULT(no) AC_MSG_ERROR(You are unable to create *.gmo files. This is development version which doesn't include them. Please update your gettext package. We recommend you versions >= 0.10.38. Or use --disable-nls instead.) ] , echo error ) fi fi dnl Set debug flags supported by compiler EXTRA_DEBUG_CFLAGS="" EXTRA_DEBUG_CXXFLAGS="" FC_C_FLAGS([-Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations], [], [EXTRA_DEBUG_CFLAGS]) FC_CXX_FLAGS([-Wall -Wpointer-arith -Wcast-align], [], [EXTRA_DEBUG_CXXFLAGS]) FC_DEBUG AC_C99_VARIADIC_MACROS AC_C99_VARIABLE_ARRAYS AC_C99_INITIALIZERS AC_C99_STDINT_H if test "$AUTO_DEPS" = "maybe"; then dnl Should also check for gmake? if test -n "$GCC"; then AUTO_DEPS="yes" else AUTO_DEPS="no" fi fi AC_SUBST([AUTO_DEPS]) dnl BeOS-specific settings if test x`$UNAME -s` = xBeOS ; then AC_DEFINE(SOCKET_ZERO_ISNT_STDIN, 1, [BeOS-specific setting]) CFLAGS="$CFLAGS -Wno-multichar" LDFLAGS="$LDFLAGS -x none" if test x$enable_debug = xyes ; then CFLAGS="$CFLAGS -gdwarf-2" LDFLAGS="$LDFLAGS -gdwarf-2" fi # We used to set ARFLAGS here, but under recent versions of automake this # broke compilation on other systems. Setting ARFLAGS shouldn't be # necessary with a working automake. fi dnl Defaults MINGW32=no AMIGA=no dnl Settings specific to host OS case "$host_os" in *mingw32*) dnl Windows-specific settings MINGW32=yes AC_CHECK_TOOL([WINDRES], [windres]) if test -z $WINDRES; then AC_MSG_ERROR([*** 'windres' missing. Install binutils, fix your \$PATH, or set \$WINDRES manually. ***]) fi AC_DEFINE([SOCKET_ZERO_ISNT_STDIN], [1], [Mingw32-specific setting - stdin]) AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw32]) AC_DEFINE([WIN32_NATIVE], [1], [Mingw32-specific setting - native]) AC_DEFINE([HAVE_WINSOCK], [1], [Mingw32-specific setting - winsock]) AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support]) LIBS="$LIBS -lwsock32" ;; *skyos*) dnl SkyOS specific settings AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - SkyOS]) ;; *amigaos*) AMIGA=yes AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Amiga]) ;; esac dnl note this has to match the path installed by po/Makefile if test x"$MINGW32" != "xyes"; then CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\"\\\"$localedir\\\"\"" else AC_DEFINE_UNQUOTED(LOCALEDIR, "./share/locale", [Locale directory (windows)]) fi dnl Check for zlib (needed for libpng) AC_CHECK_LIB(z, gzgets, , AC_MSG_ERROR([Could not find zlib library.]), ) AC_CHECK_HEADER(zlib.h, , AC_MSG_ERROR([zlib found but not zlib.h. You may need to install a zlib \"development\" package.])) AC_PATH_PROG(GZIP, gzip, "no") if test "$GZIP" = "no"; then AC_MSG_ERROR([You need the gzip program for compilation.]) fi dnl Check and compile ftwl if test "$ftwl" = x11 ; then FTWL_CFLAGS=`freetype-config --cflags` FTWL_LIBS="-L/usr/X11R6/lib -lX11 -lpng "`freetype-config --libs` fi if test "$ftwl" = sdl ; then FTWL_CFLAGS=`sdl-config --cflags`" "`freetype-config --cflags` FTWL_LIBS=`sdl-config --libs`" -lpng "`freetype-config --libs` AC_DEFINE(SDL, 1, [SDL is used]) fi if test "$ftwl" = opengl ; then FTWL_CFLAGS=`sdl-config --cflags`" "`freetype-config --cflags` FTWL_LIBS=`sdl-config --libs`" -lpng "`freetype-config --libs -lGL -lGLU` fi dnl Check and choose clients if test x$client != xno; then dnl if specified --with-xaw or --with-xaw3d, assume --enable-client=xaw if test x$client = xyes; then if test -n "$WITH_XAW" || test -n "$WITH_XAW3D"; then client=xaw fi fi dnl if need to guess client, announce checking if test x$client = xyes; then AS_MESSAGE([checking for which client to compile:...]) fi dnl Gtk-2.0-specific overrides FC_GTK2_CLIENT dnl warclient-Gtk-2.0-specific overrides FC_WARCLIENT_GTK2_CLIENT dnl SDL-specific overrides FC_SDL_CLIENT dnl Xaw-specific overrides FC_XAW_CLIENT if test "$client" = ftwl ; then AC_MSG_CHECKING([will compile gui-ftwl]) AC_MSG_RESULT([yes]) CLIENT_CFLAGS="$CLIENT_CFLAGS $FTWL_CFLAGS" CLIENT_LIBS="$CLIENT_LIBS $FTWL_LIBS" fi dnl BeOS-specific overrides if test "$client" = beos || test "$client" = yes ; then if test x`$UNAME -s` = xBeOS ; then CLIENT_CFLAGS= CLIENT_LIBS="-Lgui-beos/lib -lBdhGame -lBdhDialog -lBdh -ltranslation -lbe -lroot" found_client=yes fi if test "x$found_client" = "xyes"; then client=beos elif test "$client" = "beos"; then AC_MSG_ERROR(specified client 'beos' not configurable) fi fi dnl Win32-specific overrides FC_WIN32_CLIENT dnl Stub-specific overrides if test "$client" = stub ; then found_client=yes if test "x$found_client" = "xyes"; then client=stub CLIENT_LIBS="-lm" elif test "$client" = "stub"; then AC_MSG_ERROR(specified client 'stub' not configurable) fi fi dnl If client still "yes", error out since we couldn't guess it if test "$client" = yes ; then AC_MSG_ERROR(could not guess which client to compile) fi dnl Check for sound support, sets SOUND_CFLAGS, SOUND_LIBS, AUDIO_SDL FC_CHECK_SOUND() gui_sources="gui-$client" fi dnl Check for GGZ if test "$client" = "gtk-2.0" || test "$client" = "warclient-gtk-2.0" ; then AC_GGZ_CHECK("gtk") CLIENT_LIBS="$CLIENT_LIBS $LIB_GGZ_GTK" else AC_GGZ_CHECK fi if test "$ggz_server" = "yes" ; then AC_CHECK_FUNCS([chdir mkdtemp]) fi AC_SUBST(gui_sources) AC_SUBST(CLIENT_CFLAGS) AC_SUBST(CLIENT_CXXFLAGS) AC_SUBST(CLIENT_LIBS) AC_SUBST(CLIENT_LDFLAGS) AC_SUBST(SOUND_CFLAGS) AC_SUBST(SOUND_LIBS) AC_SUBST(FTWL_CFLAGS) AC_SUBST([VERSION_WITHOUT_LABEL]) AC_SUBST([VERSION_LABEL]) AM_CONDITIONAL(AUDIO_SDL, test "x$SDL_mixer" = "xyes") AM_CONDITIONAL(CLIENT_GUI_SDL, test "$gui_sources" = "gui-sdl") AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "$gui_sources" = "gui-gtk-2.0") AM_CONDITIONAL(CLIENT_GUI_XAW, test "$gui_sources" = "gui-xaw") AM_CONDITIONAL(CLIENT_GUI_BEOS, test "$gui_sources" = "gui-beos") AM_CONDITIONAL(CLIENT_GUI_STUB, test "$gui_sources" = "gui-stub") AM_CONDITIONAL(CLIENT_GUI_WIN32, test "$gui_sources" = "gui-win32") AM_CONDITIONAL(CLIENT_GUI_FTWL, test "$gui_sources" = "gui-ftwl") AM_CONDITIONAL(CLIENT_GUI_WARCLIENT_GTK_2_0, test "$gui_sources" = "gui-warclient-gtk-2.0") AM_CONDITIONAL(FTWL, test "$ftwl" != "no") AM_CONDITIONAL(FTWL_X11, test "$ftwl" = "x11") AM_CONDITIONAL(FTWL_SDL, test "$ftwl" = "sdl") AM_CONDITIONAL(FTWL_OPENGL, test "$ftwl" = "opengl") AM_CONDITIONAL(MINGW32, test x"$MINGW32" = "xyes") dnl Checks for additional server libraries: if test x$server = xtrue; then dnl Some systems (e.g., BeOS) need this lib AC_CHECK_LIB(bind, gethostbyaddr, SERVER_LIBS="-lbind $SERVER_LIBS") dnl Readline library and header files. FC_HAS_READLINE() AC_CHECK_FUNC(pow) if test $ac_cv_func_pow = no; then AC_CHECK_LIB(m, pow, SERVER_LIBS="$SERVER_LIBS -lm", AC_MSG_ERROR(Did not find math lib!)) fi fi AC_SUBST(SERVER_LIBS) AC_CHECK_LIB(nls,main) dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h sys/time.h sys/types.h unistd.h sys/utsname.h \ sys/file.h libintl.h signal.h strings.h]) AC_HEADER_STDBOOL dnl Avoid including the unix emulation layer if we build mingw executables dnl There would be type conflicts between winsock and bsd/unix includes if test "x$MINGW32" != "xyes"; then AC_CHECK_HEADERS(arpa/inet.h netdb.h netinet/in.h pwd.h sys/ioctl.h \ sys/select.h sys/signal.h sys/socket.h sys/termio.h \ sys/uio.h termios.h) fi if test x$client = xxaw; then dnl Want to get appropriate -I flags: fc_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $CLIENT_CFLAGS" AC_CHECK_HEADER(X11/xpm.h, , AC_MSG_ERROR(need X11/xpm.h header; perhaps try/adjust --with-xpm-include)) CPPFLAGS="$fc_save_CPPFLAGS" fi dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_HEADER_TIME AC_STRUCT_TM AC_CHECK_TYPES(socklen_t, [], [], [#include #include ]) dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_FORK AC_FUNC_STRCOLL AC_FUNC_VPRINTF dnl Windows vsnprintf doesn't support argument reordering (see PR#12932) if test "x$MINGW32" != "xyes"; then AC_FUNC_VSNPRINTF AC_CHECK_FUNCS([vsnprintf]) fi AC_CHECK_FUNCS([fileno ftime gethostname getpwuid inet_aton \ select snooze strerror strcasecmp strncasecmp \ strlcat strlcpy strstr usleep uname flock \ gethostbyname connect bind getline getpeername]) AC_MSG_CHECKING(for working gettimeofday) FC_CHECK_GETTIMEOFDAY_RUNTIME(,AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Define if the gettimeofday function works and is sane.]),) dnl Check for extra socket libraries. dnl If the AC_CHECK_FUNCS check finds the function, we don't look any dnl further. This is rumoured to prevent choosing the wrong libs on IRIX. if test $ac_cv_func_gethostbyname = no; then AC_CHECK_LIB(nsl, gethostbyname, LIBS="-lnsl $LIBS") fi if test $ac_cv_func_connect = no; then AC_CHECK_LIB(socket, connect, LIBS="-lsocket $LIBS") fi if test $ac_cv_func_bind = no; then AC_CHECK_LIB(bind, gethostbyaddr, LIBS="-lbind $LIBS") fi dnl The use of both AC_FUNC_VSNPRINTF and AC_CHECK_FUNCS(vsnprintf) is dnl deliberate. dnl Windows fdopen does not work with sockets. if test "x$MINGW32" != "xyes"; then AC_CHECK_FUNCS(fdopen) fi dnl We would AC_CHECK_FUNCS for socket as well, except it is complicated dnl by the fact that the -lsocket is in X_EXTRA_LIBS and/or SERVER_LIBS, dnl and not in LIBS. dnl Now check if non blocking sockets are possible dnl (if fcntl or ioctl exists) AC_CHECK_FUNC(fcntl, [AC_DEFINE(HAVE_FCNTL, 1, [fcntl support]) AC_DEFINE(NONBLOCKING_SOCKETS, 1, [nonblocking sockets support])], [AC_CHECK_FUNC(ioctl, [AC_DEFINE(HAVE_IOCTL, 1, [ioctl support]) AC_DEFINE(NONBLOCKING_SOCKETS, 1, [nonblocking sockets support])])]) dnl Checks if SIGPIPE is usable AC_MSG_CHECKING([for SIGPIPE]) AC_TRY_COMPILE([#include ],[signal (SIGPIPE, SIG_IGN)], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_SIGPIPE, 1, [sigpipe support])], [AC_MSG_RESULT([no])]) dnl export where the datadir is going to be installed FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv") if test x"$MINGW32" = xyes; then DEFAULT_DATA_PATH=".;data;~/.freeciv;$datadir/freeciv" else DEFAULT_DATA_PATH=".:data:~/.freeciv:$datadir/freeciv" fi CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\"" dnl This has to be last library if test -n "$WITH_EFENCE"; then AC_CHECK_LIB(efence, malloc, [ if test "x$LIBS" = "x"; then LIBS = -lefence else LIBS="$LIBS -lefence" fi]) fi dnl Freeciv uses a non-standard macro, Q_(), to handle cases of qualified dnl translatable strings and macro PL_() to handle plural forms. dnl Since the Gettext supplied Autoconf support dnl doesn't seem to have a way to add new keywords to its xgettext call, dnl we do the following. dnl The Gettext supplied Autoconf support starts with 'po/Makefile.in.in', dnl and builds 'po/Makefile.in' then 'po/Makefile'. In order for the dnl commonly used _() and N_() macros to work, there should be somewhere dnl in that 'po/Makefile' a call to xgettext with "--keyword=_" and dnl "--keyword=N_" as arguments. To support Q_() and PL_(), dnl the following simply replaces instances of dnl "--keyword=N_" with "--keyword=N_ --keyword=Q_ --keyword=PL_:1,2" dnl in the 'po/Makefile' file. AC_CONFIG_COMMANDS([fc_default-1],[[if test -f po/Makefile ; then if grep 'keyword=N_ --keyword=Q_ --keyword=PL_:1,2' po/Makefile >/dev/null 2>&1 ; then # has already been extended : else echo extending po/Makefile mv -f po/Makefile po/Makefile.tmp sed -e 's/--keyword=N_/--keyword=N_ --keyword=Q_ --keyword=PL_:1,2/g' po/Makefile.tmp > po/Makefile rm po/Makefile.tmp fi fi]],[[]]) dnl Vast quantities of meaningless errors from xgettext is also annoying. dnl We fix this by forcing xgettext to assume all files are C source files. AC_CONFIG_COMMANDS([fc_default-2],[[if test -f po/Makefile ; then if grep 'language=C --files-from=\$(srcdir)/POTFILES.in' po/Makefile >/dev/null 2>&1 ; then # has already been silenced : else echo silencing po/Makefile mv -f po/Makefile po/Makefile.tmp sed -e 's/--files-from=$(srcdir)\/POTFILES.in/--language=C --files-from=$(srcdir)\/POTFILES.in/' po/Makefile.tmp > po/Makefile rm po/Makefile.tmp fi fi]],[[]]) dnl Most of the C comments copied to freeciv.pot are spurious; dnl change to only copy those with prefix "TRANS:" dnl Also add --escape to the arguments to convert extended dnl characters to escape characters. AC_CONFIG_COMMANDS([fc_default-4],[[if test -f po/Makefile ; then if grep 'add-comments="TRANS:" --escape' po/Makefile >/dev/null 2>&1 ; then # has already been modified : else echo modifying po/Makefile add-comments/escape mv -f po/Makefile po/Makefile.tmp sed -e 's/add-comments/add-comments="TRANS:" --escape/' po/Makefile.tmp > po/Makefile rm po/Makefile.tmp fi fi]],[[]]) dnl The BeOS sys/uio.h is broken. This kludges it out of existence. dnl (This still causes lots of spurious changes to config.h on BeOS.) AC_CONFIG_COMMANDS([fc_default-5],[[if test x`uname -s` = xBeOS ; then if grep '#define HAVE_SYS_UIO_H 1' config.h >/dev/null 2>&1 ; then echo kluging config.h mv -f config.h config.h.tmp sed -e 's/#define HAVE_SYS_UIO_H 1/#undef HAVE_SYS_UIO_H/g' config.h.tmp > config.h rm config.h.tmp fi fi]],[[]]) CFLAGS="$EXTRA_DEBUG_CFLAGS $CFLAGS" CXXFLAGS="$EXTRA_DEBUG_CXXFLAGS $CXXFLAGS" dnl Rebuild 'configure' whenever version.in changes, if maintainer mode enabled. AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/version.in"]) dnl Make sure that config.h changes when ever CPPFLAGS, CFLAGS or CXXFLAGS dnl change so everything gets rebuilt. LDFLAGS is not handled here dnl since change in it should not cause recompilation, only relinking. dnl Note: Variables are named FC_STORE_* instead of FC_*_STORE in order to make them dnl appear next to each other in config.h. AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ['$CPPFLAGS'], [These are the CPPFLAGS used in compilation]) AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ['$CFLAGS'], [These are the CFLAGS used in compilation]) AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'], [These are the CXXFLAGS used in compilation]) AC_CONFIG_FILES([Makefile data/Makefile data/civclient.dsc data/civserver.dsc data/civserver.room data/hex2t/Makefile data/amplio/Makefile data/buildings/Makefile data/flags/Makefile data/misc/Makefile data/trident/Makefile data/isophex/Makefile data/isotrident/Makefile data/stdsounds/Makefile data/default/Makefile data/civ1/Makefile data/civ2/Makefile data/experimental/Makefile data/nowonder/Makefile data/scenario/Makefile data/nation/Makefile data/themes/Makefile data/themes/gui-gtk-2.0/Makefile data/themes/gui-gtk-2.0/Freeciv/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Arrows/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Buttons/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Check-Radio/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Combo/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Frame-Gap/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Handles/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Lines/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ListHeaders/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Menu-Menubar/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Others/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Panel/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/ProgressBar/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Range/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Scrollbars/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Shadows/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Spin/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Tabs/Makefile data/themes/gui-gtk-2.0/Freeciv/gtk-2.0/Toolbar/Makefile data/themes/gui-sdl/Makefile data/themes/gui-sdl/human/Makefile data/wonders/Makefile data/icons/Makefile utility/Makefile utility/ftwl/Makefile dependencies/Makefile dependencies/lua/Makefile dependencies/tolua/Makefile dependencies/lua/src/Makefile dependencies/lua/src/lib/Makefile common/Makefile common/aicore/Makefile ai/Makefile tests/Makefile win32/Makefile client/Makefile client/agents/Makefile client/include/Makefile client/gui-sdl/Makefile client/gui-gtk-2.0/Makefile client/gui-warclient-gtk-2.0/Makefile client/gui-xaw/Makefile client/gui-win32/Makefile client/gui-ftwl/Makefile client/gui-stub/Makefile server/Makefile server/generator/Makefile server/scripting/Makefile manual/Makefile intl/Makefile po/Makefile.in doc/Makefile doc/man/Makefile doc/ca/Makefile doc/de/Makefile doc/fr/Makefile doc/it/Makefile doc/ja/Makefile doc/nl/Makefile doc/sv/Makefile freeciv.spec:bootstrap/freeciv.spec.in bootstrap/undep.sh data/Freeciv client/freeciv.desktop:bootstrap/freeciv.desktop.in server/freeciv-server.desktop:bootstrap/freeciv-server.desktop.in]) AC_CONFIG_FILES([civ:bootstrap/civ.in], [chmod +x civ]) AC_CONFIG_FILES([ser:bootstrap/ser.in], [chmod +x ser]) AC_CONFIG_COMMANDS([default],[[ chmod +x bootstrap/undep.sh ; bootstrap/undep.sh ]],[[]]) AC_OUTPUT