From c56f8229e5985b5005ec7c01fdaff1fe6e19285a Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 28 Feb 2012 01:50:58 -0500 Subject: [PATCH] Build with bundled libstddjb selfpipe by default Signed-off-by: Anders Kaseorg --- Makefile.am | 2 +- configure.ac | 32 +++++++++++++++++++++++++------- src/examples/Makefile.am | 9 +++++++-- src/frontend/Makefile.am | 9 +++++++-- third/Makefile.am | 4 ++++ third/libstddjb/Makefile.am | 35 +++++++++++++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 12 deletions(-) create mode 100644 third/Makefile.am create mode 100644 third/libstddjb/Makefile.am diff --git a/Makefile.am b/Makefile.am index 9a3f2d2..df5808f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,3 @@ ACLOCAL_AMFLAGS = --install -I m4 -SUBDIRS = src scripts man +SUBDIRS = third src scripts man EXTRA_DIST = ocb-license.html README.md diff --git a/configure.ac b/configure.ac index e9b8777..e64280f 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) # Checks for programs. +AC_PROG_CC AC_PROG_CXX AC_PROG_RANLIB AC_PATH_PROG([PROTOC], [protoc], [AC_MSG_ERROR([protoc is not found])]) @@ -55,7 +56,8 @@ AC_ARG_WITH([skalibs], [with_skalibs=$withval AS_IF([test x"$withval" != xyes], [SKALIBS_CPPFLAGS="-I$withval/include" - SKALIBS_LDFLAGS="-L$withval/lib"])]) + SKALIBS_LDFLAGS="-L$withval/lib"])], + [with_skalibs=no]) AC_ARG_WITH([skalibs-include], [AS_HELP_STRING([--with-skalibs-include=DIR], [specify exact include dir for skalibs headers])], @@ -65,11 +67,12 @@ AC_ARG_WITH([skalibs-libdir], [specify exact library dir for skalibs libraries])], [SKALIBS_LDFLAGS="-L$withval"]) -AX_CHECK_LIBRARY([SKALIBS], [selfpipe.h], [stddjb], [], - [AC_MSG_ERROR([Unable to find skalibs.])]) - -AC_SUBST([STDDJB_CPPFLAGS], ["$SKALIBS_CPPFLAGS"]) -AC_SUBST([STDDJB_LDFLAGS], ["$SKALIBS_LDFLAGS -lstddjb"]) +AM_CONDITIONAL([COND_THIRD_LIBSTDDJB], [test x"$with_skalibs" = xno]) +AS_IF([test x"$with_skalibs" != xno], + [AX_CHECK_LIBRARY([SKALIBS], [selfpipe.h], [stddjb], [], + [AC_MSG_ERROR([Unable to find skalibs.])]) + AC_SUBST([STDDJB_CPPFLAGS], ["$SKALIBS_CPPFLAGS"]) + AC_SUBST([STDDJB_LDFLAGS], ["$SKALIBS_LDFLAGS -lstddjb"])]) # Checks for header files. AC_CHECK_HEADERS([arpa/inet.h fcntl.h langinfo.h limits.h locale.h netinet/in.h pty.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termios.h unistd.h util.h wchar.h wctype.h]) @@ -130,5 +133,20 @@ AC_CHECK_DECL([IP_MTU_DISCOVER], # Checks for protobuf PKG_CHECK_MODULES([protobuf], [protobuf]) -AC_CONFIG_FILES([Makefile src/Makefile src/crypto/Makefile src/frontend/Makefile src/network/Makefile src/protobufs/Makefile src/statesync/Makefile src/terminal/Makefile src/util/Makefile scripts/Makefile src/examples/Makefile man/Makefile]) +AC_CONFIG_FILES([ + Makefile + third/Makefile + third/libstddjb/Makefile + src/Makefile + src/crypto/Makefile + src/frontend/Makefile + src/network/Makefile + src/protobufs/Makefile + src/statesync/Makefile + src/terminal/Makefile + src/util/Makefile + scripts/Makefile + src/examples/Makefile + man/Makefile +]) AC_OUTPUT diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am index a02a391..d62bf1f 100644 --- a/src/examples/Makefile.am +++ b/src/examples/Makefile.am @@ -18,8 +18,13 @@ parse_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a -lutil $(BOOST termemu_SOURCES = termemu.cc termemu_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(builddir)/../protobufs termemu_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync/libmoshstatesync.a ../protobufs/libmoshprotos.a -lutil $(BOOST_LDFLAGS) $(protobuf_LIBS) -termemu_CPPFLAGS += $(STDDJB_CPPFLAGS) -termemu_LDADD += $(STDDJB_LDFLAGS) +if COND_THIRD_LIBSTDDJB + termemu_CPPFLAGS += -I$(top_srcdir)/third/libstddjb + termemu_LDADD += $(top_builddir)/third/libstddjb/libstddjb.a +else + termemu_CPPFLAGS += $(STDDJB_CPPFLAGS) + termemu_LDADD += $(STDDJB_LDFLAGS) +endif ntester_SOURCES = ntester.cc ntester_CPPFLAGS = -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I$(builddir)/../protobufs $(BOOST_CPPFLAGS) diff --git a/src/frontend/Makefile.am b/src/frontend/Makefile.am index 66abb02..6911006 100644 --- a/src/frontend/Makefile.am +++ b/src/frontend/Makefile.am @@ -1,8 +1,13 @@ AM_CPPFLAGS = -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I$(builddir)/../protobufs -I$(srcdir)/../util $(BOOST_CPPFLAGS) $(protobuf_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) -fno-default-inline -pipe LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a -lutil -lm $(protobuf_LIBS) -AM_CPPFLAGS += $(STDDJB_CPPFLAGS) -LDADD += $(STDDJB_LDFLAGS) +if COND_THIRD_LIBSTDDJB + AM_CPPFLAGS += -I$(top_srcdir)/third/libstddjb + LDADD += $(top_builddir)/third/libstddjb/libstddjb.a +else + AM_CPPFLAGS += $(STDDJB_CPPFLAGS) + LDADD += $(STDDJB_LDFLAGS) +endif bin_PROGRAMS = mosh-client mosh-server diff --git a/third/Makefile.am b/third/Makefile.am new file mode 100644 index 0000000..ba3cbf9 --- /dev/null +++ b/third/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = +if COND_THIRD_LIBSTDDJB + SUBDIRS += libstddjb +endif diff --git a/third/libstddjb/Makefile.am b/third/libstddjb/Makefile.am new file mode 100644 index 0000000..29454af --- /dev/null +++ b/third/libstddjb/Makefile.am @@ -0,0 +1,35 @@ +AM_CFLAGS = -pedantic -Wall -Wextra -pipe + +noinst_LIBRARIES = libstddjb.a + +libstddjb_a_SOURCES = \ + allreadwrite.h \ + coe.c \ + djbunix.h \ + error.h \ + fd_close.c \ + fd_read.c \ + fd_write.c \ + gccattributes.h \ + ndelay_on.c \ + nsig.h \ + pipe_internal.c \ + sanitize_read.c \ + selfpipe-internal.h \ + selfpipe.h \ + selfpipe_finish.c \ + selfpipe_init.c \ + selfpipe_internal.c \ + selfpipe_read.c \ + selfpipe_trap.c \ + selfpipe_trapset.c \ + selfpipe_untrap.c \ + sig.h \ + sig_restoreto.c \ + skalibs-config.h \ + skasig_dfl.c \ + skasigaction.c \ + sysdeps.h \ + uint64.h + +EXTRA_DIST = COPYING