Skip to content
Browse files

Fixed configuration issues on Darwin

  • Loading branch information...
1 parent 0ea2ead commit 45c95baa915fd502fc854f45753d40c1dd680cd0 @saleyn saleyn committed Jun 3, 2010
Showing with 33 additions and 10 deletions.
  1. +1 −1 bootstrap
  2. +5 −5 c_src/Makefile.in
  3. +27 −4 configure.ac
View
2 bootstrap
@@ -1,4 +1,4 @@
#!/bin/sh
-sed 's/[^=]\+=//' ./vsn.mk > m4/version
+sed 's/VSN=//' ./vsn.mk > m4/version
autoreconf --install
View
10 c_src/Makefile.in
@@ -8,26 +8,26 @@ MKDIR_P=@MKDIR_P@
INSTALL=@INSTALL@
INST_DIR=../priv
DIST_DIR=@PACKAGE_INSTALL_DIR@/$(notdir $(INST_DIR))
+LIBZMQ_SO=$(INST_DIR)/zmq_drv@LIB_EXT@
zmq_drv_so_CXXFLAGS=-Wall $(if $(debug),-DZMQDRV_DEBUG) $(CXXFLAGS)
zmq_drv_so_LDFLAGS=-shared -fPIC $(LDFLAGS) -lpthread
-all: $(INST_DIR) $(INST_DIR)/zmq_drv.so
+all: $(INST_DIR) $(LIBZMQ_SO)
$(INST_DIR):
$(MKDIR_P) $@
-$(INST_DIR)/zmq_drv.so: zmq_drv.cpp
+$(LIBZMQ_SO): zmq_drv.cpp
$(CXX) -o $@ $< ${zmq_drv_so_CXXFLAGS} ${zmq_drv_so_LDFLAGS}
clean:
- rm -rf zmq_drv.o $(INST_DIR)/zmq_drv.so
+ -rm -rf zmq_drv.o $(LIBZMQ_SO)*
distclean: clean
rm Makefile
install:
$(MKDIR_P) $(DIST_DIR) $(dir $(DIST_DIR))c_src
$(INSTALL) zmq_drv.{h,cpp} $(dir $(DIST_DIR))c_src/
- $(INSTALL) $(INST_DIR)/zmq_drv.so $(DIST_DIR)/
- $(INSTALL) $(INST_DIR)/zmq_drv.so $(DIST_DIR)/
+ $(INSTALL) $(LIBZMQ_SO) $(DIST_DIR)/
View
31 configure.ac
@@ -1,5 +1,3 @@
-dnl AC_INIT([zmq], [0.0], [http://github.com/saleyn/erlzmq/issues])
-dnl AC_INIT([zmq], m4_normalize(esyscmd([. ./vsn.mk; echo ${VSN}])), [http://github.com/saleyn/erlzmq/issues])
dnl Note that the `version' file needs to be created/deleted externally from vsn.mk
AC_INIT([zmq], m4_normalize(m4_include(m4/version)), [http://github.com/saleyn/erlzmq/issues])
AC_CONFIG_AUX_DIR([build-aux])
@@ -22,6 +20,8 @@ dnl AM_ENABLE_SHARED
dnl AC_PROG_LIBTOOL
dnl AC_PATH_PROG(PKG_CONFIG, pkg-config, [AC_MSG_ERROR([pkg-config was not found!])])
+AC_CANONICAL_HOST
+
dnl ------------------------------------------------------------------
dnl Erlang environment.
dnl ------------------------------------------------------------------
@@ -95,10 +95,10 @@ if test "x${enable_debug}" = "xyes"; then
AC_DEFINE([DEBUG], [], [Enable debug])
AC_SUBST([DEBUG], [1])
AC_SUBST([ERL_FLAGS], [+debug_info -Ddebug])
- CXXFLAGS="-O0 -DDEBUG"
+ CXXFLAGS="-O0 -DDEBUG $CXXFLAGS"
else
AC_SUBST([ERL_FLAGS], [])
- CXXFLAGS="-O3 -DNDEBUG"
+ CXXFLAGS="-O3 -DNDEBUG $CXXFLAGS"
fi
dnl Treat warnings as errors.
@@ -150,6 +150,27 @@ CXXFLAGS="${CXXFLAGS# } -I${with_zeromq}/include"
LDFLAGS="${LDFLAGS# } -L${with_zeromq}/lib -lzmq"
dnl ------------------------------------------------------------------
+dnl OS specific tests.
+dnl ------------------------------------------------------------------
+
+case "${host_os}" in
+ *darwin*)
+ DARWIN_CXXFLAGS="-dynamiclib -Wl,-undefined -Wl,dynamic_lookup"
+ CXXFLAGS="-D_DARWIN_C_SOURCE $DARWIN_CXXFLAGS $CXXFLAGS"
+ AC_SUBST([LIB_EXT], [.dylib])
+ ;;
+ *)
+ AC_SUBST([LIB_EXT], [.so]);;
+esac
+
+case $(uname -p) in
+ i386*)
+ CXXFLAGS="-m32 $CXXFLAGS";;
+ x86_64*)
+ CXXFLAGS="-m64 $CXXFLAGS";;
+esac
+
+dnl ------------------------------------------------------------------
dnl Output.
dnl ------------------------------------------------------------------
@@ -167,9 +188,11 @@ dnl --------------------------------------------------
echo
AC_MSG_NOTICE([ == Package: ${PACKAGE}-${VERSION} ==])
echo
+AC_MSG_NOTICE([ Host OS: ${host_os}])
AC_MSG_NOTICE([ Install dir: ${PACKAGE_INSTALL_DIR}])
echo
AC_MSG_NOTICE([ C++ compiler: ${CXX}])
+AC_MSG_NOTICE([ CXXFLAGS: ${CXXFLAGS}])
AC_MSG_NOTICE([ Erlang compiler: ${ERLC}])
AC_MSG_NOTICE([ Erlang erts dir: ${ERLANG_ERTS_DIR}])
AC_MSG_NOTICE([ Erlang erts ver: ${ERLANG_ERTS_VER}])

0 comments on commit 45c95ba

Please sign in to comment.
Something went wrong with that request. Please try again.