<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40144 >

I think being able to build multiple clients without having
to reconfigure is very useful, so I have updated the patch
to the latest revision of trunk and made some improvements.

I removed the --enable-multiclient option and the configure/
makefile code dealing with a "main client" since it seems
to me overly complicated and not necessary.

Now --enable-client takes a list of comma separated gui
names, or the special arguments 'no', 'auto' or 'all'. The
'no' argument disables client compilation (like --disable-
client). If 'auto' (the default) is used, then configure
selects only the first client gui that it successfully
detects. If 'all' is used, then configure selects all guis
that are successfully detected. When specific guis are
given via the list (including just one), and detection of
any one of them fails, then configure aborts with an error
message.

At the end of the configure script, a summary is printed
showing what will be built. For example the output on my
system using the configure command line:

./configure --enable-client=all --enable-debug --enable-auth --with-
mysql-prefix=/usr/local/mysql

is

****************** Configuration Summary ******************

  Build freeciv client: yes
    Debugging support:  yes

  Client frontends:
    Gtk-2.0: yes
    SDL:     yes
    Xaw:     yes
    Win32:   no
    FTWL:    no
    Beos:    no
    Stub:    yes

  Build freeciv server:    yes
    Debugging support:     yes
    Auth database support: yes


I also made the ./civ script able to take a --gui argument
(only as the first), so it can be run like

./civ --gui=sdl
./civ --gui=xaw

to run various client frontends from the build directory.


Only thing that annoys me is that by using libtool, the
compilation time is at least doubled, since it compiles
object files for both static and shared libraries. Maybe
the static library object file compilation can be disabled
(since as far as I can see, almost everything goes into
shared libs), so that building doesn't take so long? :(

Perhaps also the hackish looking client/dummy.c can be
worked around somehow in client/Makefile.am...


Otherwise, I would please ask that people that are able
to build on the various platforms freeciv should work on
to test this patch and report any breakage due to changes
in the configure script or makefiles.

If at least the double-compilation problem can be improved,
I would consider committing this to trunk.


-----------------------------------------------------------------------
正義のために変身して団結せよ!!
commit 582a7b9c10ccb8699d81cf5d1872d3d53371510d
Author: Madeline Book <[EMAIL PROTECTED]>
Date:   Sat Nov 8 00:15:03 2008 -0500

    Multiclient patch v2.
---
 ai/Makefile.am                 |    4 +-
 autogen.sh                     |    9 ++
 bootstrap/civ.in               |   37 +++++--
 client/Makefile.am             |  116 ++++++++++++++----
 client/agents/Makefile.am      |    6 +-
 client/dummy.c                 |   14 ++
 client/gui-ftwl/Makefile.am    |    6 +-
 client/gui-gtk-2.0/Makefile.am |    8 +-
 client/gui-sdl/Makefile.am     |    6 +-
 client/gui-stub/Makefile.am    |    6 +-
 client/gui-win32/Makefile.am   |    6 +-
 client/gui-xaw/Makefile.am     |    8 +-
 client/text.c                  |    2 +-
 common/Makefile.am             |    8 +-
 common/aicore/Makefile.am      |    4 +-
 configure.ac                   |  263 ++++++++++++++++++++++++++++------------
 m4/auth.m4                     |   38 +++---
 m4/gtk2-client.m4              |   20 ++--
 m4/no-client.m4                |    2 +-
 m4/sdl-client.m4               |   30 +++--
 m4/win32-client.m4             |   10 +-
 m4/xaw-client.m4               |   24 ++--
 manual/Makefile.am             |   27 ++---
 server/Makefile.am             |   33 +++---
 server/generator/Makefile.am   |    4 +-
 server/scripting/Makefile.am   |    4 +-
 utility/Makefile.am            |    4 +-
 27 files changed, 463 insertions(+), 236 deletions(-)

diff --git a/ai/Makefile.am b/ai/Makefile.am
index f162c7f..58c8cf2 100644
--- a/ai/Makefile.am
+++ b/ai/Makefile.am
@@ -1,10 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libcivai.a
+noinst_LTLIBRARIES = libfreeciv-ai.la
 
 AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(srcdir)/../common -I$(srcdir)/../server -I$(top_srcdir)/common/aicore -I$(top_srcdir)/server/generator
 
-libcivai_a_SOURCES = \
+libfreeciv_ai_la_SOURCES = \
 		advdomestic.c	\
 		advdomestic.h	\
 		advmilitary.c	\
diff --git a/autogen.sh b/autogen.sh
index 065752a..730ec82 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -239,6 +239,9 @@ AUTOMAKE=$REALPKGNAME
 real_package_name "aclocal" "ftp://ftp.gnu.org/pub/gnu/automake/"; 1 6 || DIE=1
 ACLOCAL=$REALPKGNAME
 
+real_package_name "libtoolize" "ftp://ftp.gnu.org/pub/gnu/libtool/"; 1 || DIE=1
+LIBTOOLIZE=$REALPKGNAME
+
 if [ "$FC_USE_NLS" = "yes" ]; then
   DIE2=0
   version_check 1 "xgettext" "xgettext" "ftp://ftp.gnu.org/pub/gnu/gettext/"; 0 10 36 || DIE2=1
@@ -274,6 +277,12 @@ $AUTOCONF || {
   echo "$AUTOCONF failed"
   exit 1
 }
