I want to compile a program using the standard ./configure , make, make install. I am using 64 bits machine but I want the executable to be 32 bits executable.

What is the way to do this, I did ./configure --help but saw nothing on this (it has the --disable-64bit but it does not seem to do the work

+2  A: 

What is the platform and compiler?

I'd be inclined to say either:

  1. run configure to get your Makefile and then add then relevant compiler option to the CFLAGS macro, e.g. CFLAGS=${CFLAGS} -m32 for Sun cc, or
  2. add that macro edit to the Makefile.in file being used as a template by configure.


Forgot to add that I've done both several times before when I needed to.

Rob Wells
Will -m32 work for SunCC? I thought it was for gcc.
@Aviator: -m32 is correct for SUNWspro (Sun C compiler) version 12; previous versions used other notations (like -xarch=sparcv9 or thereabouts).
Jonathan Leffler
@Rob: I often set CC="gcc -m32" or CC="gcc -m64" in the environment before running configure: `CC="gcc -m32" ./configure`
Jonathan Leffler
@Jonathan: Yeah.. thanks! I got it.. I was using -xarch stuff! :) Thats why got confused..
@Aviator, wait until you use SunStudio12.1. Oh, the chip and architecture options you will see.... to paraphrase Dr. Seuss (-:
Rob Wells
@Rob: lol... Yeah.. Actually am fighting to get new one! :).. Its difficult to convince people here :).. Hope i will soon get latest ones!