Re: Force 32 bit build

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

 



On 2021-05-06, aotto <aotto1968@xxxxxxxxxxx> wrote:
> I want to write a "autoconf/automake" script for an application ONLY for
> 32 bit on 64 bit Linux.
> This meant that the default for configure must be 32 bit and nothing else.
>
> I know that a user can do "configure CC="gcc -m32"... etc but this is
> NOT what I want.
> I want that the 'configure' script set the 32bin once at start and fix.

The general approach I would take to doing this in a configure script is
something like this:

Step 1)
Figure out how you are going to determine whether the compiler and
linker are producing the desired output format.  This should be done
in a portable way.

Step 2)
Use AC_LINK_IFELSE to compile a test program.  In the "action-if-true"
branch, check whether the linker output (which will be in the file
called conftest$EXEEXT) is as expected.  If that passes, you know that
no special compiler options are required.

Step 3)
If your verification fails, you can then temporarily alter CFLAGS and/or
LDFLAGS to test whatever combinations you think might work, then repeat
the AC_LINK_IFELSE and verification procedures to see if they actually
did work.

Step 4)
If a working method was found, then use AC_SUBST to substitute
appropriate variables and use them in your build scripts.

If no working method was found, use AC_MSG_FAILURE to report the error.

I will add that for this purpose you may find that using AC_COMPUTE_INT
(rather than AC_LINK_IFELSE) is more convenient when implementing your
configure test.  The overall structure is the same, however.

Hope that helps,
  Nick




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux