Opened 14 years ago

Closed 5 years ago

#3257 closed defect (wontfix)

GDAL's cpl_config.h file has incorrect defines for fat binary building on OSX

Reported by: hobu Owned by: hobu
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: svn-trunk
Severity: normal Keywords:
Cc: kyngchaos

Description

It's necessary to undo some of the defines that happen on OSX in cpl_config because of the way OS X builds its binaries. Values that are valid at configure time are not valid at compile time.

I propose we make a cpl_config_extras.h file and append that to the end of cpl_config.h using the append method of AC_CONFIG_HEADER. We can start by putting the apple defines in there, but it is a place we can stash other stuff to override cpl_config things if we need to.

Now to just figure out what things should actually be set to in the _extras file...

#ifdef __APPLE__

#ifdef __BIG_ENDIAN__
  #define HOST_FILLORDER FILLORDER_MSB2LSB
#else
  #define HOST_FILLORDER FILLORDER_LSB2MSB
#endif

#ifdef __LP64__
  #define SIZEOF_LONG 8
#else
  #define SIZEOF_LONG 4
#endif

#ifdef __LP64__
  #define SIZEOF_UNSIGNED_LONG 8
#else
  #define SIZEOF_UNSIGNED_LONG 4
#endif

#ifdef __LP64__
  #define SIZEOF_VOIDP 8
#else
  #define SIZEOF_VOIDP 4
#endif

#ifdef __BIG_ENDIAN__
  #define WORDS_BIGENDIAN 1
#else
  #undef WORDS_BIGENDIAN
#endif

#define VSI_STAT64 stat
#define VSI_STAT64_T stat

#endif

Change History (8)

comment:1 by hobu, 14 years ago

Mechanism to add supplemental stuff to cpl_config.h added in r18144. I removed the definition of SIZEOF_LONG in that changeset as well, as it appeared no one was using it.

comment:2 by kyngchaos, 14 years ago

Looks good to me. This will make configuration easier - no patching cpl_config.h after configure!

comment:3 by hobu, 14 years ago

Right, but you will need to test that we're doing the right thing. I'm not sure things are quite right.

comment:4 by kyngchaos, 14 years ago

Those are the values I use, for both endianess and bitsizes. If the cpl_config_extras.h defines are overriding configured cpl_config.h defs, you'll probably get a bunch of redefined warnings. So in cpl_config_extras.h you should #undef each before redefining them.

comment:5 by hobu, 14 years ago

yes, I tried to #undef them, but it seems #undef triggers autoheader's magic to stuff in the value it has for that symbol. If you can figure out a way around it, it would be greatly appreciated.

comment:6 by kyngchaos, 14 years ago

A couple autotools-ignorant ideas:

Why not #include cpl_config_extras.h at the end on cpl_config.h, so autoheader never sees cpl_config_extras.h? Unless autoheader doesn't allow this?

Or manually append cpl_config_extras.h to end end of cpl_config.h?

comment:7 by Even Rouault, 9 years ago

Milestone: 1.8.1

Removing obsolete milestone

comment:8 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.