ADDED autogen.sh Index: autogen.sh ================================================================== --- /dev/null +++ autogen.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + +# Set a version for OpenBSD +: ${AUTOCONF_VERSION:=2.69} +: ${AUTOMAKE_VERSION:=1.15} +export AUTOCONF_VERSION AUTOMAKE_VERSION + +aclocal -I build-aux/m4 +autoconf Index: build-aux/m4/buildsys.m4 ================================================================== --- build-aux/m4/buildsys.m4 +++ build-aux/m4/buildsys.m4 @@ -1,7 +1,7 @@ dnl -dnl Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016 +dnl Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 dnl Jonathan Schleifer dnl dnl https://heap.zone/git/?p=buildsys.git dnl dnl Permission to use, copy, modify, and/or distribute this software for any @@ -57,10 +57,24 @@ "$($TPUT setaf 3 2>/dev/null)") AC_SUBST(TERM_SETAF4, "$($TPUT setaf 4 2>/dev/null)") AC_SUBST(TERM_SETAF6, "$($TPUT setaf 6 2>/dev/null)") + dnl OpenBSD seems to want 3 parameters for terminals + dnl ending in -256color, but the additional two + dnl parameters don't seem to do anything, so we set + dnl them to 0. + elif x=$($TPUT setaf 1 0 0 2>/dev/null); then + AC_SUBST(TERM_SETAF1, "$x") + AC_SUBST(TERM_SETAF2, + "$($TPUT setaf 2 0 0 2>/dev/null)") + AC_SUBST(TERM_SETAF3, + "$($TPUT setaf 3 0 0 2>/dev/null)") + AC_SUBST(TERM_SETAF4, + "$($TPUT setaf 4 0 0 2>/dev/null)") + AC_SUBST(TERM_SETAF6, + "$($TPUT setaf 6 0 0 2>/dev/null)") else AC_SUBST(TERM_SETAF1, "$($TPUT AF 1 2>/dev/null)") AC_SUBST(TERM_SETAF2, "$($TPUT AF 2 2>/dev/null)") @@ -98,11 +112,11 @@ AC_MSG_CHECKING(whether we need an implib) case "$host_os" in cygwin* | mingw*) AC_MSG_RESULT(yes) PROG_IMPLIB_NEEDED='yes' - PROG_IMPLIB_LDFLAGS='-Wl,-export-all-symbols,--out-implib,lib${PROG}.a' + PROG_IMPLIB_LDFLAGS='-Wl,--export-all-symbols,--out-implib,lib${PROG}.a' ;; *) AC_MSG_RESULT(no) PROG_IMPLIB_NEEDED='no' PROG_IMPLIB_LDFLAGS='' @@ -119,14 +133,14 @@ case "$host_os" in darwin*) AC_MSG_RESULT(Darwin) LIB_CFLAGS='-fPIC -DPIC' LIB_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}' + LIB_LDFLAGS_INSTALL_NAME='-Wl,-install_name,${libdir}/$${out%.dylib}.${LIB_MAJOR}.dylib' LIB_PREFIX='lib' LIB_SUFFIX='.dylib' LDFLAGS_RPATH='-Wl,-rpath,${libdir}' - LDFLAGS_INSTALL_NAME='-Wl,-install_name,${libdir}/$${out%.dylib}.${LIB_MAJOR}.dylib' PLUGIN_CFLAGS='-fPIC -DPIC' PLUGIN_LDFLAGS='-bundle -undefined dynamic_lookup' PLUGIN_SUFFIX='.bundle' INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$$i' UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib' @@ -133,11 +147,12 @@ CLEAN_LIB='' ;; mingw* | cygwin*) AC_MSG_RESULT(MinGW / Cygwin) LIB_CFLAGS='' - LIB_LDFLAGS='-shared -Wl,--out-implib,${SHARED_LIB}.a' + LIB_LDFLAGS='-shared -Wl,--export-all-symbols,--out-implib,${SHARED_LIB}.a' + LIB_LDFLAGS_INSTALL_NAME='' LIB_PREFIX='lib' LIB_SUFFIX='.dll' LDFLAGS_RPATH='-Wl,-rpath,${libdir}' PLUGIN_CFLAGS='' PLUGIN_LDFLAGS='-shared' @@ -148,10 +163,11 @@ ;; openbsd* | mirbsd*) AC_MSG_RESULT(OpenBSD) LIB_CFLAGS='-fPIC -DPIC' LIB_LDFLAGS='-shared' + LIB_LDFLAGS_INSTALL_NAME='' LIB_PREFIX='lib' LIB_SUFFIX='.so.${LIB_MAJOR}.${LIB_MINOR}' LDFLAGS_RPATH='-Wl,-rpath,${libdir}' PLUGIN_CFLAGS='-fPIC -DPIC' PLUGIN_LDFLAGS='-shared' @@ -162,10 +178,11 @@ ;; solaris*) AC_MSG_RESULT(Solaris) LIB_CFLAGS='-fPIC -DPIC' LIB_LDFLAGS='-shared -Wl,-soname=${SHARED_LIB}.${LIB_MAJOR}.${LIB_MINOR}' + LIB_LDFLAGS_INSTALL_NAME='' LIB_PREFIX='lib' LIB_SUFFIX='.so' LDFLAGS_RPATH='-Wl,-rpath,${libdir}' PLUGIN_CFLAGS='-fPIC -DPIC' PLUGIN_LDFLAGS='-shared' @@ -176,10 +193,11 @@ ;; *-android*) AC_MSG_RESULT(Android) LIB_CFLAGS='-fPIC -DPIC' LIB_LDFLAGS='-shared -Wl,-soname=${SHARED_LIB}.${LIB_MAJOR}' + LIB_LDFLAGS_INSTALL_NAME='' LIB_PREFIX='lib' LIB_SUFFIX='.so' LDFLAGS_RPATH='' PLUGIN_CFLAGS='-fPIC -DPIC' PLUGIN_LDFLAGS='-shared' @@ -190,10 +208,11 @@ ;; *) AC_MSG_RESULT(ELF) LIB_CFLAGS='-fPIC -DPIC' LIB_LDFLAGS='-shared -Wl,-soname=${SHARED_LIB}.${LIB_MAJOR}' + LIB_LDFLAGS_INSTALL_NAME='' LIB_PREFIX='lib' LIB_SUFFIX='.so' LDFLAGS_RPATH='-Wl,-rpath,${libdir}' PLUGIN_CFLAGS='-fPIC -DPIC' PLUGIN_LDFLAGS='-shared' @@ -204,16 +223,50 @@ ;; esac AC_SUBST(LIB_CFLAGS) AC_SUBST(LIB_LDFLAGS) + AC_SUBST(LIB_LDFLAGS_INSTALL_NAME) AC_SUBST(LIB_PREFIX) AC_SUBST(LIB_SUFFIX) AC_SUBST(LDFLAGS_RPATH) - AC_SUBST(LDFLAGS_INSTALL_NAME) 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_FRAMEWORK], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([BUILDSYS_SHARED_LIB]) + + AC_CHECK_TOOL(CODESIGN, codesign) + + case "$host_os" in + darwin*) + AC_MSG_CHECKING(whether host is iOS) + AC_EGREP_CPP(yes, [ + #include + + #if (defined(TARGET_OS_IPHONE) && \ + TARGET_OS_IPHONE) || \ + (defined(TARGET_OS_SIMULATOR) && \ + TARGET_OS_SIMULATOR) + yes + #endif + ], [ + AC_MSG_RESULT(yes) + FRAMEWORK_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}' + FRAMEWORK_LDFLAGS_INSTALL_NAME='-Wl,-install_name,@executable_path/Frameworks/$$out/$${out%.framework}' + ], [ + AC_MSG_RESULT(no) + FRAMEWORK_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}' + FRAMEWORK_LDFLAGS_INSTALL_NAME='-Wl,-install_name,@executable_path/../Frameworks/$$out/$${out%.framework}' + ]) + + AC_SUBST(FRAMEWORK_LDFLAGS) + AC_SUBST(FRAMEWORK_LDFLAGS_INSTALL_NAME) + ;; + esac +])