Support cross-compilation with autotools

We use the host system's `fluid` when cross-compiling. This must be
executable as `fluid`, i.e. it must be in the PATH or otherwise
defined, for instance as an alias.
This commit is contained in:
Albrecht Schlosser 2020-06-10 16:24:39 +02:00
parent 3d00b8db4c
commit 95165884b6
4 changed files with 41 additions and 16 deletions

1
.gitignore vendored
View File

@ -115,6 +115,7 @@ etc/FLTKConfig.cmake
/src/*.sl* /src/*.sl*
/src/*.a /src/*.a
/src/*.bck /src/*.bck
/src/*.dll
/src/*.sav /src/*.sav
/src/*.dylib /src/*.dylib

View File

@ -1,21 +1,19 @@
dnl -*- sh -*- dnl -*- sh -*-
dnl the "configure" script is made from this by running GNU "autoconf" dnl the "configure" script is made from this by running GNU "autoconf"
dnl dnl
dnl "$Id$"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK). dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl dnl
dnl Copyright 1998-2018 by Bill Spitzak and others. dnl Copyright 1998-2020 by Bill Spitzak and others.
dnl dnl
dnl This library is free software. Distribution and use rights are outlined in dnl This library is free software. Distribution and use rights are outlined in
dnl the file "COPYING" which should have been included with this file. If this dnl the file "COPYING" which should have been included with this file. If this
dnl file is missing or damaged, see the license at: dnl file is missing or damaged, see the license at:
dnl dnl
dnl http://www.fltk.org/COPYING.php dnl https://www.fltk.org/COPYING.php
dnl dnl
dnl Please report all bugs and problems on the following page: dnl Please report all bugs and problems on the following page:
dnl dnl
dnl http://www.fltk.org/str.php dnl https://www.fltk.org/str.php
dnl dnl
dnl We need at least autoconf 2.50... dnl We need at least autoconf 2.50...
@ -27,6 +25,13 @@ AC_CONFIG_SRCDIR([src/Fl.cxx])
AC_CANONICAL_HOST AC_CANONICAL_HOST
dnl determine whether we're cross-compiling
if test "$host" != "$build"; then
fltk_cross_compiling="yes"
else
fltk_cross_compiling="no"
fi
dnl Do not automatically add "-g" to compiler options... dnl Do not automatically add "-g" to compiler options...
dnl This must be _before_ "Find compiler commands..." dnl This must be _before_ "Find compiler commands..."
ARCHFLAGS="${ARCHFLAGS:=}" ARCHFLAGS="${ARCHFLAGS:=}"
@ -390,6 +395,16 @@ else
LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a" LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a"
fi fi
dnl Define the fluid executable used when building the test programs.
dnl In a native build we use the fluid executable created during the build,
dnl in a cross-compilation we use `fluid' which must exist on the build system
dnl and must be in the PATH, i.e. executable as 'fluid' (w/o $EXEEXT).
if test "$fltk_cross_compiling" = "yes"; then
FLUID_BUILD="fluid"
else
FLUID_BUILD="../fluid/fluid$EXEEXT"
fi
AC_SUBST(DSOCOMMAND) AC_SUBST(DSOCOMMAND)
AC_SUBST(DSOFLAGS) AC_SUBST(DSOFLAGS)
AC_SUBST(DSOLINK) AC_SUBST(DSOLINK)
@ -401,6 +416,7 @@ AC_SUBST(CAIRODSONAME)
AC_SUBST(SHAREDSUFFIX) AC_SUBST(SHAREDSUFFIX)
AC_SUBST(LINKSHARED) AC_SUBST(LINKSHARED)
AC_SUBST(FLUID) AC_SUBST(FLUID)
AC_SUBST(FLUID_BUILD)
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support [[default=yes]]]) AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support [[default=yes]]])
@ -1602,8 +1618,14 @@ case $host_os in
echo " MSys docpath=$msyspath/local/share/doc/fltk" echo " MSys docpath=$msyspath/local/share/doc/fltk"
;; ;;
esac esac
dnl
echo "Cross-compiling: $fltk_cross_compiling"
if test "$fltk_cross_compiling" = "yes"; then
echo " Build: $build -> Host: $host"
fi
dnl
echo " Graphics: $graphics" echo " Graphics: $graphics"
dnl
if test x$JPEG = x; then if test x$JPEG = x; then
echo "Image Libraries: JPEG=System" echo "Image Libraries: JPEG=System"
else else
@ -1658,5 +1680,5 @@ dnl Make sure the fltk-config script is executable...
chmod +x fltk-config chmod +x fltk-config
dnl dnl
dnl End of "$Id$". dnl End of file.
dnl dnl

View File

@ -3,17 +3,17 @@
# #
# Make include file for the Fast Light Tool Kit (FLTK). # Make include file for the Fast Light Tool Kit (FLTK).
# #
# Copyright 1998-2018 by Bill Spitzak and others. # Copyright 1998-2020 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this
# file is missing or damaged, see the license at: # file is missing or damaged, see the license at:
# #
# http://www.fltk.org/COPYING.php # https://www.fltk.org/COPYING.php
# #
# Please report all bugs and problems on the following page: # Please report all bugs and problems on the following page:
# #
# http://www.fltk.org/str.php # https://www.fltk.org/str.php
# #
# FLTK version numbers # FLTK version numbers
@ -122,6 +122,10 @@ THREADS = @THREADS@
# Name of FLUID executable we install # Name of FLUID executable we install
FLUID = @FLUID@$(EXEEXT) FLUID = @FLUID@$(EXEEXT)
# Name and/or path of FLUID executable we use for building:
# depends on the build type (native or cross-compiler)
FLUID_BUILD = @FLUID_BUILD@
# Possible steps for OS X build only # Possible steps for OS X build only
OSX_ONLY = @OSX_ONLY@ OSX_ONLY = @OSX_ONLY@

View File

@ -1,19 +1,17 @@
# #
# "$Id$"
#
# Test/example program makefile for the Fast Light Tool Kit (FLTK). # Test/example program makefile for the Fast Light Tool Kit (FLTK).
# #
# Copyright 1998-2019 by Bill Spitzak and others. # Copyright 1998-2020 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this
# file is missing or damaged, see the license at: # file is missing or damaged, see the license at:
# #
# http://www.fltk.org/COPYING.php # https://www.fltk.org/COPYING.php
# #
# Please report all bugs and problems on the following page: # Please report all bugs and problems on the following page:
# #
# http://www.fltk.org/str.php # https://www.fltk.org/str.php
# #
include ../makeinclude include ../makeinclude
@ -302,7 +300,7 @@ uninstall-osx:
# FLUID file rules # FLUID file rules
.fl.cxx .fl.h: ../fluid/fluid$(EXEEXT) .fl.cxx .fl.h: ../fluid/fluid$(EXEEXT)
echo Generating $@ and header from $<... echo Generating $@ and header from $<...
../fluid/fluid$(EXEEXT) -c $< $(FLUID_BUILD) -c $<
# All demos depend on the FLTK library... # All demos depend on the FLTK library...
$(ALL): $(LIBNAME) $(ALL): $(LIBNAME)