summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-04-11 01:28:40 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2019-04-11 01:31:18 +0200
commit745b9d128ff6a5a78c625b842b1767813fbcfb9c (patch)
tree7796d6ef936863499ef550252236ae8996621fd9
parent9137852945fe6c6535707cb743187381870d9cb4 (diff)
Configure: support building as static library
-rw-r--r--Makefile.in9
-rw-r--r--configure.ac3
2 files changed, 11 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index 9b32b062..045defea 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -25,6 +25,7 @@ INSTALL_DATA=@INSTALL_DATA@
client=$(addprefix $(exedir)/,@CLIENT@)
daemon=$(exedir)/bird
+static_lib=$(exedir)/libbird.a
protocols=@protocols@
prefix=@prefix@
@@ -70,6 +71,7 @@ all: daemon cli
daemon: $(daemon)
cli: $(client)
+static-lib: $(static_lib)
$(daemon): LIBS += $(DAEMON_LIBS)
@@ -82,7 +84,7 @@ cf-local = $(conf-y-targets): $(s)config.Y
src-o-files = $(patsubst %.c,$(o)%.o,$(src))
tests-target-files = $(patsubst %.c,$(o)%,$(tests_src))
-all-daemon = $(daemon): $(obj)
+all-daemon = $(static_lib): $(obj)
all-client = $(client): $(obj)
s = $(dir $(lastword $(MAKEFILE_LIST)))
@@ -140,6 +142,11 @@ $(client) $(daemon):
$(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+$(static_lib):
+ $(E)echo AR $(ARFLAGS) $@ $^
+ $(Q)$(AR) $(ARFLAGS) $@ $^
+ $(Q)$(RANLIB) $@
+
$(objdir)/sysdep/paths.h: Makefile
echo >$@ "/* Generated by Makefile, don't edit manually! */"
echo >>$@ "#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
diff --git a/configure.ac b/configure.ac
index d9bb8bc5..de4f813d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,7 @@ AC_ARG_WITH([iproutedir],
AC_ARG_VAR([FLEX], [location of the Flex program])
AC_ARG_VAR([BISON], [location of the Bison program])
AC_ARG_VAR([M4], [location of the M4 program])
+AC_ARG_VAR([AR], [location of the AR program])
if test "$srcdir" = . ; then
@@ -154,10 +155,12 @@ AC_PROG_RANLIB
AC_CHECK_PROG([FLEX], [flex], [flex])
AC_CHECK_PROG([BISON], [bison], [bison])
AC_CHECK_PROGS([M4], [gm4 m4])
+AC_CHECK_PROGS([AR], [ar])
test -z "$FLEX" && AC_MSG_ERROR([Flex is missing.])
test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
test -z "$M4" && AC_MSG_ERROR([M4 is missing.])
+test -z "$AR" && AC_MSG_ERROR([AR is missing.])
AC_MSG_CHECKING([bison version])
BIRD_CHECK_BISON_VERSION(BISON_VERSION)