+echo "+ running $LIBTOOLIZE ... "
+$LIBTOOLIZE -f || {
+  echo
+  echo "$LIBTOOLIZE failed"
+  exit 1
+}
 echo "+ running $AUTOMAKE ... "
 $AUTOMAKE -a -c || {
   echo
diff --git a/bootstrap/civ.in b/bootstrap/civ.in
index 1bc182b..bdebdbe 100755
--- a/bootstrap/civ.in
+++ b/bootstrap/civ.in
@@ -15,19 +15,38 @@
 #***********************************************************************/
 
 BUILDDIR=`dirname $0`
[EMAIL PROTECTED]@
+PROGNAME=freeciv
[EMAIL PROTECTED]@
 
-if [ "x$FREECIV_PATH" = "x" ] ; then
-  FREECIV_PATH="[EMAIL PROTECTED]@[EMAIL PROTECTED]@~/.freeciv"
+gui=`echo "$1" | awk -F= '$1 ~ /^--gui$/ { print $2 }'`
+if test "x$gui" != "x" ; then
+  [EMAIL PROTECTED]@
+  shift
 fi
-export FREECIV_PATH="[EMAIL PROTECTED]@@abs_top_builddir@/[EMAIL PROTECTED]@@abs_top_srcdir@/data"
 
-[ -x $BUILDDIR/client/$EXENAME ] && EXE=$BUILDDIR/client/$EXENAME
-[ -x $BUILDDIR/$EXENAME ] && EXE=$BUILDDIR/$EXENAME
+if test -x "$BUILDDIR/client/$EXENAME" ; then
+  EXE=$BUILDDIR/client/$EXENAME
+elif test -x "$BUILDDIR/$EXENAME" ; then
+  EXE=$BUILDDIR/$EXENAME
+else
+  EXE=`ls -1 "$BUILDDIR/${EXENAME}-"* "$BUILDDIR/client/${EXENAME}-"* 2> /dev/null |\
+  while read program ; do
+    if test -x "$program" ; then
+      echo $program
+      break
+    fi
+  done`
+fi
 
-if [ "$EXE" = "" ]; then
-  echo $0: Unable to find $EXENAME.
+if test "x$EXE" = "x"; then
+  echo $0: Unable to find client executable: $EXENAME
   exit 1
 fi
 
-exec $EXE ${1+"$@"}
+if test "x$FREECIV_PATH" = "x" ; then
+  FREECIV_PATH="[EMAIL PROTECTED]@[EMAIL PROTECTED]@~/.freeciv"
+fi
+export FREECIV_PATH="[EMAIL PROTECTED]@@abs_top_builddir@/[EMAIL PROTECTED]@@abs_top_srcdir@/data"
+
+echo "Running $EXE"
+exec "$EXE" ${1+"$@"}
diff --git a/client/Makefile.am b/client/Makefile.am
index 5f1aba9..77198bb 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -1,30 +1,27 @@
 ## Process this file with automake to produce Makefile.in
 
-## Below used to be just 
-##    SUBDIRS = $(gui_sources)
-## but that doesn't work properly for "make dist"
+lib_LTLIBRARIES = libfreeciv-client.la
+
+## Must be set before adding anything
+GUI_SUBDIRS =
 
 if CLIENT_GUI_SDL
-GUI_SUBDIR = gui-sdl
+GUI_SUBDIRS += gui-sdl
 endif
 if CLIENT_GUI_GTK_2_0
-GUI_SUBDIR = gui-gtk-2.0
+GUI_SUBDIRS += gui-gtk-2.0
 endif
 if CLIENT_GUI_XAW
-GUI_SUBDIR = gui-xaw
+GUI_SUBDIRS += gui-xaw
 endif
-## if CLIENT_GUI_BEOS
-## GUI_SUBDIR = gui-beos
-## endif
 if CLIENT_GUI_STUB
-GUI_SUBDIR = gui-stub
+GUI_SUBDIRS += gui-stub
 endif
 if CLIENT_GUI_WIN32
-GUI_SUBDIR = gui-win32
+GUI_SUBDIRS += gui-win32
 endif
 if CLIENT_GUI_FTWL
-GUI_SUBDIR = gui-ftwl
-LIBFTWL = ../utility/ftwl/libftwl.a
+GUI_SUBDIRS += gui-ftwl
 endif
 
 ALL_AUDIO_SDL_FILES=audio_sdl.c audio_sdl.h
@@ -49,13 +46,13 @@ else
 CLI_INCLUDE = 
 endif
 
-SUBDIRS = $(GUI_SUBDIR) $(CLI_INCLUDE) agents
+SUBDIRS = $(GUI_SUBDIRS) $(CLI_INCLUDE) agents
 
-bin_PROGRAMS = civclient
+bin_PROGRAMS =
 
-AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(srcdir)/include -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/agents $(CLIENT_CFLAGS) $(SOUND_CFLAGS) $(LIBGGZ_INCLUDES) $(GGZMOD_INCLUDES) $(GGZ_GTK_INCLUDES)
+AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(srcdir)/include -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/agents $(SOUND_CFLAGS) $(LIBGGZ_INCLUDES) $(GGZMOD_INCLUDES) $(GGZ_GTK_INCLUDES)
 
-civclient_SOURCES = $(AUDIO_SDL_FILES) \
+libfreeciv_client_la_SOURCES = $(AUDIO_SDL_FILES) \
 	attribute.h	\
 	attribute.c	\
 	citydlg_common.c \
@@ -123,16 +120,81 @@ civclient_SOURCES = $(AUDIO_SDL_FILES) \
 # generated outside this directory (when building common) there's no point in
 # setting them to BUILT_SOURCES.
 
-civclient_LDFLAGS = $(CLIENT_LDFLAGS) $(GGZMOD_LDFLAGS)
-fc_civclient_libs =	../utility/libcivutility.a	\
-			$(LIBFTWL)			\
-			../common/libcivcommon.a	\
-			../common/aicore/libaicore.a	\
-			agents/libagents.a		\
-		 	$(gui_sources)/libguiclient.a
-civclient_DEPENDENCIES = $(fc_civclient_libs)
-civclient_LDADD        = $(fc_civclient_libs) $(fc_civclient_libs) \
-	$(INTLLIBS) $(CLIENT_LIBS) $(SOUND_LIBS) $(LIB_GGZMOD) $(CLIENTICON)
+libfreeciv_client_la_LIBADD = \
+	./agents/libfreeciv-agents.la
+
+fc_civclient_libs = \
+	../common/libfreeciv-common.la	\
+	./libfreeciv-client.la
+
+ldadd_common = $(fc_civclient_libs) \
+ $(INTLLIBS) $(SOUND_LIBS) $(LIB_GGZMOD) $(CLIENTICON)
+
+
+if CLIENT_GUI_GTK_2_0
+bin_PROGRAMS += freeciv-gtk2
+
+freeciv_gtk2_SOURCES = dummy.c
+freeciv_gtk2_LDFLAGS = $(GUI_gtk2_LDFLAGS) $(GGZMOD_LDFLAGS)
+freeciv_gtk2_DEPENDENCIES = $(fc_civclient_libs) ./gui-gtk-2.0/libfreeciv-gui.la
+freeciv_gtk2_LDADD = \
+ $(ldadd_common) ./gui-gtk-2.0/libfreeciv-gui.la $(GUI_gtk2_LIBS)
+endif
+
+if CLIENT_GUI_SDL
+bin_PROGRAMS += freeciv-sdl
+
+freeciv_sdl_SOURCES = dummy.c
+freeciv_sdl_LDFLAGS = $(GUI_sdl_LDFLAGS) $(GGZMOD_LDFLAGS)
+freeciv_sdl_DEPENDENCIES = $(fc_civclient_libs) ./gui-sdl/libfreeciv-gui.la
+freeciv_sdl_LDADD = \
+ $(ldadd_common) ./gui-sdl/libfreeciv-gui.la $(GUI_sdl_LIBS)
+endif
+
+if CLIENT_GUI_XAW
+bin_PROGRAMS += freeciv-xaw
+
+freeciv_xaw_SOURCES = dummy.c
+freeciv_xaw_LDFLAGS = $(GUI_xaw_LDFLAGS) $(GGZMOD_LDFLAGS)
+freeciv_xaw_DEPENDENCIES = $(fc_civclient_libs) ./gui-xaw/libfreeciv-gui.la
+freeciv_xaw_LDADD = \
+ $(ldadd_common) ./gui-xaw/libfreeciv-gui.la $(GUI_xaw_LIBS)
+endif
+
+if CLIENT_GUI_FTWL
+bin_PROGRAMS += freeciv-ftwl
+
+freeciv_ftwl_SOURCES = dummy.c
+freeciv_ftwl_LDFLAGS = $(GUI_ftwl_LDFLAGS) $(GGZMOD_LDFLAGS)
+freeciv_ftwl_DEPENDENCIES = \
+	$(fc_civclient_libs) \
+	../utility/ftwl/libftwl.a \
+	./gui-ftwl/lib-freeciv-gui.la
+freeciv_ftwl_LDADD = \
+ $(ldadd_common) ../utility/ftwl/libftwl.a \
+ ./gui-ftwl/lib-freeciv-gui.la $(GUI_ftwl_LIBS)
+endif
+
+if CLIENT_GUI_WIN32
+bin_PROGRAMS += freeciv-win32
+
+freeciv_win32_SOURCES = dummy.c
+freeciv_win32_LDFLAGS = $(GUI_win32_LDFLAGS) $(GGZMOD_LDFLAGS)
+freeciv_win32_DEPENDENCIES = $(fc_civclient_libs) ./gui-win32/libfreeciv-gui.la
+freeciv_win32_LDADD        = \
+ $(ldadd_common) ./gui-win32/libfreeciv-gui.la $(GUI_win32_LIBS)
+endif
+
+if CLIENT_GUI_STUB
+bin_PROGRAMS += freeciv-stub
+
+freeciv_stub_SOURCES = dummy.c
+freeciv_stub_LDFLAGS = $(GUI_stub_LDFLAGS) $(GGZMOD_LDFLAGS)
+freeciv_stub_DEPENDENCIES = $(fc_civclient_libs) ./gui-stub/libfreeciv-gui.la
+freeciv_stub_LDADD        = \
+ $(ldadd_common) ./gui-stub/libfreeciv-gui.la $(GUI_stub_LIBS)
+endif
+
 desktopfiledir = $(prefix)/share/applications
 desktopfile_DATA = \
 	freeciv.desktop
diff --git a/client/agents/Makefile.am b/client/agents/Makefile.am
index ebd48db..4eecfaf 100644
--- a/client/agents/Makefile.am
+++ b/client/agents/Makefile.am
@@ -1,10 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libagents.a
+noinst_LTLIBRARIES = libfreeciv-agents.la
 
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(top_srcdir)/common/aicore -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(srcdir)/../gui-gtk $(CLIENT_CFLAGS)
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(top_srcdir)/common/aicore -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common
 
-libagents_a_SOURCES = 		\
+libfreeciv_agents_la_SOURCES = 		\
 	agents.c		\
 	agents.h		\
 	cma_core.c 		\
diff --git a/client/dummy.c b/client/dummy.c
new file mode 100644
index 0000000..5512510
--- /dev/null
+++ b/client/dummy.c
@@ -0,0 +1,14 @@
+/********************************************************************** 
+ Freeciv - Copyright (C) 2002 - The Freeciv Project
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+
+/* This file is compiled just to satisfy automake */
diff --git a/client/gui-ftwl/Makefile.am b/client/gui-ftwl/Makefile.am
index 4c9e871..0fdd7df 100644
--- a/client/gui-ftwl/Makefile.am
+++ b/client/gui-ftwl/Makefile.am
@@ -2,10 +2,10 @@
 
 SUBDIRS = 
 
-noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(top_srcdir)/utility -I$(top_srcdir)/utility/ftwl -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/.. -I$(srcdir)/../include $(CLIENT_CFLAGS)
+noinst_LTLIBRARIES = libfreeciv-gui.la
+AM_CPPFLAGS = -I. -I$(top_srcdir)/utility -I$(top_srcdir)/utility/ftwl -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/.. -I$(srcdir)/../include $(GUI_ftwl_CFLAGS)
 
-libguiclient_a_SOURCES = \
+libfreeciv_gui_la_SOURCES = \
 	canvas.c	\
 	canvas.h	\
 	chatline.c	\
diff --git a/client/gui-gtk-2.0/Makefile.am b/client/gui-gtk-2.0/Makefile.am
index 88fa9ae..bbf1a19 100644
--- a/client/gui-gtk-2.0/Makefile.am
+++ b/client/gui-gtk-2.0/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS) $(GGZ_GTK_INCLUDES)
+noinst_LTLIBRARIES = libfreeciv-gui.la
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(GUI_gtk2_CFLAGS) $(GGZ_GTK_INCLUDES)
 
 # The AM_CPPFLAGS "-I." is so resources.c includes the locally generated 
 # Freeciv.h in the builddir, in preference to the one 
