emacs-devel
[Top][All Lists]
Advanced

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

Re: add etc/PROBLEMS entry for building 32-bit exe on 64-bit system


From: Glenn Morris
Subject: Re: add etc/PROBLEMS entry for building 32-bit exe on 64-bit system
Date: Tue, 09 Jan 2007 23:14:02 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)


Actually, I don't know any more if I'm asking for a reasonable thing.
Should I expect to be able to _compile_ 32-bit apps on an x86_64
system, or just _run_ them? The fact that almost none of the OS
"devel" packages exist in 32-bit form suggests the latter.


Glenn Morris wrote:

> I imagine it's reasonable to expect configure to just Do The Right
> Thing

With some playing around, I find the following change enables me to
just use configure --build=i386-linux-gnu to get the desired result. I
don't know how correct/desirable it is though.


Index: configure.in
===================================================================
RCS file: /sources/emacs/emacs/configure.in,v
retrieving revision 1.428
diff -c -c -w -r1.428 configure.in
*** configure.in        3 Jan 2007 23:47:04 -0000       1.428
--- configure.in        10 Jan 2007 04:09:31 -0000
***************
*** 1486,1491 ****
--- 1486,1523 ----
    CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
  fi
  
+ ## Build a 32-bit version on x86_64 GNU/Linux?
+ case "${canonical}" in
+   i386-*linux-gnu* )
+     case `$SHELL "$ac_aux_dir/config.guess"` in
+       x86_64-*-linux-gnu* )
+ 
+         x86_64_build_m32=yes
+ 
+         save_CFLAGS="$CFLAGS"
+         CFLAGS="-m32 $CFLAGS"
+         AC_MSG_CHECKING([whether compiler understands -m32])
+         AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
+         AC_MSG_RESULT($has_option)
+         if test $has_option = yes; then
+           REAL_CFLAGS="-m32 $REAL_CFLAGS"
+         fi
+         CFLAGS="$save_CFLAGS"
+         unset has_option
+         unset save_CFLAGS
+ 
+         save_LDFLAGS="$LDFLAGS"
+         LDFLAGS="-m32 $LDFLAGS"
+         AC_MSG_CHECKING([whether linker understands -m32])
+         AC_LINK_IFELSE([main(){return 0;}],
+           [AC_MSG_RESULT(yes)],
+           LDFLAGS="$save_LDFLAGS"
+           [AC_MSG_RESULT(no)])
+         unset save_LDFLAGS ;;
+ 
+     esac ;;
+ esac
+ 
  dnl For AC_FUNC_GETLOADAVG, at least:
  AC_CONFIG_LIBOBJ_DIR(src)
  
***************
*** 1765,1770 ****
--- 1797,1805 ----
  
  if test "${x_libraries}" != NONE; then
    if test -n "${x_libraries}"; then
+     if test -n "${x86_64_build_m32}"; then
+       x_libraries=`echo ${x_libraries} | sed -e "s:/lib64:/lib:g"`
+     fi
      LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
      LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
    fi





reply via email to

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