Sdl-config for Mac OS X (frameworks)

Here is one such idea of a “sdl-config”:
(i.e. for the Mac’s framework installer)



   echo -I${prefix}/SDL.framework/Headers  -D_THREAD_SAFE

   # The portable way of including SDL is #include "SDL.h"
   libdirs="-L${exec_prefix}/lib "
   echo $libdirs -lSDLmain -F${prefix} -framework SDL  \
   -framework Cocoa -framework Carbon -framework OpenGL
   echo "Static linking is not supported, only dynamic !" 1>&2
   exit 1

That will make command-line applications
find and link to the frameworks as well…

Assuming that sdl-config goes into /usr/bin,
and libSDLmain.a in /usr/lib for that build ?

/usr/local could also have been used of course,
but as I had my UNIX-style build there already…

It’s still possible to use the more traditional
library way of linking, of course. (with .dylib)

But then you are better off installing from a
full build system like DarwinPorts (or Fink)…

Here is the full script, and a lib for Panther:


PS. If you don’t recognize the -F flag, here it is quoted from man gcc:> -Fdir

In Apple’s version of GCC only, add the directory dir to the head
of the list of directories to be searched for frameworks.

The framework search algorithm is, for an inclusion of
<Fmwk/Header.h>, to look for files named path/Fmwk.framework/Head-
ers/Header.h or path/Fmwk.framework/PrivateHeaders/Header.h where
path includes /System/Library/Frameworks/ /Library/Frameworks/, and
/Local/Library/Frameworks/, plus any additional paths specified by

All the -F options are also passed to the linker.