@@ -16,9 +16,9 @@ Freeciv.h: $(top_srcdir)/data/freeciv.rc-2.0
 	echo '/*********************************************************/' >> Freeciv.h
 	$(srcdir)/rc2c $(top_srcdir)/data/freeciv.rc-2.0 >> Freeciv.h
 
-libguiclient_a_DEPENDENCIES = rc2c
+libfreeciv_gui_la_DEPENDENCIES = rc2c
 
-libguiclient_a_SOURCES = \
+libfreeciv_gui_la_SOURCES = \
 	rc2c		\
 	Freeciv.h	\
 	canvas.c	\
diff --git a/client/gui-sdl/Makefile.am b/client/gui-sdl/Makefile.am
index 071fe5f..d3e59a8 100644
--- a/client/gui-sdl/Makefile.am
+++ b/client/gui-sdl/Makefile.am
@@ -1,10 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libguiclient.a
+noinst_LTLIBRARIES = libfreeciv-gui.la
 
-AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS)
+AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(GUI_sdl_CFLAGS)
 
-libguiclient_a_SOURCES = \
+libfreeciv_gui_la_SOURCES = \
 	SDL_rotozoom.c	\
 	SDL_rotozoom.h	\
 	SDL_ttf.c	\
diff --git a/client/gui-stub/Makefile.am b/client/gui-stub/Makefile.am
index bf8174e..7594591 100644
--- a/client/gui-stub/Makefile.am
+++ b/client/gui-stub/Makefile.am
@@ -1,9 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common $(CLIENT_CFLAGS)
+noinst_LTLIBRARIES = libfreeciv-gui.la
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common $(GUI_stub_CFLAGS)
 
-libguiclient_a_SOURCES = \
+libfreeciv_gui_la_SOURCES = \
 	canvas.c	\
 	canvas.h	\
 	chatline.c	\
diff --git a/client/gui-win32/Makefile.am b/client/gui-win32/Makefile.am
index ba83f82..83cbcbf 100644
--- a/client/gui-win32/Makefile.am
+++ b/client/gui-win32/Makefile.am
@@ -1,10 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libguiclient.a
+noinst_LTLIBRARIES = libfreeciv-gui.la
 
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../agents -I$(top_srcdir)/utility -I$(srcdir)/../include -I$(top_srcdir)/common/aicore -I$(top_srcdir)/common $(CLIENT_CFLAGS)
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../agents -I$(top_srcdir)/utility -I$(srcdir)/../include -I$(top_srcdir)/common/aicore -I$(top_srcdir)/common $(GUI_win32_CFLAGS)
 
-libguiclient_a_SOURCES = \
+libfreeciv_gui_la_SOURCES = \
 	canvas.c	\
 	canvas.h	\
 	chatline.c	\
diff --git a/client/gui-xaw/Makefile.am b/client/gui-xaw/Makefile.am
index 4a9c011..4b5c081 100644
--- a/client/gui-xaw/Makefile.am
+++ b/client/gui-xaw/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libguiclient.a
-AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(CLIENT_CFLAGS)
+noinst_LTLIBRARIES = libfreeciv-gui.la
+AM_CPPFLAGS = -I. -I$(srcdir)/.. -I$(srcdir)/../include -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/common/aicore -I$(srcdir)/../agents $(GUI_xaw_CFLAGS)
 
 # The AM_CPPFLAGS "-I." is so resources.c includes the locally generated 
 # Freeciv.h in the builddir, in preference to the one 
@@ -16,9 +16,9 @@ Freeciv.h: $(top_builddir)/data/Freeciv
 	echo '/**************************************************/' >> Freeciv.h
 	$(srcdir)/ad2c $(top_builddir)/data/Freeciv >> Freeciv.h
 
-libguiclient_a_DEPENDENCIES = ad2c
+libfreeciv_gui_la_DEPENDENCIES = ad2c
 
