Hi Ivan, On 17 Mar 2012, at 20:08, Ivan Vučica wrote:
> So I've been playing with compiling GNUstep for Android a little this > evening. I'd love David's input, since reflecting back on his status report > for a WebOS port, he mentioned he worked on solving the precise problem I'm > having ('configure' not running test programs when cross-compiling). > > My setup: > 0. OS X Lion > 1. Installed Android SDK into /Applications/android-sdk-mac_x86 > 2. Installed android-ndk-r5c into > /Applications/android-sdk-mac_x86/android-ndk-r5c > 3. Installed an Objective-C-supporting toolchain into > /Applications/android-sdk-mac_x86/ndk-objc - January 2010 download from: > http://code.google.com/p/android-gcc-objc2-0/downloads/list > 4. Wrote the following script, intended to be placed into .../core/make and > .../core/base For WebOS, I didn't use gcc - it's a pain to use for cross-compilation, and clang manages it out of the box. > David, in the previous mail from a few months ago, in a different thread, you > mentioned you had removed all tests that ran test programs from 'configure' > when cross-compiling is detected. Did you commit these changes to > 'configure.ac' and 'configure'? If so, how do I use them? I didn't get around to committing them. I've attached my changes to configure.ac at the end of this mail. > Did you manage to run base on WebOS? Yup, it works nicely on my TouchPad. > Just to note, I'm aware that some of the hacky changes I've made above should > actually be done in 'configure.ac' and should depend on a new target OS > called 'android'. I don't have autotools on the Mac, so it was easier to > directly edit 'configure'. Not ideal, as it makes merging changes back difficult. To be honest, the configure.ac needs some serious attention. It's full of stuff that isn't needed, and we can skip most of the tests in most cases. > /home/jackie/Development/Code/GnuStep/core/base/Headers/Foundation/NSException.h:44:2: > error: #error The current setting for native-objc-exceptions does not > match that of gnustep-base ... please correct this. I think we should remove this test in the headers. David -- Sent from my STANTEC-ZEBRA Index: configure.ac =================================================================== --- configure.ac (revision 33897) +++ configure.ac (working copy) @@ -1631,13 +1631,20 @@ else strclass_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -fconstant-string-class=FooConstantString" + # If we're cross-compiling, then just assume that we're using a recent + # compiler. AC_MSG_CHECKING(if the compiler supports -fconstant-string-class) - AC_CACHE_VAL(objc_compiler_supports_constant_string_class, - AC_TRY_RUN([#include "$srcdir/config/config.constant-string-class.m"], - objc_compiler_supports_constant_string_class=yes, - objc_compiler_supports_constant_string_class=no, - objc_compiler_supports_constant_string_class=no) - ) + if test "$cross_compiling" = yes; then + objc_compiler_supports_constant_string_class=yes + AC_MSG_WARN([Cross-compiling, so we will assume you are using a modern compiler.]) + else + AC_CACHE_VAL(objc_compiler_supports_constant_string_class, + AC_TRY_RUN([#include "$srcdir/config/config.constant-string-class.m"], + objc_compiler_supports_constant_string_class=yes, + objc_compiler_supports_constant_string_class=no, + objc_compiler_supports_constant_string_class=no) + ) + fi if test $objc_compiler_supports_constant_string_class = yes; then NX_CONST_STRING_OBJCFLAGS="-fconstant-string-class=NSConstantString" NX_CONST_STRING_CLASS=NSConstantString @@ -1730,8 +1737,14 @@ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $OBJCFLAGS -fobjc-nonfragile-abi -x objective-c" AC_MSG_CHECKING(for non-fragile-abi support) - AC_RUN_IFELSE([#include "$srcdir/config/config.non-fragile-ivars.m"], - non_fragile=yes, non_fragile=no) + # compiler. + if test "$cross_compiling" = yes; then + non_fragile=yes + AC_MSG_WARN([Cross-compiling, so we will assume you are using a modern compiler.]) + else + AC_RUN_IFELSE([#include "$srcdir/config/config.non-fragile-ivars.m"], + non_fragile=yes, non_fragile=no) + fi CPPFLAGS="$saved_CPPFLAGS" if test $non_fragile = yes; then OBJCFLAGS="$OBJCFLAGS -fobjc-nonfragile-abi" @@ -1819,8 +1832,13 @@ # Don't revert any Objective-C flags as they are used in the next test AC_MSG_CHECKING(for _objc_unexpected_exception in runtime) -AC_RUN_IFELSE([#include "$srcdir/config/config.unexpected.m"], - have_unexpected=yes, have_unexpected=no) +if test "$cross_compiling" = yes; then + have_unexpected=yes + AC_MSG_WARN([Cross-compiling, so we will assume you are using a modern runtime.]) +else + AC_RUN_IFELSE([#include "$srcdir/config/config.unexpected.m"], + have_unexpected=yes, have_unexpected=no) +fi if test $have_unexpected = yes; then AC_DEFINE(HAVE_UNEXPECTED,1, [Define if libobjc has the _objc_unexpected_exception callback]) @@ -1869,8 +1887,13 @@ # Don't revert any Objective-C flags as they are used in the next test AC_MSG_CHECKING(for thread-safe +initialize in runtime) -AC_RUN_IFELSE([#include "$srcdir/config/config.initialize.m"], +if test "$cross_compiling" = yes; then + safe_initialize=yes + AC_MSG_WARN([Cross-compiling, so we will assume you are using a modern runtime.]) +else + AC_RUN_IFELSE([#include "$srcdir/config/config.initialize.m"], safe_initialize=yes, safe_initialize=no) +fi if test $safe_initialize = yes; then AC_DEFINE(HAVE_INITIALIZE,1, [Define if libobjc has thread-safe +initialize support]) @@ -1993,6 +2016,13 @@ #-------------------------------------------------------------------- # These headers/functions needed by NSRunLoop.m #-------------------------------------------------------------------- +AC_ARG_WITH(poll, + [ --with-poll + Explicitly enable or disable the use of the poll() system call. This + option is ignored when not cross compiling: poll usage will be + automatically detected. ],, ) + + AC_CHECK_HEADERS(poll.h) AC_CHECK_FUNCS(poll) have_poll=no @@ -2000,11 +2030,15 @@ have_poll=yes AC_MSG_CHECKING(for poll emulation) AC_EGREP_CPP(emulating_poll, [#include "config/config.poll.c"], - have_poll=no,) + have_poll=no,) if test $have_poll = yes; then AC_MSG_RESULT(no) - AC_MSG_CHECKING([if poll supports devices]) - AC_TRY_RUN([#include "$srcdir/config/config.poll-dev.c"], ,have_poll=no, ) + if test "$cross_compiling" = yes; then + have_poll=$with_poll + else + AC_MSG_CHECKING([if poll supports devices]) + AC_TRY_RUN([#include "$srcdir/config/config.poll-dev.c"], ,have_poll=no, ) + fi if test $have_poll = yes; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_POLL_F,1, [ Define if poll is NOT emulated via select]) @@ -2017,27 +2051,6 @@ fi #-------------------------------------------------------------------- -# This function needed by StdioStream.m -#-------------------------------------------------------------------- -AC_CHECK_FUNCS(vsprintf vasprintf snprintf vsnprintf) -if test $ac_cv_func_vsprintf = yes ; then - AC_TRY_RUN([#include "$srcdir/config/config.vsprintf.c"], - VSPRINTF_RETURNS_LENGTH=1, - VSPRINTF_RETURNS_LENGTH=0, - VSPRINTF_RETURNS_LENGTH=1) - AC_DEFINE_UNQUOTED(VSPRINTF_RETURNS_LENGTH, $VSPRINTF_RETURNS_LENGTH, - [Define if vsprintf returns the length printed]) -fi -if test $ac_cv_func_vasprintf = yes ; then - AC_TRY_RUN([#include "$srcdir/config/config.vasprintf.c"], - VASPRINTF_RETURNS_LENGTH=1, - VASPRINTF_RETURNS_LENGTH=0, - VASPRINTF_RETURNS_LENGTH=1) - AC_DEFINE_UNQUOTED(VASPRINTF_RETURNS_LENGTH, $VASPRINTF_RETURNS_LENGTH, - [Define if vasprintf returns the length printed]) -fi - -#-------------------------------------------------------------------- # This function needed by NSFileManager.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(getcwd) @@ -2070,10 +2083,7 @@ #-------------------------------------------------------------------- # These functions needed by NSTask.m #-------------------------------------------------------------------- -AC_CHECK_FUNCS(killpg setpgrp setpgid setsid) -if test "x$ac_cv_func_setpgrp" = xyes; then - AC_FUNC_SETPGRP -fi +AC_CHECK_FUNCS(killpg setpgid setsid) HAVE_PTS_STREAM_MODULES=0 case "${target}" in @@ -2973,7 +2983,10 @@ [ --with-openssl-library=PATH library path for openssl libraries], openssl_libdir="$withval", openssl_libdir="no") -AC_CONFIG_SUBDIRS(SSL) +## FIXME: The SSL bundle's configure is broken when cross compiling. Ignore it for now. +if test "$cross_compiling" = no; then + AC_CONFIG_SUBDIRS(SSL) +fi #-------------------------------------------------------------------- # Record the version _______________________________________________ Gnustep-dev mailing list Gnustep-dev@gnu.org https://lists.gnu.org/mailman/listinfo/gnustep-dev