Problem:

1. In the beginning of configure, --with_archflags option value is added to 
CFLAGS, so that configure checks will see the given -arch flags. However, fltk 
makefiles expect the arch flags to be in ARCHFLAGS, not in CFLAGS. The problem 
is that configure leaves the arch flags in CFLAGS, which makes the fltk-config 
return the arch flags in e.g. "fltk-config --cflags". For universal builds this 
is wrong, as it "forces" apps to build as universal as well, while the intent 
of an universal library is to be usable for e.g. both 32-bit and 64-bit apps, 
not only for universal apps.

2. DSOCOMMAND for OSX does not have ARCHFLAGS.


Solutions:

1. Remove the architecture flags from CFLAGS after configure checks are done 
(on OSX)

2. Add $(ARCHFLAGS) to DSOCOMMAND= line (on OSX)

A patch to this effect is attached (patch-configure.in.diff).


Verification:

After the patch, the resulting fltk-config works as expected:

$ patch -p0 <patch-configure.in.diff
$ autoconf
$ ./configure --prefix=/opt/local --with-archflags="-arch i386 -arch x86_64" 
--enable-shared
$ make -j2
$ sudo make install

$ /opt/local/bin/fltk-config --cflags
-I/opt/local/include -I/opt/local/include/FL/images -D_LARGEFILE_SOURCE 
-D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT

I.e. no -arch flags are given. To verify that the build was really universal:

$ otool -fv /opt/local/lib/libfltk.dylib 
Fat headers
fat_magic FAT_MAGIC
nfat_arch 2
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    capabilities 0x0
    offset 4096
    size 842544
    align 2^12 (4096)
architecture x86_64
    cputype CPU_TYPE_X86_64
    cpusubtype CPU_SUBTYPE_X86_64_ALL
    capabilities 0x0
    offset 847872
    size 933416
    align 2^12 (4096)


This patch also has the beneficial side effect that when -arch flags are not 
present in the flags returned by fltk-config, the returned flags can also be 
used as such with non-Apple GCC versions (which do not have the -arch option).

Regards,

  Jarno Rajahalme

Attachment: patch-configure.in.diff
Description: Binary data


_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to