this is quick and dirty, and not completely tested yet, but it makes my life a little bit easier, since I don't install stuff in /usr ever.
Dave.
From 1d0ed0d05742917bb1f665578f2cc0d6e8d64c8e Mon Sep 17 00:00:00 2001 From: Dave Airlie <airl...@starflyer.(none)> Date: Fri, 26 Mar 2010 17:57:22 +1000 Subject: [PATCH] slirp: auto/libtool support. this just does a basic conversion to using autotools + libtool --- Makefile | 91 ---------------------------------------------------------- Makefile.am | 28 ++++++++++++++++++ configure.ac | 27 +++++++++++++++++ slirp.pc | 11 ------- slirp.pc.in | 11 +++++++ 5 files changed, 66 insertions(+), 102 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 configure.ac delete mode 100644 slirp.pc create mode 100644 slirp.pc.in diff --git a/Makefile b/Makefile deleted file mode 100644 index 929af78..0000000 --- a/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -CC = gcc - -CFLAGS = -fvisibility=hidden -fPIC -DPIC -Wall -Wno-sign-compare -Werror -fno-strict-overflow -LDFLAGS = -fPIC -TARGET = RELEASE - -ifeq ($(TARGET),DEBUG) - CFLAGS += -g -O0 - TARGETNAME = debug -else ifeq ($(TARGET),RELEASE) - CFLAGS += -g -O3 - TARGETNAME = release -else - TARGETNAME = $(error Invalid TARGET. Use DEBUG or RELEASE) -endif - -HEADERNAME = net_slirp.h -LIBNAME = libslirp.so -PCNAME = slirp.pc - -BIN = $(addprefix $(TARGETNAME)/, libslirp.so) - -INCLUDEDIR = /usr/include/libslirp -LIBDIR = /usr/lib64 -PKGCONFIGDIR = /usr/lib64/pkgconfig - -SRCS =\ - bootp.c\ - cksum.c\ - debug.c\ - if.c\ - ip_icmp.c\ - ip_input.c\ - ip_output.c\ - mbuf.c\ - misc.c\ - sbuf.c\ - net_slirp.c\ - tcp_input.c\ - tcp_output.c\ - tcp_subr.c\ - tcp_timer.c\ - udp.c\ - socket.c\ - $(NULL) - -TMP = $(SRCS:.c=.o) -OBJ = $(addprefix $(TARGETNAME)/, $(TMP)) - -STATIC_LIBS = -DYNAMIC_LIBS = - -LIBS = -Wl,-Bstatic $(addprefix -l, $(STATIC_LIBS)) -Wl,-Bdynamic $(addprefix -l, $(DYNAMIC_LIBS)) - -all : $(BIN) link - -$(BIN) : $(TARGETNAME) $(OBJ) - $(CC) -shared $(LDFLAGS) -o $(BIN) $(OBJ) $(LIBS) - -link : $(BIN) - rm -f $(LIBNAME) - ln -s $(BIN) - -MAKEDEPEND = $(CC) -M $(CFLAGS) -o $(addprefix $(TARGETNAME)/,.$*.dep.tmp) $< - -$(addprefix $(TARGETNAME)/, %.o) : %.c Makefile - @$(MAKEDEPEND) && \ - cp $(addprefix $(TARGETNAME)/, .$*.dep.tmp) $(addprefix $(TARGETNAME)/, .$*.dep) && \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(addprefix $(TARGETNAME)/,.$*.dep.tmp) >> $(addprefix $(TARGETNAME)/,.$*.dep) && \ - sed -i '1 s/^\(.\)/$(TARGETNAME)\/\1/' $(addprefix $(TARGETNAME)/, .$*.dep) && \ - rm -f $(addprefix $(TARGETNAME)/,.$*.dep.tmp) - $(CC) $(CFLAGS) -c -o $@ $< - -clean: - @rm -f $(TARGETNAME)/*.o $(TARGETNAME)/.*.dep $(TARGETNAME)/.*.dep.tmp $(BIN) - -$(TARGETNAME): - @mkdir -p $(TARGETNAME) - --include $(patsubst %.c, $(TARGETNAME)/.%.dep, $(SRCS)) - -install: - mkdir -p $(DESTDIR)/$(INCLUDEDIR) - cp $(LIBNAME) $(DESTDIR)/$(LIBDIR) - cp $(HEADERNAME) $(DESTDIR)/$(INCLUDEDIR) - cp $(PCNAME) $(DESTDIR)/$(PKGCONFIGDIR) -uninstall: - rm -f $(DESTDIR)/$(LIBDIR)/$(LIBNAME) - rm -f $(DESTDIR)/$(INCLUDEDIR)/$(HEADERNAME) - rm -f $(DESTDIR)/$(PKGCONFIGDIR)/$(PCNAME) diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..688d149 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,28 @@ + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = slirp.pc + +lib_LTLIBRARIES = libslirp.la + +libslirpinclude_HEADERS = net_slirp.h +libslirpincludedir = $(includedir) + +libslirp_la_SOURCES= bootp.c \ + cksum.c\ + debug.c\ + if.c\ + ip_icmp.c\ + ip_input.c\ + ip_output.c\ + mbuf.c\ + misc.c\ + sbuf.c\ + net_slirp.c\ + tcp_input.c\ + tcp_output.c\ + tcp_subr.c\ + tcp_timer.c\ + udp.c\ + socket.c \ + net_slirp.h + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..961df0b --- /dev/null +++ b/configure.ac @@ -0,0 +1,27 @@ +AC_PREREQ([2.57]) + +AC_INIT([libslirp], + 0.0.1, + [], + libslirp) +dnl +dnl This is the package version number, not the shared library +dnl version. This same version number must appear in Xfont.h +dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's +dnl not possible to extract the version number here from Xfont.h +dnl +AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_CONFIG_HEADER(config.h) + +# Check for progs +AC_PROG_CC +AC_PROG_LIBTOOL +dnl If the first PKG_CHECK_MODULES appears inside a conditional, pkg-config +dnl must first be located explicitly. +PKG_PROG_PKG_CONFIG + +# Look for headers + +AC_OUTPUT([Makefile + slirp.pc]) + diff --git a/slirp.pc b/slirp.pc deleted file mode 100644 index d463103..0000000 --- a/slirp.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/usr/local -exec_prefix=${prefix} -libdir=/usr/lib64 -includedir=/usr/include - -Name: slirp -Description: user network stack -Version: 0.1.0 -Requires: -Libs: -L${libdir} -lslirp -Cflags: -I${includedir}/libslirp diff --git a/slirp.pc.in b/slirp.pc.in new file mode 100644 index 0000000..bb31292 --- /dev/null +++ b/slirp.pc.in @@ -0,0 +1,11 @@ +pref...@prefix@ +exec_pref...@exec_prefix@ +libd...@libdir@ +included...@includedir@ + +Name: slirp +Description: user network stack +Version: @PACKAGE_VERSION@ +Requires: +Cflags: -I${includedir} +Libs: -L${libdir} -lslirp -- 1.6.6.1
_______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel