From ac87230767db4779a10acf0eaba6493327a3c257 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 20 Jun 2015 18:15:07 +0200 Subject: pass curses CFLAGS into Scinterm build system * requires a recent patch to Scinterm * can be overwritten in SciTECO's build system via NCURSES_CFLAGS or PDCURSES_CFLAGS. * NCURSES_LIBS has also been introduced. The check for ncurses will now use pkg-config if available. * eases multiple builds with different Curses variants (e.g. when cross-compiling for Windows) * pass more toolchain variables into Scintilla build process (CC and RANLIB). This should fix Cross-compiling Scintilla/Gtk * Pass GTK cflags into Scintilla/Gtk build system. --- configure.ac | 30 ++++++++++++++++++++++++------ scintilla.am | 18 +++++++++++------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 5f3ab62..9e0cc29 100644 --- a/configure.ac +++ b/configure.ac @@ -39,8 +39,9 @@ AC_PROG_CC_C99 AC_PROG_GREP AC_PROG_INSTALL -# Required by the Scintilla build process: +# Additionally required by the Scintilla build process: AC_CHECK_TOOL(AR, ar) +AC_PROG_RANLIB # Check for Windows resource compiler and define # WIN32 conditional @@ -110,7 +111,7 @@ AC_CHECK_FUNCS([memset setlocale strchr strrchr fstat], , [ # Library functions that should exist on UNIX/Linux case $host in *-*-darwin* | *-*-linux* | *-*-cygwin*) - AC_CHECK_FUNCS([realpath fchown], , [ + AC_CHECK_FUNCS([realpath fchown dup dup2], , [ AC_MSG_ERROR([Missing libc function]) ]) ;; @@ -149,14 +150,30 @@ case $INTERFACE in *curses) case $INTERFACE in ncurses) - AC_CHECK_LIB(ncurses, initscr, , [ - AC_MSG_ERROR([libncurses missing!]) + PKG_CHECK_MODULES(NCURSES, [ncurses], [ + CFLAGS="$CFLAGS $NCURSES_CFLAGS" + CXXFLAGS="$CXXFLAGS $NCURSES_CFLAGS" + LIBS="$LIBS $NCURSES_LIBS" + ], [ + AC_CHECK_LIB(ncurses, initscr, , [ + AC_MSG_ERROR([libncurses missing!]) + ]) ]) AC_CHECK_FUNCS([tigetstr]) ;; + pdcurses) - AC_ARG_VAR(PDCURSES_LIBS, [linker flags for PDCurses, - overriding the autoconf check]) + AC_ARG_VAR(PDCURSES_CFLAGS, [ + C compiler flags for PDCurses, + overriding the autoconf check + ]) + CFLAGS="$CFLAGS $PDCURSES_CFLAGS" + CXXFLAGS="$CXXFLAGS $PDCURSES_CFLAGS" + + AC_ARG_VAR(PDCURSES_LIBS, [ + linker flags for PDCurses, + overriding the autoconf check + ]) if [[ "x$PDCURSES_LIBS" = "x" ]]; then AC_CHECK_LIB(pdcurses, initscr, , [ AC_MSG_ERROR([libpdcurses missing! @@ -167,6 +184,7 @@ case $INTERFACE in AC_MSG_RESULT([$PDCURSES_LIBS]) LIBS="$LIBS $PDCURSES_LIBS" fi + AC_CHECK_FUNC([PDC_set_resize_limits], [ AC_DEFINE(PDCURSES_WIN32A, , [PDCurses supports Win32a extensions]) ]) diff --git a/scintilla.am b/scintilla.am index 94877b2..53f22d6 100644 --- a/scintilla.am +++ b/scintilla.am @@ -3,21 +3,25 @@ # for building scintilla.a here. if INTERFACE_GTK -SCINTILLA_MAKE_DIR = @SCINTILLA_PATH@/gtk +MAKE_SCINTILLA = $(MAKE) -C @SCINTILLA_PATH@/gtk \ + CONFIGFLAGS='@LIBGTK_CFLAGS@' else -SCINTILLA_MAKE_DIR = @SCINTERM_PATH@ +MAKE_SCINTILLA = $(MAKE) -C @SCINTERM_PATH@ \ + CURSES_CFLAGS='@PDCURSES_CFLAGS@ @NCURSES_CFLAGS@' endif +# Pass toolchain configuration to Scintilla. +# This is what allows cross compilation +MAKE_SCINTILLA += CC='@CC@' CXX='@CXX@' \ + AR='@AR@' RANLIB='@RANLIB@' + # Build as phony target - we do not know # scintilla.a's dependencies. # If it's up to date, the additional recursive # make call does not hurt. -# NOTE: We can pass the (cross-)compiler to -# Scintilla's build process, but no CFLAGS :-( .PHONY: make-scintilla make-scintilla: - $(MAKE) -C $(SCINTILLA_MAKE_DIR) \ - CXX=@CXX@ AR=@AR@ + $(MAKE_SCINTILLA) # scintilla.a itself is not phony. # This avoids unnecessary relinking if it is @@ -28,7 +32,7 @@ make-scintilla: .PHONY: clean-local-scintilla clean-local-scintilla: - $(MAKE) -C $(SCINTILLA_MAKE_DIR) clean + $(MAKE_SCINTILLA) clean # NOTE: using a separate `clean-local-scintilla` # target allows us to add more custom rules to the -- cgit v1.2.3