From: Alan T. DeKok Date: Sun, 19 Jun 2011 10:02:41 +0000 (+0200) Subject: Start of work to remove need for libtool && libltdl X-Git-Tag: release_3_0_0_beta0~762 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbd2461a9d2d3e0db00f6b319ee89719d7c1db7e;p=thirdparty%2Ffreeradius-server.git Start of work to remove need for libtool && libltdl For now, we rely on gcc to do most of the heavy lifting for us. This hinders portability, but people can always fall back to libtool. --- diff --git a/Make.inc.in b/Make.inc.in index 854badede61..dce571edfc1 100644 --- a/Make.inc.in +++ b/Make.inc.in @@ -107,3 +107,39 @@ ifneq ($(SCAN),) CC := $(SCAN)/scan-build gcc -DFR_SCAN_BUILD LIBTOOL := endif + +# +# Portability cruft. This is for replacing libtroll && libltdl +# with gcc and dlopen(). +# +ifeq "$(USE_SHARED_LIBS)" "yes" +LINK_MODE.exe = -export-dynamic +CFLAGS += -fPIC +else +LINK_MODE.exe = -static +endif + +ifneq "$(LIBTOOL)" "" +COMPILE.c := $(LIBTOOL) --mode=compile $(CC) +LINK.lib := $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) -rpath $(libdir) -o +LO := lo +LA := la +else +COMPILE.c := $(CC) +LO := o + +ifeq "$(USE_SHARED_LIBS)" "yes" +LINK.lib := $(CC) -shared -o +LA := so +else +LINK.lib := $(AR) cru +LA := a +endif + +endif + +ifeq "$(LA)" "so" +ifneq "$(findstring Darwin,$(shell uname -a))" "" +LA := dylib +endif +endif diff --git a/src/lib/Makefile b/src/lib/Makefile index 25572015cd7..135c2b3dcc9 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -12,7 +12,7 @@ SRCS = dict.c filters.c hash.c hmac.c hmacsha1.c isaac.c log.c \ valuepair.c fifo.c packet.c event.c getaddrinfo.c vqp.c \ heap.c dhcp.c tcp.c -LT_OBJS = $(SRCS:.c=.lo) +LT_OBJS = $(SRCS:.c=.$(LO)) INCLUDES = ../include/radius.h ../include/libradius.h \ ../include/missing.h ../include/autoconf.h \ @@ -25,29 +25,22 @@ CFLAGS += -D_LIBRADIUS -I$(top_builddir)/src # the other end is doing. #CFLAGS += -DHMAC_SHA1_DATA_PROBLEMS -ifeq ($(USE_SHARED_LIBS),yes) -LINK_MODE = -export-dynamic -else -LINK_MODE = -static -endif - TARGET = $(LIBPREFIX)freeradius-radius # Define new rule for libtool objects -%.lo : %.c - $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $< +%.$(LO) : %.c + $(COMPILE.c) $(CFLAGS) -c $< .PHONY: all clean install reconfig -all: $(TARGET).la +all: $(TARGET).$(LA) -$(TARGET).la: $(LT_OBJS) - $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) \ - $(LDFLAGS) $(LINK_MODE) -o $@ -rpath $(libdir) $^ +$(TARGET).$(LA): $(LT_OBJS) + $(LINK.lib) $@ $(LDFLAGS) $^ $(LT_OBJS): $(INCLUDES) clean: - rm -f *.o *.lo $(TARGET).la + rm -f *.$(LO) $(TARGET).$(LA) rm -rf .libs install: all