Index: buildsys.mk.in ================================================================== --- buildsys.mk.in +++ buildsys.mk.in @@ -148,16 +148,23 @@ else \ ${LINK_FAILED}; \ fi ${LIB} ${LIB_NOINST}: ${EXT_DEPS} ${OBJS} - ${LINK_STATUS} - if ${LD} -o $@ ${OBJS} ${LIB_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ - ${LINK_OK}; \ - else \ - ${LINK_FAILED}; \ - fi + case $@ in \ + *.a) \ + ${MAKE} ${MFLAGS} STATIC_LIB=${LIB} LIB= $@ || exit 1 \ + ;; \ + *) \ + ${LINK_STATUS}; \ + if ${LD} -o $@ ${OBJS} ${LIB_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ + ${LINK_OK}; \ + else \ + ${LINK_FAILED}; \ + fi \ + ;; \ + esac ${PLUGIN} ${PLUGIN_NOINST}: ${EXT_DEPS} ${OBJS} ${LINK_STATUS} if ${LD} -o $@ ${OBJS} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ ${LINK_OK}; \ Index: m4/buildsys.m4 ================================================================== --- m4/buildsys.m4 +++ m4/buildsys.m4 @@ -17,10 +17,22 @@ dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN dnl CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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_LIB], [ + AC_ARG_ENABLE(shared, + [ --disable-shared don't build shared libraries], + enable_shared="$enableval") + + if test x"$enableval" = x"no"; then + BUILDSYS_STATIC_LIB_ONLY + else + BUILDSYS_SHARED_LIB + fi +]) AC_DEFUN([BUILDSYS_PROG_IMPLIB], [ AC_MSG_CHECKING(whether we need an implib) case "$target" in *-*-cygwin* | *-*-mingw*) @@ -126,10 +138,33 @@ AC_SUBST(LIB_SUFFIX) AC_SUBST(PLUGIN_CPPFLAGS) AC_SUBST(PLUGIN_CFLAGS) AC_SUBST(PLUGIN_LDFLAGS) AC_SUBST(PLUGIN_SUFFIX) + AC_SUBST(INSTALL_LIB) + AC_SUBST(UNINSTALL_LIB) + AC_SUBST(CLEAN_LIB) +]) + +AC_DEFUN([BUILDSYS_STATIC_LIB_ONLY], [ + AC_PATH_PROG(AR, ar) + AC_PROG_RANLIB + + LIB_CPPFLAGS='' + LIB_CFLAGS='' + LIB_LDFLAGS='' + LIB_PREFIX='lib' + LIB_SUFFIX='.a' + INSTALL_LIB='${INSTALL} -m 644 $$i ${DESTDIR}${libdir}/$$i' + UNINSTALL_LIB='rm -f ${DESTDIR}${libdir}/$$i' + CLEAN_LIB='' + + AC_SUBST(LIB_CPPFLAGS) + AC_SUBST(LIB_CFLAGS) + AC_SUBST(LIB_LDFLAGS) + AC_SUBST(LIB_PREFIX) + AC_SUBST(LIB_SUFFIX) AC_SUBST(INSTALL_LIB) AC_SUBST(UNINSTALL_LIB) AC_SUBST(CLEAN_LIB) ])