From 9228a43a72581baddc686888cf4c126cf0733e5a Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 15 Jun 2013 03:06:13 -0700 Subject: [PATCH] Stop using non-portable (GNU) Makefile features. --- Makefile.am | 17 ++++++--------- configure | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 15 ++++++++++++- 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index e97813f..8430a18 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,7 +26,7 @@ cycript_LDADD = libcycript.la ldid = true entitle = $(ldid) -Scycript.xml -filters = $(shell $(BISON) <(echo '%code{}%%_:') -o/dev/null 2>/dev/null && echo Bison24 || echo Bison23) +filters = $(CY_FILTERS) if CY_EXECUTE libcycript_la_SOURCES += sig/ffi_type.cpp sig/parse.cpp sig/copy.cpp @@ -68,27 +68,24 @@ AM_CPPFLAGS += -DCY_ATTACH -DCY_LIBRARY='"$(libdir)/libcycript.$(SO)"' Mach/Inject.$(OBJEXT): Trampoline.t.hpp CLEANFILES += Trampoline.t.lo -%.t.lo: %.t.cpp Trampoline.hpp Baton.hpp Standard.hpp +Trampoline.t.lo: Trampoline.t.cpp Trampoline.hpp Baton.hpp Standard.hpp $(LTCXXCOMPILE) $(CY_ARCH) -c -o $@ $< -fno-stack-protector -fno-exceptions -O0 -.SECONDARY: Trampoline.t.lo CLEANFILES += libTrampoline.t.la -lib%.t.la: %.t.lo +libTrampoline.t.la: Trampoline.t.lo $(CXXLINK) $(CY_ARCH) -rpath $(libdir) $^ -.SECONDARY: libTrampoline.t.la CLEANFILES += Trampoline.t.hpp -%.t.hpp: lib%.t.la trampoline.sh - $(srcdir)/trampoline.sh $@ $(patsubst %.la,.libs/%.dylib,$<) $* $(SED) $(LIPO) $(NM) $(OTOOL) -.SECONDARY: Trampoline.t.hpp +Trampoline.t.hpp: libTrampoline.t.la trampoline.sh + $(srcdir)/trampoline.sh $@ .libs/libTrampoline.t.dylib Trampoline $(SED) $(LIPO) $(NM) $(OTOOL) endif CLEANFILES += Cycript.yy -%.yy: %.yy.in +Cycript.yy: Cycript.yy.in $(srcdir)/Filter.sh <$< >$@ $(filters) CLEANFILES += Cycript.l -%.l: %.l.in +Cycript.l: Cycript.l.in $(srcdir)/Filter.sh <$< >$@ $(filters) CLEANFILES += lex.cy.cpp diff --git a/configure b/configure index c8099d6..cf19be9 100755 --- a/configure +++ b/configure @@ -665,6 +665,7 @@ CY_EXECUTE WEBKIT_LIBS WEBKIT_CFLAGS CY_ARCH +CY_FILTERS GNUTAR GPERF FLEX @@ -16404,6 +16405,66 @@ fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking bison for %code{}" >&5 +$as_echo_n "checking bison for %code{}... " >&6; } +echo '%code{}%%_:' >conftest.y +if $BISON conftest.y -o/dev/null 2>/dev/null; then + + for element in Bison24; do + haveit= + for x in $CY_FILTERS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CY_FILTERS="${CY_FILTERS}${CY_FILTERS:+ }$element" + fi + done + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + + for element in Bison23; do + haveit= + for x in $CY_FILTERS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CY_FILTERS="${CY_FILTERS}${CY_FILTERS:+ }$element" + fi + done + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +rm -f conftest.y + + diff --git a/configure.ac b/configure.ac index 351d8fd..bf703f2 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_CONFIG_SRCDIR([Console.cpp]) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CXX AC_PROG_OBJCXX @@ -60,6 +60,19 @@ CY_CHECK_PROGS_VERSION([GPERF], [gperf], [perfect hash function generator], CY_CHECK_PROGS_VERSION([GNUTAR], [tar gtar gnutar], [a very sticky lump of files], [--version | $SED -e '1 s/^tar (GNU tar) \(.*\)$/\1/p;d'], [1.19]) +AC_MSG_CHECKING([bison for %code{}]) +echo '%code{}%%_:' >conftest.y +if $BISON conftest.y -o/dev/null 2>/dev/null; then + AC_LIB_APPENDTOVAR([CY_FILTERS], [Bison24]) + AC_MSG_RESULT([yes]) +else + AC_LIB_APPENDTOVAR([CY_FILTERS], [Bison23]) + AC_MSG_RESULT([no]) +fi + +rm -f conftest.y +AC_SUBST([CY_FILTERS]) + dnl CY_TRY {{{ AC_DEFUN([CY_SUCCESS], [cy_good=1]) AC_DEFUN([CY_FAILURE], [cy_good=0]) -- 2.49.0