SDL的下载http://www.libsdl.org/download-1.2.php,在shell下# tar xzvf SDL-1.2.14.tar.gz –C /usr 解压到/usr目录下,然后# cd /usr/SDL-1.2.14,进入SDL包的顶层目录里面的docs目录里面有html的帮助文本档。当然上面只是大概的介绍了SDL的包含部分功能以及开发开发API和Example,具体的大家可以自己看,我在这里就不一一叙述了…

在shell下输入# ./configure –help 可以查看配置参数

[root@localhost SDL-1.2.14]# ./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

X features:
  --x-includes=DIR    X include files are in DIR
  --x-libraries=DIR   X library files are in DIR

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-shared[=PKGS]  build shared libraries [default=yes]
  --enable-static[=PKGS]  build static libraries [default=yes]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --enable-libc           Use the system C library [default=yes]
  --enable-audio          Enable the audio subsystem [default=yes]
  --enable-video          Enable the video subsystem [default=yes]
  --enable-events         Enable the events subsystem [default=yes]
  --enable-joystick       Enable the joystick subsystem [default=yes]
  --enable-cdrom          Enable the cdrom subsystem [default=yes]
  --enable-threads        Enable the threading subsystem [default=yes]
  --enable-timers         Enable the timer subsystem [default=yes]
  --enable-file           Enable the file subsystem [default=yes]
  --enable-loadso         Enable the shared object loading subsystem
                          [default=yes]
  --enable-cpuinfo        Enable the cpuinfo subsystem [default=yes]
  --enable-assembly       Enable assembly routines [default=yes]
  --enable-oss            support the OSS audio API [default=yes]
  --enable-alsa           support the ALSA audio API [default=yes]
  --disable-alsatest      Do not try to compile and run a test Alsa program
  --enable-alsa-shared    dynamically load ALSA audio support [default=yes]
  --enable-esd            support the Enlightened Sound Daemon [default=yes]
  --disable-esdtest       Do not try to compile and run a test ESD program
  --enable-esd-shared     dynamically load ESD audio support [default=yes]
  --enable-pulseaudio     use PulseAudio [default=yes]
  --enable-pulseaudio-shared
                          dynamically load PulseAudio support [default=yes]
  --enable-arts           support the Analog Real Time Synthesizer
                          [default=yes]
  --enable-arts-shared    dynamically load aRts audio support [default=yes]
  --enable-nas            support the NAS audio API [default=yes]
  --enable-nas-shared     dynamically load NAS audio support [default=yes]
  --enable-diskaudio      support the disk writer audio driver [default=yes]
  --enable-dummyaudio     support the dummy audio driver [default=yes]
  --enable-mintaudio      support Atari audio driver [default=yes]
  --enable-nasm           use nasm assembly blitters on x86 [default=yes]
  --enable-altivec        use altivec assembly blitters on PPC [default=yes]
  --enable-ipod           configure SDL to work with iPodLinux [default=no]
  --enable-video-nanox    use nanox video driver [default=no]
  --enable-nanox-debug    print debug messages [default=no]
  --enable-nanox-share-memory
                          use share memory [default=no]
  --enable-nanox-direct-fb
                          use direct framebuffer access [default=no]
  --enable-video-x11      use X11 video driver [default=yes]
  --enable-x11-shared     dynamically load X11 support [default=maybe]
  --enable-dga            allow use of X11 DGA code [default=yes]
  --enable-video-dga      use DGA 2.0 video driver [default=yes]
  --enable-video-x11-dgamouse
                          use X11 DGA for mouse events [default=yes]
  --enable-video-x11-vm   use X11 VM extension for fullscreen [default=yes]
  --enable-video-x11-xv   use X11 XvImage extension for video [default=yes]
  --enable-video-x11-xinerama
                          enable X11 Xinerama support [default=yes]
  --enable-video-x11-xme  enable Xi Graphics XME for fullscreen
                          [default=yes]
  --enable-video-x11-xrandr
                          enable X11 Xrandr extension for fullscreen
                          [default=yes]
  --enable-video-photon   use QNX Photon video driver [default=yes]
  --enable-video-carbon   use Carbon/QuickDraw video driver [default=no]
  --enable-video-cocoa    use Cocoa/Quartz video driver [default=yes]
  --enable-video-fbcon    use framebuffer console video driver [default=yes]
  --enable-video-directfb use DirectFB video driver [default=yes]
  --enable-video-ps2gs    use PlayStation 2 GS video driver [default=yes]
  --enable-video-ps3      use PlayStation 3 Cell driver [default=yes]
  --enable-video-ggi      use GGI video driver [default=no]
  --enable-video-svga     use SVGAlib video driver [default=yes]
  --enable-video-vgl      use VGL video driver [default=yes]
  --enable-video-wscons   use wscons video driver [default=yes]
  --enable-video-aalib    use AAlib video driver [default=no]
  --enable-video-caca     use libcaca video driver [default=no]
  --enable-video-qtopia   use Qtopia video driver [default=no]
  --enable-video-picogui  use PicoGUI video driver [default=no]
  --enable-video-xbios    use Atari Xbios video driver [default=yes]
  --enable-video-gem      use Atari Gem video driver [default=yes]
  --enable-video-dummy    use dummy video driver [default=yes]
  --enable-video-opengl   include OpenGL context creation [default=yes]
  --enable-osmesa-shared  dynamically load OSMesa OpenGL support
                          [default=yes]
  --enable-screensaver    enable screensaver by default while any SDL
                          application is running [default=no]
  --enable-input-events   use Linux 2.4 unified input interface
                          [default=yes]
  --enable-input-tslib    use the Touchscreen library for input
                          [default=yes]
  --enable-pth            use GNU pth library for multi-threading
                          [default=yes]
  --enable-pthreads       use POSIX threads for multi-threading
                          [default=yes]
  --enable-pthread-sem    use pthread semaphores [default=yes]
  --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]
  --enable-directx        use DirectX for Win32 audio/video [default=yes]
  --enable-sdl-dlopen     use dlopen for shared object loading [default=yes]
  --enable-atari-ldg      use Atari LDG for shared object loading
                          [default=yes]
  --enable-clock_gettime  use clock_gettime() instead of gettimeofday() on
                          UNIX [default=no]
  --enable-rpath          use an rpath when linking SDL [default=yes]

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-pic              try to use only PIC/non-PIC objects [default=use
                          both]
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-alsa-prefix=PFX  Prefix where Alsa library is installed(optional)
  --with-alsa-inc-prefix=PFX  Prefix where include libraries are (optional)
  --with-esd-prefix=PFX   Prefix where ESD is installed (optional)
  --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)
  --with-x                use the X Window System

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CXXCPP      C++ preprocessor
  XMKMF       Path to xmkmf, Makefile generator for X Window System

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

 

在这里,我们如果想让可执行程序只在PC机上运行的话,可简单的配置一下,只需指定--prefix=指定的目录例如--prefix=/opt    默认的install architecture-independent files in PREFIX [/usr/local] ,如果交叉编译到arm平台上的话只需把指定--host=arm-linux即可。PC平台上无需指定。

SDL的交叉编译

# ./configure --prefix=/opt --disable-video-nanox -disable-video-qtopia
--disable-video-photon --disable-video-ggi --disable-video-svga --disable-video-aalib
--disable-video-dummy --disable-video-dga --disable-arts --disable-esd --disable-alsa
--disable-video-x11 --disable-nasm --enable-joystick --enable-input-tslib
--enable-video-fbcon --host=arm-linux --build=i386

然后#make

#make install

在/opt下面会生成相应的目录。在SDL里面有一个test目录里面有相应的源码测试,可以直接configure然后生成makefile文件再make编译生成可执行文件。

里面的test有各种测试,有兴趣的可以研究一下里面的算法。