-libguiclient_a_SOURCES = \
+libfreeciv_gui_la_SOURCES = \
 	ad2c		\
 	Freeciv.h	\
 	actions.c	\
diff --git a/client/text.c b/client/text.c
index e50a758..6b293c7 100644
--- a/client/text.c
+++ b/client/text.c
@@ -1,5 +1,5 @@
 /********************************************************************** 
- Freeciv - Copyright (C) 2002 - The Freeciv Poject
+ Freeciv - Copyright (C) 2002 - The Freeciv Project
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
diff --git a/common/Makefile.am b/common/Makefile.am
index 36bae3a..85beffd 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -2,11 +2,11 @@
 
 SUBDIRS=	aicore
 
-noinst_LIBRARIES = libcivcommon.a
+lib_LTLIBRARIES = libfreeciv-common.la
 
 AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(srcdir)/aicore
 
-libcivcommon_a_SOURCES = \
+libfreeciv_common_la_SOURCES = \
 		base.c		\
 		base.h		\
 		capstr.c	\
@@ -75,6 +75,10 @@ libcivcommon_a_SOURCES = \
 		version.c	\
 		version.h
 
+libfreeciv_common_la_LIBADD = \
+ $(top_builddir)/utility/libfreeciv-util.la \
+ aicore/libfreeciv-aicore.la
+
 BUILT_SOURCES = packets_gen.c packets_gen.h
 
 # packets_gen.h must be generated before it can be included.
diff --git a/common/aicore/Makefile.am b/common/aicore/Makefile.am
index d411c4c..ee42ba5 100644
--- a/common/aicore/Makefile.am
+++ b/common/aicore/Makefile.am
@@ -1,10 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libaicore.a
+noinst_LTLIBRARIES = libfreeciv-aicore.la
 
 AM_CPPFLAGS = -I$(top_srcdir)/utility -I.. -I$(top_srcdir)/common
 
-libaicore_a_SOURCES = 		\
+libfreeciv_aicore_la_SOURCES = 		\
 	aisupport.c		\
 	aisupport.h		\
 	path_finding.c		\
diff --git a/configure.ac b/configure.ac
index 010ea5d..5aaa187 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,11 +63,11 @@ 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 ;;
+  yes) server=yes ;;
+  no)  server=no ;;
   *)   AC_MSG_ERROR(bad value ${enableval} for --disable-server) ;;
-esac], [server=true])
-AM_CONDITIONAL(SERVER, test x$server = xtrue)
+esac], [server=yes])
+AM_CONDITIONAL(SERVER, test x$server = xyes)
 
 dnl yes     - Forced use of IPv6
 dnl no      - Legacy IPv4 support
@@ -101,26 +101,49 @@ 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
+dnl no:   Do not compile client.
+dnl auto: Autodetect one.
+dnl all:  Autodetect as many as possible.
+dnl comma-separated-list: Detect these or abort.
 AC_ARG_ENABLE(client,
-[  --enable-client[=no/yes/xaw3d/xaw/gtk/win32/sdl/ftwl]
-                          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 ;;
-  *)	  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)
+[  --enable-client[=auto/all/gtk/sdl/xaw/win32/ftwl/stub)]
+                          clients to compile [[auto]] (or list for multiple)],
+[clients=${enableval}],
+[client=auto])
+
+gui_gtk2=no
+gui_sdl=no
+gui_xaw=no
+gui_win32=no
+gui_ftwl=no
+gui_beos=no
+gui_stub=no
+
+AC_PROG_SED
+
+for gui in $(echo $clients | $SED 's/,/ /g') ; do
+  if test "x$gui" = "xno" ; then
+    client=no
+  elif test "x$gui" = "xauto" ; then
+    client=auto
+  elif test "x$gui" = "xall" ; then
+    client=all
+  else
+    if test "x$gui" = "xgtk"    ||
+       test "x$gui" = "xgtk2"   ||
+       test "x$gui" = "xgtk2.0" ||
+       test "x$gui" = "xgtk20"  ||
+       test "x$gui" = "xgtk-2.0" ; then
+      gui_gtk2=yes
+    else
+      if test ! -d "${srcdir}/client/gui-$gui" ; then
+        AC_MSG_ERROR(bad value ${gui} for --enable-client)
+      fi
+      eval "gui_$gui=yes"
+    fi
+    client=yes
+  fi
+done
 
 dnl You MUST build ftwl to use the ftwl client
 AC_ARG_ENABLE(ftwl,
@@ -133,10 +156,8 @@ AC_ARG_ENABLE(ftwl,
   *)	  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
-if test "$ftwl" != no ; then
+
+if test "x$ftwl" != "xno" ; then
   PKG_CHECK_MODULES([CAIRO], [cairo],,
     [AC_MSG_ERROR([--enable-ftwl requires cairo])])
   FTWL_CFLAGS="$FTWL_CFLAGS $CAIRO_CFLAGS"
@@ -153,6 +174,10 @@ AC_ARG_WITH(xaw3d,
 WITH_XAW3D=1
 )
 
+if test "x$WITH_XAW" != "x" && test "x$WITH_XAW3D" != "x" ; then
+  AC_MSG_ERROR(Cannot use both --with-xaw and --with-xaw3d at the same time)
+fi
+
 AC_ARG_ENABLE([svnrev],
 [  --enable-svnrev         get svn revision to version information],
 [case "${enableval}" in
@@ -205,7 +230,7 @@ AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_CXX
 AC_PROG_LN_S
-AC_PROG_RANLIB
+AC_PROG_LIBTOOL
 AC_CHECK_TOOL(AR, ar)
 if test -z $AR; then
 	AC_MSG_ERROR([*** 'ar' missing.  Install binutils, fix your \$PATH, or set \$AR manually. ***])
@@ -455,7 +480,7 @@ 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.]))
+You may need to install a zlib devel package.]))
 AC_PATH_PROG(GZIP, gzip, "no")
 if test "$GZIP" = "no"; then
   AC_MSG_ERROR([You need the gzip program for compilation.])
@@ -483,18 +508,23 @@ if test "$ftwl" = opengl ; then
 fi
 
 dnl Check and choose clients
-if test x$client != xno; then
+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
+  if test -n "$WITH_XAW" || test -n "$WITH_XAW3D"; then
+    if test "x$client" = "xauto" ; then
+      gui_xaw=yes
+      client=yes
+    elif test "x$client" = "xall" ; then
+      gui_xaw=yes
     fi
   fi
 
   dnl if need to guess client, announce checking
-  if test x$client = xyes; then
+  if test "x$client" = "xauto"; then
     AS_MESSAGE([checking for which client to compile:...])
+  elif test "x$client" = "xall" ; then
+    AS_MESSAGE([checking for which clients to compile:...])
   fi
 
   dnl Gtk-2.0-specific overrides
@@ -506,25 +536,42 @@ if test x$client != xno; then
   dnl Xaw-specific overrides
   FC_XAW_CLIENT
 
-  if test "$client" = ftwl ; then
-      AC_MSG_CHECKING([will compile gui-ftwl])
+  if test "x$gui_ftwl" = "xyes" || test "x$client" = "xall" ||
+     test "x$client" = "xauto" ; then
+    AC_MSG_CHECKING([will compile gui-ftwl])
+    if test "x$ftwl" = "xno" ; then
+      AC_MSG_RESULT([no])
+      if test "x$gui_ftwl" = "xyes" ; then
+        AC_MSG_ERROR(You must use --enable-ftwl to compile the ftwl client)
+      fi
+    else
       AC_MSG_RESULT([yes])
-      CLIENT_CFLAGS="$CLIENT_CFLAGS $FTWL_CFLAGS"
-      CLIENT_LIBS="$CLIENT_LIBS $FTWL_LIBS"
+      gui_ftwl=yes
+      if test "x$client" = "xauto" ; then
+        client=yes
+      fi
+      GUI_ftwl_CFLAGS="$GUI_ftwl_CFLAGS $FTWL_CFLAGS"
+      GUI_ftwl_LIBS="$GUI_ftwl_LIBS $FTWL_LIBS"
+    fi
   fi
 
   dnl BeOS-specific overrides
-  if test "$client" = beos || test "$client" = yes ; then
+  if test "x$gui_beos" = "xyes" || test "x$client" = "xall"
+     test "x$client" = "xauto" ; then
+    AC_MSG_CHECKING([will compile gui-beos])
     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)
+      AC_MSG_RESULT([yes])
+      gui_beos=yes
+      if test "x$client" = "xauto" ; then
+        client=yes
+      fi
+      GUI_beos_CFLAGS=
+      GUI_beos_LIBS="-Lgui-beos/lib -lBdhGame -lBdhDialog -lBdh -ltranslation -lbe -lroot"
+    else
+      AC_MSG_RESULT([no])
+      if test "x$gui_beos" = "xyes" ; then
+        AC_MSG_ERROR(The BeOS client is only available on BeOS.)
+      fi
     fi
   fi
 
@@ -532,32 +579,50 @@ if test x$client != xno; then
   FC_WIN32_CLIENT
 
   dnl Stub-specific overrides
-  if test "$client" = stub ; then
+  if test "x$gui_stub" = "xyes" || test "x$client" = "xall" ||
+     test "x$client" = "xauto" ; then
     found_client=yes
 
     if test "x$found_client" = "xyes"; then
-      client=stub
-      CLIENT_LIBS="-lm"
-    elif test "$client" = "stub"; then
+      gui_stub=yes
+      if test "x$client" = "xauto" ; then
+        client=yes
+      fi
+      GUI_stub_LIBS="-lm"
+    elif test "x$gui_stub" = "xyes"; 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
+  dnl If client still "auto", error out since we couldn't guess it
+  if test "x$client" = "xauto" ; 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"
+  dnl gui_sources="gui-$client"
+fi
+
+if test "x$client" = "xall" ; then
+  if test "x$gui_gtk2" = "xyes" ||
+     test "x$gui_sdl" = "xyes" ||
+     test "x$gui_xaw" = "xyes" ||
+     test "x$gui_ftwl" = "xyes" ||
+     test "x$gui_win32" = "xyes" ||
+     test "x$gui_beos" = "xyes" ||
+     test "x$gui_stub" = "xyes" ; then
+    client=yes
+  else
+    client=no
+  fi
 fi
 
 dnl Check for GGZ
-if test "$client" = "gtk-2.0" ; then
+if test "x$gui_gtk2" = "yes" ; then
   AC_GGZ_CHECK("gtk")
-  CLIENT_LIBS="$CLIENT_LIBS $LIB_GGZ_GTK"
+  GUI_gtk2_LIBS="$GUI_gtk2_LIBS $LIB_GGZ_GTK"
 else
   AC_GGZ_CHECK
 fi
@@ -565,25 +630,50 @@ 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)
+AM_CONDITIONAL([CLIENT], [test "x$client" = "xyes"])
+
+AC_SUBST([GUI_gtk2_CFLAGS])
+AC_SUBST([GUI_gtk2_CXXFLAGS])
+AC_SUBST([GUI_gtk2_LIBS])
+AC_SUBST([GUI_gtk2_LDFLAGS])
+AC_SUBST([GUI_sdl_CFLAGS])
+AC_SUBST([GUI_sdl_CXXFLAGS])
+AC_SUBST([GUI_sdl_LIBS])
+AC_SUBST([GUI_sdl_LDFLAGS])
+AC_SUBST([GUI_xaw_CFLAGS])
+AC_SUBST([GUI_xaw_CXXFLAGS])
+AC_SUBST([GUI_xaw_LIBS])
+AC_SUBST([GUI_xaw_LDFLAGS])
+AC_SUBST([GUI_ftwl_CFLAGS])
+AC_SUBST([GUI_ftwl_CXXFLAGS])
+AC_SUBST([GUI_ftwl_LIBS])
+AC_SUBST([GUI_ftwl_LDFLAGS])
+AC_SUBST([GUI_win32_CFLAGS])
+AC_SUBST([GUI_win32_CXXFLAGS])
+AC_SUBST([GUI_win32_LIBS])
+AC_SUBST([GUI_win32_LDFLAGS])
+AC_SUBST([GUI_stub_CFLAGS])
+AC_SUBST([GUI_stub_CXXFLAGS])
+AC_SUBST([GUI_stub_LIBS])
+AC_SUBST([GUI_stub_LDFLAGS])
+AC_SUBST([GUI_beos_CFLAGS])
+AC_SUBST([GUI_beos_CXXFLAGS])
+AC_SUBST([GUI_beos_LIBS])
+AC_SUBST([GUI_beos_LDFLAGS])
+AC_SUBST([SOUND_CFLAGS])
+AC_SUBST([SOUND_LIBS])
+AC_SUBST([FTWL_CFLAGS])
 AC_SUBST([VERSION_WITHOUT_LABEL])
 AC_SUBST([VERSION_LABEL])
 AC_SUBST([HOST_PATH_SEPARATOR])
 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_SDL, test "x$gui_sdl" = "xyes")
+AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "x$gui_gtk2" = "xyes")
+AM_CONDITIONAL(CLIENT_GUI_XAW, test "x$gui_xaw" = "xyes")
+AM_CONDITIONAL(CLIENT_GUI_STUB, test "x$gui_stub" = "xyes")
+AM_CONDITIONAL(CLIENT_GUI_WIN32, test "x$gui_win32" = "xyes")
+AM_CONDITIONAL(CLIENT_GUI_FTWL, test "x$gui_ftwl" = "xyes")
+AM_CONDITIONAL(CLIENT_GUI_BEOS, test "x$gui_beos" = "xyes")
 AM_CONDITIONAL(FTWL, test "$ftwl" != "no")
 AM_CONDITIONAL(FTWL_X11, test "$ftwl" = "x11")
 AM_CONDITIONAL(FTWL_SDL, test "$ftwl" = "sdl")
@@ -591,7 +681,7 @@ 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
+if test "x$server" = "xyes"; then
     dnl Some systems (e.g., BeOS) need this lib
     AC_CHECK_LIB(bind, gethostbyaddr, SERVER_LIBS="-lbind $SERVER_LIBS")
 
@@ -621,11 +711,11 @@ if test "x$MINGW32" != "xyes"; then
                    sys/select.h sys/signal.h sys/socket.h sys/termio.h \
                    sys/uio.h termios.h)
 fi
-if test x$client = xxaw; then
+if test "x$gui_xaw" = "xyes" ; then
   dnl Want to get appropriate -I flags:
   fc_save_CPPFLAGS="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $CLIENT_CFLAGS"
-  AC_CHECK_HEADER(X11/xpm.h, , 
+  CPPFLAGS="$CPPFLAGS $GUI_xaw_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
@@ -957,3 +1047,24 @@ if test "$USE_NLS" != "yes" ; then
 fi
 
 AC_OUTPUT
+
+AC_MSG_NOTICE([
+****************** Configuration Summary ******************
+
+  Build freeciv client: $client
+    Debugging support:  $enable_debug
+
+  Client frontends:
+    Gtk-2.0: $gui_gtk2
+    SDL:     $gui_sdl
+    Xaw:     $gui_xaw
+    Win32:   $gui_win32
+    FTWL:    $gui_ftwl
+    Beos:    $gui_beos
+    Stub:    $gui_stub
+
+  Build freeciv server:    $server
+    Debugging support:     $enable_debug
+    Auth database support: $auth
+])
+
diff --git a/m4/auth.m4 b/m4/auth.m4
index 08c0313..edc02cf 100644
--- a/m4/auth.m4
+++ b/m4/auth.m4
@@ -8,22 +8,22 @@ AC_DEFUN([FC_CHECK_AUTH],
   AC_ARG_ENABLE([auth], 
   [  --enable-auth[[=no/yes/try]] compile in authentication [[default=no]]],
   [case "${enableval}" in
-    yes) auth=true
-         must_auth=true ;;
-    no)  auth=false ;;
-    try) auth=true ;;
+    yes) auth=yes
+         must_auth=yes ;;
+    no)  auth=no ;;
+    try) auth=yes ;;
     *)   AC_MSG_ERROR([bad value ${enableval} for --enable-auth]) ;;
-   esac], [auth=false])
+   esac], [auth=no])
 
   AC_ARG_WITH(mysql-prefix,[  --with-mysql-prefix=PFX Prefix where MySQL is installed (optional)],
               mysql_prefix="$withval", mysql_prefix="")
 
-  if test x$auth = xtrue; then
+  if test x$auth = xyes ; then
 
-    if test x$mysql_prefix = x; then
+    if test x$mysql_prefix = x ; then
       AC_CHECK_HEADER(mysql/mysql.h, , 
                       [AC_MSG_WARN([couldn't find mysql header: disabling auth]);
-                       auth=false])
+                       auth=no])
 
       dnl we need to set -L correctly, we will check once in standard locations
       dnl then we will check with other LDFLAGS. if none of these work, we fail.
@@ -31,24 +31,24 @@ AC_DEFUN([FC_CHECK_AUTH],
       AC_CHECK_LIB(mysqlclient, mysql_query, 
 		   [AUTH_LIBS="-lmysqlclient $AUTH_LIBS"],
                    [AC_MSG_WARN([couldn't find mysql libs in normal locations]);
-                    auth=false])
+                    auth=no])
 
-      if test x$auth = x$true ; then
+      if test x$auth = x$yes ; then
         fc_preauth_LDFLAGS="$LDFLAGS"
         fc_mysql_lib_loc="-L/usr/lib/mysql -L/usr/local/lib/mysql"
 
         for __ldpath in $fc_mysql_lib_loc; do
           unset ac_cv_lib_mysqlclient_mysql_query
           LDFLAGS="$LDFLAGS $__ldpath"
-          auth=true
+          auth=yes
 
           AC_CHECK_LIB(mysqlclient, mysql_query,
                        [AUTH_LIBS="-lmysqlclient $AUTH_LIBS";
                         AC_MSG_WARN([had to add $__ldpath to LDFLAGS])],
                         [AC_MSG_WARN([couldn't find mysql libs in $__ldpath]);
-                         auth=false])
+                         auth=no])
 
-          if test x$auth = xtrue; then
+          if test x$auth = xyes; then
             break
           else
             LDFLAGS="$fc_preauth_LDFLAGS"
@@ -66,19 +66,19 @@ AC_DEFUN([FC_CHECK_AUTH],
       LIBS="$LIBS $AUTH_LIBS"
       AC_CHECK_HEADER(mysql/mysql.h, , 
                       [AC_MSG_WARN([couldn't find mysql header in $mysql_prefix/include]);
-                       auth=false])
-      if test x$auth = xtrue; then
+                       auth=no])
+      if test x$auth = xyes; then
         AC_CHECK_LIB(mysqlclient, mysql_query, ,
                      [AC_MSG_WARN([couldn't find mysql libs in $mysql_prefix/lib/mysql]);
-                      auth=false])
+                      auth=no])
       fi
       CFLAGS="$auth_saved_cflags"
       CPPFLAGS="$auth_saved_cppflags"
       LIBS="$auth_saved_libs"
     fi
 
-    if test x$auth = xfalse; then
-      if test x$must_auth = xtrue; then
+    if test x$auth = xno; then
+      if test x$must_auth = xyes; then
         AC_MSG_ERROR([can't find mysql: cannot build authentication support])
       else
         AC_MSG_WARN([can't find mysql -- disabling authentication])
@@ -91,7 +91,7 @@ AC_DEFUN([FC_CHECK_AUTH],
   fi
 
 
-  if test x$auth = xtrue; then
+  if test x$auth = xyes; then
     AC_DEFINE(HAVE_AUTH, 1, [compile with authentication])
   fi
 
diff --git a/m4/gtk2-client.m4 b/m4/gtk2-client.m4
index 1f3aba4..5089cb4 100644
--- a/m4/gtk2-client.m4
+++ b/m4/gtk2-client.m4
@@ -5,20 +5,24 @@
 
 AC_DEFUN([FC_GTK2_CLIENT],
 [
-  if test "$client" = "gtk-2.0" || test "$client" = yes ; then
+  if test "x$gui_gtk2" = "xyes" || test "x$client" = "xauto" ||
+     test "x$client" = "xall" ; then
     AM_PATH_GTK_2_0(2.4.0,
       [
-        client="gtk-2.0"
-        CLIENT_CFLAGS="$GTK_CFLAGS"
-        CLIENT_LIBS="$GTK_LIBS"
-        if test x"$MINGW32" = "xyes"; then
+        gui_gtk2=yes
+        if test "x$client" = "xauto" ; then
+          client=yes
+        fi
+        GUI_gtk2_CFLAGS="$GTK_CFLAGS"
+        GUI_gtk2_LIBS="$GTK_LIBS"
+        if test "x$MINGW32" = "xyes"; then
           dnl Required to compile gtk2 on Windows platform
-          CFLAGS="$CFLAGS -mms-bitfields"
-          CLIENT_LDFLAGS="$LDFLAGS -mwindows"
+          GUI_gtk2_CFLAGS="$GUI_gtk2_CFLAGS -mms-bitfields"
+          GUI_gtk2_LDFLAGS="$GUI_gtk2_LDFLAGS -mwindows"
         fi
       ],
       [
-        FC_NO_CLIENT([gtk-2.0], [GTK+-2.0 libraries not found])
+        FC_NO_CLIENT([gtk2], [GTK+-2.0 libraries not found])
       ])
   fi
 ])
diff --git a/m4/no-client.m4 b/m4/no-client.m4
index 5c252d4..ee3e5da 100644
--- a/m4/no-client.m4
+++ b/m4/no-client.m4
@@ -8,7 +8,7 @@
 
 AC_DEFUN([FC_NO_CLIENT],
 [
-  if test "$client" = "$1"; then
+  if test "x`eval echo '$'gui_$1`" = "xyes"; then
     AC_MSG_ERROR([specified client '$1' not configurable ($2)])
   fi
 ])
diff --git a/m4/sdl-client.m4 b/m4/sdl-client.m4
index 0ef5dab..eafc88c 100644
--- a/m4/sdl-client.m4
+++ b/m4/sdl-client.m4
@@ -5,9 +5,8 @@ dnl Test for SDL and needed libraries for gui-sdl
 
 AC_DEFUN([FC_SDL_CLIENT],
 [
-  if test "$client" = yes; then
-    AC_MSG_WARN([Not checking for SDL; use --enable-client=sdl to enable])
-  elif test "$client" = sdl ; then
+  if test "x$gui_sdl" = "xyes" || test "x$client" = "xall" ||
+     test "x$client" = "xauto" ; then
     AM_PATH_SDL([1.1.4], [sdl_found="yes"], [sdl_found="no"])
     if test "$sdl_found" = yes; then
       ac_save_CPPFLAGS="$CPPFLAGS"
@@ -27,37 +26,40 @@ AC_DEFUN([FC_SDL_CLIENT],
           LIBS="$ac_save_LIBS"
 	  AC_CHECK_FT2([2.1.3], [freetype_found="yes"],[freetype_found="no"])
           if test "$freetype_found" = yes; then
-	    CLIENT_CFLAGS="$SDL_CFLAGS $FT2_CFLAGS"
-	    CLIENT_LIBS="-lSDL_image $SDL_LIBS $FT2_LIBS"
+	    GUI_sdl_CFLAGS="$SDL_CFLAGS $FT2_CFLAGS"
+	    GUI_sdl_LIBS="-lSDL_image $SDL_LIBS $FT2_LIBS"
 	    AC_DEFINE(SDL, 1, [SDL is used])
 	    found_client=yes
-          elif test "$client" = "sdl"; then
+          elif test "x$gui_sdl" = "xyes"; then
             AC_MSG_ERROR([specified client 'sdl' not configurable (FreeType2 >= 2.1.3 is needed (www.freetype.org))])
-          fi    
-	elif test "$client" = "sdl"; then
+          fi
+	elif test "x$gui_sdl" = "xyes"; then
 	    AC_MSG_ERROR([specified client 'sdl' not configurable (SDL_image-devel is needed (www.libsdl.org))])
 	fi
-      elif test "$client" = "sdl"; then
+      elif test "x$gui_sdl" = "xyes"; then
         AC_MSG_ERROR([specified client 'sdl' not configurable (SDL_image is needed (www.libsdl.org))])
       fi
     fi
 
     if test "$found_client" = yes; then
-      client=sdl
+      gui_sdl=yes
+      if test "x$client" = "xauto" ; then
+        client=yes
+      fi
 
       dnl Check for libiconv (which is usually included in glibc, but may
       dnl be distributed separately).
       AM_ICONV
       AM_LIBCHARSET
       AM_LANGINFO_CODESET
-      CLIENT_LIBS="$LIBICONV $CLIENT_LIBS"
+      GUI_sdl_LIBS="$LIBICONV $GUI_sdl_LIBS"
 
       dnl Check for some other libraries - needed under BeOS for instance.
       dnl These should perhaps be checked for in all cases?
-      AC_CHECK_LIB(socket, connect, CLIENT_LIBS="-lsocket $CLIENT_LIBS")
-      AC_CHECK_LIB(bind, gethostbyaddr, CLIENT_LIBS="-lbind $CLIENT_LIBS")
+      AC_CHECK_LIB(socket, connect, GUI_sdl_LIBS="-lsocket $GUI_sdl_LIBS")
+      AC_CHECK_LIB(bind, gethostbyaddr, GUI_sdl_LIBS="-lbind $GUI_sdl_LIBS")
 
-    elif test "$client" = "sdl"; then
+    elif test "x$gui_sdl" = "xyes"; then
       AC_MSG_ERROR([specified client 'sdl' not configurable (SDL >= 1.1.4 is needed (www.libsdl.org))])
     fi
   fi
diff --git a/m4/win32-client.m4 b/m4/win32-client.m4
index 5b45158..3437fb9 100644
--- a/m4/win32-client.m4
+++ b/m4/win32-client.m4
@@ -5,7 +5,8 @@
 
 AC_DEFUN([FC_WIN32_CLIENT],
 [
-  if test "$client" = "win32" || test "$client" = "yes" ; then
+  if test "x$gui_win32" = "xyes" || test "x$client" = "xauto" ||
+     test "x$client" = "xall" ; then
     if test "$MINGW32" = "yes"; then
       PKG_CHECK_MODULES([PNG], [libpng],
       [
@@ -28,8 +29,11 @@ AC_DEFUN([FC_WIN32_CLIENT],
             AC_CHECK_HEADER([png.h],
             [
               found_client=yes
-              client=win32
-              CLIENT_LIBS="-lwsock32 -lcomctl32  -lpng -mwindows"
+	      gui_win32=yes
+              if test "x$client" = "xauto" ; then
+                client=yes
+              fi
+              GUI_win32_LIBS="-lwsock32 -lcomctl32  -lpng -mwindows"
             ],
             [
               FC_NO_CLIENT([win32], [libpng-dev is needed])
diff --git a/m4/xaw-client.m4 b/m4/xaw-client.m4
index 62f3cac..d1eb5b7 100644
--- a/m4/xaw-client.m4
+++ b/m4/xaw-client.m4
@@ -5,9 +5,8 @@
 
 AC_DEFUN([FC_XAW_CLIENT],
 [
-  if test "$client" = yes ; then
-    AC_MSG_WARN([Not checking for XAW; use --enable-client=xaw to enable])
-  elif test "$client" = xaw ; then
+  if test "x$gui_xaw" = "xyes" || test "x$client" = "xall" ||
+     test "x$client" = "xauto" ; then
     dnl Checks for X:
     AC_PATH_XTRA
 
@@ -32,13 +31,15 @@ AC_DEFUN([FC_XAW_CLIENT],
       [
         AC_CHECK_LIB([png], [png_read_image], [X_LIBS="$X_LIBS -lpng -lm"],
         [
-          AC_MSG_ERROR([Could not find PNG library.])
+          FC_NO_CLIENT([xaw], [Could not find PNG library.])
+          no_png=yes
         ])
       ])
       AC_CHECK_HEADER([png.h],,
       [
-	AC_MSG_ERROR([libpng found but not png.h.
+        FC_NO_CLIENT([xaw], [libpng found but not png.h.
 You may need to install a libpng \"development\" package.])
+        no_png=yes
       ])
     ])
 
@@ -90,16 +91,19 @@ You may need to install a libpng \"development\" package.])
 	  fi
 	fi
 
-	CLIENT_CFLAGS="$X_CFLAGS"
-	CLIENT_LIBS="$X_LIBS $X_EXTRA_LIBS"
+	GUI_xaw_CFLAGS="$X_CFLAGS"
+	GUI_xaw_LIBS="$X_LIBS $X_EXTRA_LIBS"
 
 	found_client=yes
       fi
     fi
 
-    if test "x$found_client" = "xyes"; then
-      client=xaw
-    elif test "$client" = "xaw"; then
+    if test "x$found_client" = "xyes" && test "x$no_png" != "xyes"; then
+      gui_xaw=yes
+      if test "x$client" = "xauto" ; then
+        client=yes
+      fi
+    elif test "x$gui_xaw" = "xyes"; then
       if test "x$haveXpm" = "xno"; then
 	AC_MSG_ERROR(specified client 'xaw' not configurable -- need Xpm library and development headers; perhaps try/adjust --with-xpm-lib)
       else
diff --git a/manual/Makefile.am b/manual/Makefile.am
index 39a6cc8..5c21284 100644
--- a/manual/Makefile.am
+++ b/manual/Makefile.am
@@ -8,21 +8,14 @@ civmanual_SOURCES = \
 
 # This is a bit of a hack.  The program links in with the server lib
 # but also uses some files from the client.
-civmanual_DEPENDENCIES = ../utility/libcivutility.a ../common/libcivcommon.a \
-      ../ai/libcivai.a ../utility/libcivutility.a ../server/libcivserver.a \
-      ../utility/libcivutility.a ../common/aicore/libaicore.a \
-      ../client/helpdata.o \
-      ../server/scripting/libscripting.a \
-      $(LUA_AS_DEPENDENCY) $(TOLUA_AS_DEPENDENCY) \
-      ../server/generator/libgenerator.a
+civmanual_DEPENDENCIES = ../common/libfreeciv-common.la \
+	../server/libfreeciv-srv.la \
+	../client/helpdata.o \
+	$(LUA_AS_DEPENDENCY) $(TOLUA_AS_DEPENDENCY)
 civmanual_LDFLAGS = $(GGZDMOD_LDFLAGS)
-civmanual_LDADD        = ../utility/libcivutility.a ../common/libcivcommon.a \
-      ../ai/libcivai.a ../utility/libcivutility.a ../server/libcivserver.a \
-      $(INTLLIBS) ../client/helpdata.o \
-      ../utility/libcivutility.a ../common/libcivcommon.a ../ai/libcivai.a \
-      ../utility/libcivutility.a ../server/libcivserver.a \
-      ../utility/libcivutility.a ../common/aicore/libaicore.a \
-      ../server/scripting/libscripting.a \
-      $(LUA_LIBS) $(TOLUA_LIBS) \
-      ../server/generator/libgenerator.a \
-      $(SERVER_LIBS) $(AUTH_LIBS) $(LIB_GGZDMOD)
+civmanual_LDADD = \
+	../common/libfreeciv-common.la \
+	../server/libfreeciv-srv.la \
+	$(INTLLIBS) ../client/helpdata.o \
+	$(LUA_LIBS) $(TOLUA_LIBS) \
+	$(SERVER_LIBS) $(AUTH_LIBS) $(LIB_GGZDMOD)
diff --git a/server/Makefile.am b/server/Makefile.am
index 793975e..a522002 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -3,7 +3,7 @@
 SUBDIRS=	generator scripting
 
 bin_PROGRAMS = civserver
-noinst_LIBRARIES = libcivserver.a
+noinst_LTLIBRARIES = libfreeciv-srv.la
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/utility -I$(srcdir)/../common -I$(srcdir)/../ai \
 	-I$(top_srcdir)/common/aicore \
@@ -18,7 +18,7 @@ civserver_SOURCES = \
 		civserver.c	\
 		civserver.h
 
-libcivserver_a_SOURCES = \
+libfreeciv_srv_la_SOURCES = \
 		airgoto.c	\
 		airgoto.h	\
 		auth.c		\
@@ -91,21 +91,22 @@ libcivserver_a_SOURCES = \
 # outside this directory (when building common) there's no point in
 # setting them to BUILT_SOURCES.
 
-civserver_DEPENDENCIES = ../utility/libcivutility.a ../common/libcivcommon.a \
-      ../ai/libcivai.a ../utility/libcivutility.a ./libcivserver.a \
-      ../utility/libcivutility.a ../common/aicore/libaicore.a \
-      ./scripting/libscripting.a \
-      $(LUA_AS_DEPENDENCY) $(TOLUA_AS_DEPENDENCY) \
-      ./generator/libgenerator.a
+libfreeciv_srv_la_LIBADD = \
+	./scripting/libfreeciv-script.la \
+	./generator/libfreeciv-mapgen.la \
+	../ai/libfreeciv-ai.la
+
+civserver_DEPENDENCIES = \
+	../common/libfreeciv-common.la \
+	./libfreeciv-srv.la \
+	$(LUA_AS_DEPENDENCY) $(TOLUA_AS_DEPENDENCY)
 civserver_LDFLAGS = $(GGZDMOD_LDFLAGS)
-civserver_LDADD        = ../utility/libcivutility.a ../common/libcivcommon.a \
-      ../ai/libcivai.a ../utility/libcivutility.a ./libcivserver.a $(INTLLIBS) \
-      ../utility/libcivutility.a ../common/libcivcommon.a ../ai/libcivai.a \
-      ../utility/libcivutility.a ./libcivserver.a ../utility/libcivutility.a \
-      ../common/aicore/libaicore.a ./generator/libgenerator.a \
-      ./scripting/libscripting.a \
-      $(LUA_LIBS) $(TOLUA_LIBS) \
-      $(AUTH_LIBS) $(SERVER_LIBS) $(LIB_GGZDMOD) $(SERVERICON)
+civserver_LDADD   = \
+	../common/libfreeciv-common.la \
+	./libfreeciv-srv.la \
+	$(INTLLIBS) \
+	$(LUA_LIBS) $(TOLUA_LIBS) \
+	$(AUTH_LIBS) $(SERVER_LIBS) $(LIB_GGZDMOD) $(SERVERICON)
 
 desktopfiledir = $(prefix)/share/applications
 desktopfile_DATA = \
diff --git a/server/generator/Makefile.am b/server/generator/Makefile.am
index f1ef316..2dfe097 100644
--- a/server/generator/Makefile.am
+++ b/server/generator/Makefile.am
@@ -1,9 +1,9 @@
 ## Process this file with automake to produce Makefile.in
-noinst_LIBRARIES = libgenerator.a
+noinst_LTLIBRARIES = libfreeciv-mapgen.la
 
 AM_CPPFLAGS = -I$(top_srcdir)/utility -I$(top_srcdir)/common -I$(top_srcdir)/server -I$(top_srcdir)/server/generator
 
-libgenerator_a_SOURCES = \
+libfreeciv_mapgen_la_SOURCES = \
 	mapgen.c \
 	mapgen.h \
 	mapgen_topology.c \
diff --git a/server/scripting/Makefile.am b/server/scripting/Makefile.am
index d82add9..3bd416d 100644
--- a/server/scripting/Makefile.am
+++ b/server/scripting/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libscripting.a
+noinst_LTLIBRARIES = libfreeciv-script.la
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/utility -I$(top_srcdir)/common \
@@ -8,7 +8,7 @@ AM_CPPFLAGS = \
 	$(LUA_CFLAGS) $(TOLUA_CFLAGS)
 
 # api_gen.[ch] are now distributed to aid in cross-compiling.  See PR#13571.
-dist_libscripting_a_SOURCES = \
+dist_libfreeciv_script_la_SOURCES = \
 		api_actions.c	\
 		api_actions.h	\
 		api_find.c	\
diff --git a/utility/Makefile.am b/utility/Makefile.am
index 106d87f..30e01aa 100644
--- a/utility/Makefile.am
+++ b/utility/Makefile.am
@@ -2,9 +2,9 @@
 
 SUBDIRS=        ftwl
 
-noinst_LIBRARIES = libcivutility.a
+noinst_LTLIBRARIES = libfreeciv-util.la
 
-libcivutility_a_SOURCES = \
+libfreeciv_util_la_SOURCES = \
 		astring.c       \
 		astring.h       \
 		capability.c	\
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to