autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cross-compiling with autoconf and a simulator


From: David Heine
Subject: Cross-compiling with autoconf and a simulator
Date: Tue, 26 Apr 2005 16:59:28 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

I've been frustrated by autoconf's inability to automatically identify configuration parameters when I'm cross-compiling, even though I have a simulator that can be used for this purpose.

In looking over the mailing list, I've seen two other attempts to add hooks to AC_TRY_COMMAND that permit remote execution for cross-compiles:
http://lists.gnu.org/archive/html/autoconf/2003-10/msg00098.html
http://lists.gnu.org/archive/html/autoconf/2002-04/msg00005.html

However, I was unable to find any corresponding changes in the latest CVS sources that would permit this. I'd like to propose a simple patch that adds a new flag "--host-exec" and a modification to the _AC_RUN_ELSIF to add a hook that can solve the problem. If this flag is not used, then configure's behavior should not change.

-David
? lib/autoconf/autoconf-2.59.patch
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.851
diff -u -3 -p -d -u -r1.851 general.m4
--- lib/autoconf/general.m4     20 Apr 2005 05:34:25 -0000      1.851
+++ lib/autoconf/general.m4     26 Apr 2005 23:55:17 -0000
@@ -563,6 +563,7 @@ srcdir=
 verbose=
 x_includes=NONE
 x_libraries=NONE
+host_exec=
 
 # Installation directory options.
 # These are left unexpanded so users can "make install exec_prefix=/foo"
@@ -704,6 +705,9 @@ do
   | --ht=*)
     htmldir=$ac_optarg ;;
 
+  -host-exec=* | --host-exec=*)
+    host_exec=$ac_optarg ;;
+
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
@@ -969,6 +973,14 @@ if test "x$host_alias" != x; then
   fi
 fi
 
+no_host_exec=no
+if test "$cross_compiling" = yes; then
+  no_host_exec=yes
+fi
+if test "x$host_exec" != x; then
+  no_host_exec=no
+fi
+
 ac_tool_prefix=
 test -n "$host_alias" && ac_tool_prefix=$host_alias-
 
@@ -2135,6 +2147,13 @@ AC_DEFUN([_AC_EVAL],
 [_AC_RUN_LOG([eval $1],
             [eval echo "$as_me:$LINENO: \"$1\""])])
 
+# _AC_HOST_EVAL(COMMAND)
+# -----------------
+# Eval COMMAND, save the exit status in ac_status, and log it.
+AC_DEFUN([_AC_HOST_EVAL],
+[_AC_RUN_LOG([eval $host_exec $1],
+            [eval echo "$as_me:$LINENO: \"$1\""])])
+
 
 # _AC_EVAL_STDERR(COMMAND)
 # ------------------------
@@ -2159,6 +2178,12 @@ AC_DEFUN([AC_TRY_COMMAND],
 [{ ac_try='$1'
   _AC_EVAL([$ac_try]); }])
 
+# AC_TRY_HOST_COMMAND(COMMAND)
+# -----------------------
+AC_DEFUN([AC_TRY_HOST_COMMAND],
+[{ ac_try='$1'
+  _AC_HOST_EVAL([$ac_try]); }])
+
 
 # AC_RUN_LOG(COMMAND)
 # -------------------
@@ -2368,7 +2393,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], 
 m4_define([_AC_RUN_IFELSE],
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
 rm -f conftest$ac_exeext
-AS_IF([AC_TRY_EVAL(ac_link) && AC_TRY_COMMAND(./conftest$ac_exeext)],
+AS_IF([AC_TRY_EVAL(ac_link) && AC_TRY_HOST_COMMAND(./conftest$ac_exeext)],
       [$2],
       [echo "$as_me: program exited with status $ac_status" >&AS_MESSAGE_LOG_FD
 _AC_MSG_LOG_CONFTEST
@@ -2392,7 +2417,7 @@ AC_DEFUN([AC_RUN_IFELSE],
 m4_ifval([$4], [],
         [AC_DIAGNOSE([cross],
                     [$0 called without default to allow cross compiling])])dnl
-if test "$cross_compiling" = yes; then
+if test "$no_host_exec" = yes; then
   m4_default([$4],
           [AC_MSG_FAILURE([cannot run test program while cross compiling])])
 else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]