Index: buildsys.mk.in ================================================================== --- buildsys.mk.in +++ buildsys.mk.in @@ -78,10 +78,11 @@ MSGFMT = @MSGFMT@ JAVAC = @JAVAC@ JAVACFLAGS = @JAVACFLAGS@ JAR = @JAR@ WINDRES = @WINDRES@ +BUILD_AND_HOST_ARE_DARWIN = @BUILD_AND_HOST_ARE_DARWIN@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ plugindir ?= ${libdir}/${PACKAGE_NAME} @@ -300,82 +301,100 @@ fi ${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS} ${OBJS_EXTRA} ${LINK_STATUS} rm -f $@ - out="$@"; \ - objs=""; \ - ars=""; \ - for i in ${OBJS} ${OBJS_EXTRA}; do \ - case $$i in \ - *.a) \ - ars="$$ars $$i" \ - ;; \ - *.o) \ - objs="$$objs $$i" \ - ;; \ - esac \ - done; \ - for i in $$ars; do \ - dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ - rm -fr $$dir; \ - mkdir -p $$dir; \ - cd $$dir; \ - ${AR} x ../$$i; \ - for j in *.o; do \ - objs="$$objs $$dir/$$j"; \ - done; \ - cd ..; \ - done; \ - if ${AR} cr $@ $$objs && ${RANLIB} $@; then \ - ${LINK_OK}; \ - else \ - ${LINK_FAILED}; \ - rm -f $@; \ - fi; \ - for i in $$ars; do \ - dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ - rm -fr $$dir; \ - done + if test x"${BUILD_AND_HOST_ARE_DARWIN}" = x"yes"; then \ + if /usr/bin/libtool -static -o $@ ${OBJS} ${OBJS_EXTRA}; then \ + ${LINK_OK}; \ + else \ + ${LINK_FAILED}; \ + rm -f $@; \ + fi; \ + else \ + out="$@"; \ + objs=""; \ + ars=""; \ + for i in ${OBJS} ${OBJS_EXTRA}; do \ + case $$i in \ + *.a) \ + ars="$$ars $$i" \ + ;; \ + *.o) \ + objs="$$objs $$i" \ + ;; \ + esac \ + done; \ + for i in $$ars; do \ + dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ + rm -fr $$dir; \ + mkdir -p $$dir; \ + cd $$dir; \ + ${AR} x ../$$i; \ + for j in *.o; do \ + objs="$$objs $$dir/$$j"; \ + done; \ + cd ..; \ + done; \ + if ${AR} cr $@ $$objs && ${RANLIB} $@; then \ + ${LINK_OK}; \ + else \ + ${LINK_FAILED}; \ + rm -f $@; \ + fi; \ + for i in $$ars; do \ + dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ + rm -fr $$dir; \ + done; \ + fi ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${LINK_STATUS} rm -f $@ - out="$@"; \ - objs=""; \ - ars=""; \ - for i in ${LIB_OBJS} ${LIB_OBJS_EXTRA}; do \ - case $$i in \ - *.a) \ - ars="$$ars $$i" \ - ;; \ - *.o) \ - objs="$$objs $$i" \ - ;; \ - esac \ - done; \ - for i in $$ars; do \ - dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ - rm -fr $$dir; \ - mkdir -p $$dir; \ - cd $$dir; \ - ${AR} x ../$$i; \ - for j in *.o; do \ - objs="$$objs $$dir/$$j"; \ - done; \ - cd ..; \ - done; \ - if ${AR} cr $@ $$objs && ${RANLIB} $@; then \ - ${LINK_OK}; \ - else \ - ${LINK_FAILED}; \ - rm -f $@; \ - fi; \ - for i in $$ars; do \ - dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ - rm -fr $$dir; \ - done + if test x"${BUILD_AND_HOST_ARE_DARWIN}" = x"yes"; then \ + if /usr/bin/libtool -static -o $@ ${OBJS} ${OBJS_EXTRA}; then \ + ${LINK_OK}; \ + else \ + ${LINK_FAILED}; \ + rm -f $@; \ + fi; \ + else \ + out="$@"; \ + objs=""; \ + ars=""; \ + for i in ${LIB_OBJS} ${LIB_OBJS_EXTRA}; do \ + case $$i in \ + *.a) \ + ars="$$ars $$i" \ + ;; \ + *.o) \ + objs="$$objs $$i" \ + ;; \ + esac \ + done; \ + for i in $$ars; do \ + dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ + rm -fr $$dir; \ + mkdir -p $$dir; \ + cd $$dir; \ + ${AR} x ../$$i; \ + for j in *.o; do \ + objs="$$objs $$dir/$$j"; \ + done; \ + cd ..; \ + done; \ + if ${AR} cr $@ $$objs && ${RANLIB} $@; then \ + ${LINK_OK}; \ + else \ + ${LINK_FAILED}; \ + rm -f $@; \ + fi; \ + for i in $$ars; do \ + dir=".$$(echo $$i | sed 's/\//_/g').objs"; \ + rm -fr $$dir; \ + done; \ + fi locales: ${MO_FILES} .c.o: ${COMPILE_STATUS} Index: m4/buildsys.m4 ================================================================== --- m4/buildsys.m4 +++ m4/buildsys.m4 @@ -20,10 +20,23 @@ dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE dnl POSSIBILITY OF SUCH DAMAGE. dnl AC_DEFUN([BUILDSYS_INIT], [ + AC_REQUIRE([AC_CANONICAL_BUILD]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + case "$build_os" in + darwin*) + case "$host_os" in + darwin*) + AC_SUBST(BUILD_AND_HOST_ARE_DARWIN, yes) + ;; + esac + ;; + esac + AC_CONFIG_COMMANDS_PRE([ AC_SUBST(CC_DEPENDS, $GCC) AC_SUBST(CXX_DEPENDS, $GXX) AC_SUBST(OBJC_DEPENDS, $GOBJC) AC_SUBST(OBJCXX_DEPENDS, $GOBJCXX)