Clean up autoconfiguration of libraries

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.
This commit is contained in:
Markus Armbruster 2009-04-12 19:11:58 +02:00
parent 55d0d975a5
commit 8b7786340e
3 changed files with 16 additions and 12 deletions

View file

@ -43,7 +43,9 @@ CFLAGS := @CFLAGS@
CPPFLAGS := @CPPFLAGS@ @DEFS@ CPPFLAGS := @CPPFLAGS@ @DEFS@
LDFLAGS := @LDFLAGS@ LDFLAGS := @LDFLAGS@
LIBOBJS := @LIBOBJS@ LIBOBJS := @LIBOBJS@
LDLIBS := @LIBS@ LDLIBS := @LIBS@ -lm
LIBS_client := @LIBS_client@ -lm
LIBS_server := @LIBS_server@ -lm
empthread := @empthread@ empthread := @empthread@
ifeq ($(empthread),POSIX) ifeq ($(empthread),POSIX)
CC := @PTHREAD_CC@ CC := @PTHREAD_CC@
@ -54,7 +56,6 @@ endif
ifeq ($(empthread),Windows) ifeq ($(empthread),Windows)
CFLAGS := $(CFLAGS) -mthreads CFLAGS := $(CFLAGS) -mthreads
endif endif
termlibs := @termlibs@
CCDEPMODE := @CCDEPMODE@ CCDEPMODE := @CCDEPMODE@
@am__fastdepCC_TRUE@how_to_dep := fast @am__fastdepCC_TRUE@how_to_dep := fast
@am__fastdepCC_FALSE@@AMDEP_TRUE@how_to_dep := depcomp @am__fastdepCC_FALSE@@AMDEP_TRUE@how_to_dep := depcomp

10
Make.mk
View file

@ -160,8 +160,12 @@ CFLAGS += -Wall -W -Wno-unused-parameter -Wpointer-arith \
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs \ -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs \
-Wredundant-decls -Wredundant-decls
endif endif
LDLIBS += -lm ifeq ($(empthread),Windows) # really: W32, regardless of thread package
$(client): LDLIBS += $(termlibs) # FIXME split src/lib/w32/posixio.c
LDLIBS := $(LIBS_server)
endif
$(client): LDLIBS := $(LIBS_client)
$(server): LDLIBS := $(LIBS_server)
### Advertized goals ### 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 $(client): $(filter src/client/%, $(obj)) src/lib/global/version.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
ifeq ($(empthread),Windows) ifeq ($(empthread),Windows) # really: W32, regardless of thread package
$(client): src/lib/w32/getopt.o $(client): src/lib/w32/getopt.o
endif endif

View file

@ -69,16 +69,15 @@ MY_WINDOWS_API
### Checks for libraries ### Checks for libraries
ACX_PTHREAD ACX_PTHREAD
save_LIBS="$LIBS"
LIBS="$LIBS_SOCKETS $LIBS" LIBS="$LIBS_SOCKETS $LIBS"
LIB_SOCKET_NSL LIB_SOCKET_NSL
LIBS_server="$LIBS"
# TODO turn this into a macro?
save_LIBS=$LIBS
AC_SEARCH_LIBS([setupterm], [termlib termcap curses ncurses]) AC_SEARCH_LIBS([setupterm], [termlib termcap curses ncurses])
# FIXME if not found, complain and switch off highlighting LIBS_client="$LIBS"
termlibs=`echo $LIBS | sed s/\`echo $save_LIBS | sed 's/././g'\`'$//'` LIBS="$save_LIBS"
AC_SUBST(termlibs) AC_SUBST(LIBS_server)
LIBS=$save_LIBS AC_SUBST(LIBS_client)
### Checks for header files ### Checks for header files