]> git.pond.sub.org Git - empserver/commitdiff
Clean up autoconfiguration of libraries
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 12 Apr 2009 17:11:58 +0000 (19:11 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 13 Apr 2009 10:55:15 +0000 (12:55 +0200)
Make configure compute three sets of libraries: LIBS_client for the
client, LIBS_server for the server, and LIBS for the rest.  This
replaces termlibs.

Unfortunately, LIBS doesn't work with Windows, because
src/lib/w32/posixio.c pulls in socket stuff.  Temporary workaround:
use LIBS_server instead.

GNUmakefile.in
Make.mk
configure.ac

index 024755414972e5b3c8ef0a868cc570d3a3e6602c..6c58ab9e478e2f60a7be3903f8d73ce8fa459f47 100644 (file)
@@ -43,7 +43,9 @@ CFLAGS := @CFLAGS@
 CPPFLAGS := @CPPFLAGS@ @DEFS@
 LDFLAGS := @LDFLAGS@
 LIBOBJS := @LIBOBJS@
-LDLIBS := @LIBS@
+LDLIBS := @LIBS@ -lm
+LIBS_client := @LIBS_client@ -lm
+LIBS_server := @LIBS_server@ -lm
 empthread := @empthread@
 ifeq ($(empthread),POSIX)
 CC := @PTHREAD_CC@
@@ -54,7 +56,6 @@ endif
 ifeq ($(empthread),Windows)
 CFLAGS := $(CFLAGS) -mthreads
 endif
-termlibs := @termlibs@
 CCDEPMODE := @CCDEPMODE@
 @am__fastdepCC_TRUE@how_to_dep := fast
 @am__fastdepCC_FALSE@@AMDEP_TRUE@how_to_dep := depcomp
diff --git a/Make.mk b/Make.mk
index ddee0722ac0442f133b877b3bac6a0e7592eb5f3..7ba5f46ad7e2788f0083bfd46c775d218ae1c0f5 100644 (file)
--- a/Make.mk
+++ b/Make.mk
@@ -160,8 +160,12 @@ CFLAGS += -Wall -W -Wno-unused-parameter -Wpointer-arith   \
 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs      \
 -Wredundant-decls
 endif
-LDLIBS += -lm
-$(client): LDLIBS += $(termlibs)
+ifeq ($(empthread),Windows)    # really: W32, regardless of thread package
+# FIXME split src/lib/w32/posixio.c
+LDLIBS := $(LIBS_server)
+endif
+$(client): LDLIBS := $(LIBS_client)
+$(server): LDLIBS := $(LIBS_server)
 
 ### Advertized goals
 
@@ -275,7 +279,7 @@ $(server): $(filter src/server/% src/lib/commands/% src/lib/player/% src/lib/sub
 
 $(client): $(filter src/client/%, $(obj)) src/lib/global/version.o
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
-ifeq ($(empthread),Windows)
+ifeq ($(empthread),Windows)    # really: W32, regardless of thread package
 $(client): src/lib/w32/getopt.o
 endif
 
index 2faa2427900cfff797852e40869a93e0c8d78a8f..9157b1979c94e6bc73d7502bdbd603d2f9f82e8c 100644 (file)
@@ -69,16 +69,15 @@ MY_WINDOWS_API
 
 ### Checks for libraries
 ACX_PTHREAD
+save_LIBS="$LIBS"
 LIBS="$LIBS_SOCKETS $LIBS"
 LIB_SOCKET_NSL
-
-# TODO turn this into a macro?
-save_LIBS=$LIBS
+LIBS_server="$LIBS"
 AC_SEARCH_LIBS([setupterm], [termlib termcap curses ncurses])
-# FIXME if not found, complain and switch off highlighting
-termlibs=`echo $LIBS | sed s/\`echo $save_LIBS | sed 's/././g'\`'$//'`
-AC_SUBST(termlibs)
-LIBS=$save_LIBS
+LIBS_client="$LIBS"
+LIBS="$save_LIBS"
+AC_SUBST(LIBS_server)
+AC_SUBST(LIBS_client)
 
 
 ### Checks for header files