-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support linking a custom libzmq again
Closes #13.
- Loading branch information
Showing
5 changed files
with
107 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
SUBDIRS = libzmq | ||
SUBDIRS = $(MAYBE_LIBZMQ) | ||
ACLOCAL_AMFLAGS = -I m4 | ||
|
||
lib_LTLIBRARIES = emacs-zmq.la | ||
|
||
emacs_zmq_la_CFLAGS = | ||
emacs_zmq_la_LDFLAGS = -module -avoid-version | ||
if WINDOWS | ||
emacs_zmq_la_LDFLAGS += -no-undefined | ||
endif | ||
|
||
if ZMQ_BUILD_LOCALLY | ||
# Its necessary to pass static libraries directly to the linker since libtool | ||
# won't build emacs-zmq as a dynamic module on Windows otherwise. | ||
emacs_zmq_la_LDFLAGS += -Wl,libzmq/src/.libs/libzmq.a | ||
emacs_zmq_la_SOURCES = socket.c context.c msg.c constants.c util.c core.c poll.c emacs-zmq.c | ||
emacs_zmq_la_CFLAGS += -Ilibzmq/include | ||
emacs_zmq_la_CPPFLAGS = -DZMQ_BUILD_DRAFT_API=1 | ||
emacs_zmq_la_CFLAGS = -O3 -Ilibzmq/include | ||
endif | ||
emacs_zmq_la_SOURCES = socket.c context.c msg.c constants.c util.c core.c poll.c emacs-zmq.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,81 @@ | ||
AC_PREREQ([2.69]) | ||
AC_INIT([emacs-zmq], [0.10.9], [[email protected]]) | ||
|
||
# Ensure the libzmq/configure script is generated | ||
cd libzmq | ||
if test "`git describe --candidates=0 2>/dev/null || echo x`" != v$ZMQ_VERSION; then | ||
echo "Checking out libzmq" | ||
git checkout --quiet master | ||
git pull --quiet origin | ||
git checkout v$ZMQ_VERSION | ||
rm -f configure | ||
fi | ||
if test ! -e configure; then | ||
echo "Generating libzmq configure script" | ||
./autogen.sh | ||
fi | ||
cd .. | ||
|
||
AC_CONFIG_SRCDIR([core.c]) | ||
AC_CONFIG_MACRO_DIRS([m4]) | ||
AM_INIT_AUTOMAKE([-Wall -Wno-override foreign]) | ||
AC_PROG_CC | ||
AM_PROG_AR | ||
AC_CANONICAL_HOST | ||
AC_CONFIG_SUBDIRS([libzmq]) | ||
|
||
case "${host_os}" in | ||
*darwin*) | ||
;; | ||
*mingw*|*msys*|*cygwin*) | ||
export CXXFLAGS="-static-libgcc -static-libstdc++ $CXXFLAGS" | ||
# Its necessary to pass these to the linker directly since libtool | ||
# won't build emacs-zmq as a dynamic module otherwise on Windows. | ||
export LDFLAGS="-Wl,-l:libstdc++.a -Wl,-l:libgcc.a -Wl,-lws2_32 -Wl,-liphlpapi $LDFLAGS" | ||
on_windows=yes | ||
;; | ||
*) | ||
# Assume GCC compatible compiler | ||
# TODO: Actually check for this | ||
# Prevent dynamic linkage of libzmq dependencies | ||
# | ||
# PIC is needed since we are most likely building libzmq statically, | ||
# but would like to link it to the dynamic emacs-zmq library. GCC needs | ||
# to have this explicitly specified. | ||
# | ||
# The -fPIC for CFLAGS is needed even though emacs-zmq is already a dynamic | ||
# library since libzmq comes packaged with tweetnacl which is a C library and | ||
# it builds that by default. | ||
export CXXFLAGS="-fPIC -static-libgcc -static-libstdc++ $CXXFLAGS" | ||
export CFLAGS="-fPIC $CFLAGS" | ||
export LDFLAGS="-Wl,-l:libstdc++.a -Wl,-l:libgcc.a $LDFLAGS" | ||
;; | ||
esac | ||
PKG_CHECK_MODULES([ZMQ], [libzmq], [ | ||
AC_SEARCH_LIBS([zmq_poller_new], [zmq], [ | ||
dnl FIXME: This isn't necessarily true in ZMQ >= 4.3 | ||
AC_DEFINE([ZMQ_BUILD_DRAFT_API], 1) | ||
], [ | ||
AC_MSG_NOTICE([incompatible libzmq, building one locally]) | ||
ZMQ_BUILD_LOCALLY=yes | ||
]) | ||
], [ | ||
AC_MSG_NOTICE([libzmq not found by pkg-config, building one locally]) | ||
ZMQ_BUILD_LOCALLY=yes | ||
]) | ||
|
||
AM_CONDITIONAL(WINDOWS, [test "x$on_windows" != x]) | ||
if test "x$ZMQ_BUILD_LOCALLY" != x; then | ||
if test "x$ZMQ_VERSION" == x; then ZMQ_VERSION="4.3.1"; fi | ||
if test "x$ZMQ_GIT_REPO" == x; then ZMQ_GIT_REPO="https://github.com/zeromq/libzmq"; fi | ||
if test ! -d libzmq/.git; then git clone $ZMQ_GIT_REPO libzmq; fi | ||
AC_CONFIG_SUBDIRS([libzmq]) | ||
# Ensure the libzmq/configure script is generated | ||
cd libzmq | ||
if test "`git describe --candidates=0 2>/dev/null || echo x`" != "v${ZMQ_VERSION}"; then | ||
git checkout --quiet master | ||
git pull --quiet origin | ||
git checkout "v$ZMQ_VERSION" | ||
rm -f configure | ||
fi | ||
if test ! -e configure; then | ||
echo "Generating libzmq configure script" | ||
./autogen.sh | ||
fi | ||
cd .. | ||
case "${host_os}" in | ||
*darwin*) | ||
;; | ||
*mingw*|*msys*|*cygwin*) | ||
export CXXFLAGS="-static-libgcc -static-libstdc++ $CXXFLAGS" | ||
# Its necessary to pass these to the linker directly since libtool | ||
# won't build emacs-zmq as a dynamic module otherwise on Windows. | ||
export LDFLAGS="-Wl,-l:libstdc++.a -Wl,-l:libgcc.a -Wl,-lws2_32 -Wl,-liphlpapi $LDFLAGS" | ||
ON_WINDOWS=yes | ||
;; | ||
*) | ||
# Assume GCC compatible compiler | ||
# TODO: Actually check for this | ||
# Prevent dynamic linkage of libzmq dependencies | ||
# | ||
# PIC is needed since we are most likely building libzmq | ||
# statically, but would like to link it to the dynamic emacs-zmq | ||
# library. GCC needs to have this explicitly specified. | ||
# | ||
# The -fPIC for CFLAGS is needed even though emacs-zmq is already a | ||
# dynamic library since libzmq comes packaged with tweetnacl which | ||
# is a C library and it builds that by default. | ||
export CXXFLAGS="-fPIC -static-libgcc -static-libstdc++ $CXXFLAGS" | ||
export CFLAGS="-fPIC $CFLAGS" | ||
export LDFLAGS="-Wl,-l:libstdc++.a -Wl,-l:libgcc.a $LDFLAGS" | ||
;; | ||
esac | ||
fi | ||
|
||
AM_CONDITIONAL(WINDOWS, [test "x$ON_WINDOWS" != x]) | ||
AM_CONDITIONAL(ZMQ_BUILD_LOCALLY, [test "x$ZMQ_BUILD_LOCALLY" != x]) | ||
if test "x$ZMQ_BUILD_LOCALLY" != x; then | ||
MAYBE_LIBZMQ=libzmq | ||
else | ||
MAYBE_LIBZMQ= | ||
fi | ||
AC_SUBST([MAYBE_LIBZMQ]) | ||
|
||
LT_INIT([win32-dll shared disable-static]) | ||
AC_CONFIG_FILES([Makefile]) | ||
|
6120251
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!