configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 30 Apr 2006 20:27:33 +0000
changeset 294 58eb208474e0
parent 289 e893c155075b
child 303 e851b5783fdf
permissions -rw-r--r--
Removed automake dependency, to allow Universal binaries on Mac OS X
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@0
     2
AC_INIT(README)
slouken@0
     3
slouken@0
     4
dnl Set various version strings - taken gratefully from the GTk sources
slouken@0
     5
slouken@0
     6
# Making releases:
slouken@0
     7
#   MICRO_VERSION += 1;
slouken@0
     8
#   INTERFACE_AGE += 1;
slouken@0
     9
#   BINARY_AGE += 1;
slouken@0
    10
# if any functions have been added, set INTERFACE_AGE to 0.
slouken@0
    11
# if backwards compatibility has been broken,
slouken@0
    12
# set BINARY_AGE and INTERFACE_AGE to 0.
slouken@294
    13
#
slouken@0
    14
MAJOR_VERSION=1
slouken@81
    15
MINOR_VERSION=2
slouken@255
    16
MICRO_VERSION=7
slouken@255
    17
INTERFACE_AGE=5
slouken@255
    18
BINARY_AGE=7
slouken@0
    19
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
slouken@0
    20
slouken@0
    21
AC_SUBST(MAJOR_VERSION)
slouken@0
    22
AC_SUBST(MINOR_VERSION)
slouken@0
    23
AC_SUBST(MICRO_VERSION)
slouken@0
    24
AC_SUBST(INTERFACE_AGE)
slouken@0
    25
AC_SUBST(BINARY_AGE)
slouken@0
    26
AC_SUBST(VERSION)
slouken@0
    27
slouken@0
    28
# libtool versioning
slouken@0
    29
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
slouken@0
    30
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
slouken@0
    31
LT_REVISION=$INTERFACE_AGE
slouken@0
    32
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
slouken@0
    33
slouken@0
    34
AC_SUBST(LT_RELEASE)
slouken@0
    35
AC_SUBST(LT_CURRENT)
slouken@0
    36
AC_SUBST(LT_REVISION)
slouken@0
    37
AC_SUBST(LT_AGE)
slouken@0
    38
slouken@289
    39
dnl Detect the canonical build and host environments
slouken@294
    40
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
slouken@289
    41
AC_CANONICAL_HOST
slouken@68
    42
slouken@294
    43
dnl Set up the compiler and linker flags
slouken@294
    44
case "$host" in
slouken@294
    45
    *-*-cygwin*)
slouken@294
    46
        # We build SDL on cygwin without the UNIX emulation layer
slouken@294
    47
        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
slouken@294
    48
        BASE_LDFLAGS="-mno-cygwin"
slouken@294
    49
        ;;
slouken@294
    50
    *)
slouken@294
    51
        BASE_CFLAGS="-D_GNU_SOURCE=1"
slouken@294
    52
        BASE_LDFLAGS=""
slouken@294
    53
        ;;
slouken@294
    54
esac
slouken@294
    55
BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
slouken@294
    56
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
slouken@294
    57
BUILD_LDFLAGS="$LDFLAGS"
slouken@294
    58
EXTRA_LDFLAGS="$BASE_LDFLAGS"
slouken@294
    59
for path in /usr/local; do
slouken@294
    60
    if test -d $path/include; then
slouken@294
    61
        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
slouken@294
    62
    fi
slouken@294
    63
    if test -d $path/lib; then
slouken@294
    64
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
slouken@294
    65
    fi
slouken@294
    66
done
slouken@294
    67
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
slouken@294
    68
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
slouken@294
    69
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
slouken@91
    70
slouken@0
    71
dnl Check for tools
slouken@294
    72
AC_LIBTOOL_WIN32_DLL
slouken@294
    73
AC_PROG_LIBTOOL
slouken@294
    74
AC_PROG_CC
slouken@294
    75
AC_PROG_CXX
slouken@294
    76
AC_PROG_INSTALL
slouken@294
    77
AC_PROG_MAKE_SET
slouken@0
    78
slouken@294
    79
dnl Check for compiler characteristics
slouken@294
    80
AC_C_CONST
slouken@0
    81
slouken@289
    82
case "$host" in
slouken@294
    83
    *-*-cygwin* | *-*-mingw32*)
slouken@294
    84
        EXE=".exe"
slouken@6
    85
        ;;
slouken@294
    86
    *)
slouken@294
    87
        EXE=""
slouken@208
    88
        ;;
slouken@6
    89
esac
slouken@6
    90
slouken@294
    91
# Standard C sources
slouken@294
    92
SOURCES="$SOURCES \
slouken@294
    93
$srcdir/effect_position.c \
slouken@294
    94
$srcdir/effect_stereoreverse.c \
slouken@294
    95
$srcdir/effects_internal.c \
slouken@294
    96
$srcdir/load_aiff.c \
slouken@294
    97
$srcdir/load_voc.c \
slouken@294
    98
$srcdir/mixer.c \
slouken@294
    99
$srcdir/music.c"
slouken@294
   100
slouken@20
   101
dnl Check for SDL
slouken@165
   102
SDL_VERSION=1.2.4
slouken@20
   103
AM_PATH_SDL($SDL_VERSION,
slouken@20
   104
            :,
slouken@20
   105
	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
slouken@20
   106
)
slouken@294
   107
EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS"
slouken@294
   108
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS"
slouken@0
   109
slouken@0
   110
dnl Check command-line options
slouken@91
   111
slouken@0
   112
AC_ARG_ENABLE(music-cmd,
slouken@0
   113
[  --enable-music-cmd      support an external music player [default=yes]],
slouken@0
   114
              , enable_music_cmd=yes)
slouken@0
   115
if test x$enable_music_cmd = xyes; then
slouken@294
   116
    SOURCES="$SOURCES $srcdir/music_cmd.c"
slouken@294
   117
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DCMD_MUSIC"
slouken@0
   118
fi
slouken@0
   119
AC_ARG_ENABLE(music-wave,
slouken@0
   120
[  --enable-music-wave     enable streaming WAVE music [default=yes]],
slouken@0
   121
              , enable_music_wave=yes)
slouken@0
   122
if test x$enable_music_wave = xyes; then
slouken@294
   123
    SOURCES="$SOURCES $srcdir/wavestream.c"
slouken@294
   124
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DWAV_MUSIC"
slouken@0
   125
fi
slouken@257
   126
no_libmikmod=yes
slouken@249
   127
libmikmod_maj=3
slouken@249
   128
libmikmod_min=1
slouken@249
   129
libmikmod_rev=10
slouken@249
   130
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
slouken@249
   131
AC_ARG_ENABLE(music-libmikmod,
slouken@257
   132
[  --enable-music-libmikmod  enable MOD music via external libmikmod [default=no]],
slouken@257
   133
              , enable_music_libmikmod=no)
slouken@249
   134
if test x$enable_music_libmikmod = xyes; then
slouken@249
   135
	AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
slouken@257
   136
	if test "$LIBMIKMOD_CONFIG" != "no" ; then
slouken@257
   137
		no_libmikmod=no
slouken@249
   138
		CFLAGS_SAVED="$CFLAGS"
slouken@249
   139
		LIBS_SAVED="$LIBS"
slouken@249
   140
		CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
slouken@249
   141
		LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
slouken@249
   142
		AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
slouken@249
   143
		AC_TRY_RUN([
slouken@249
   144
#include "mikmod.h"
slouken@249
   145
#include "stdio.h"
slouken@249
   146
slouken@249
   147
int main(int argc, char **argv)
slouken@249
   148
{
slouken@249
   149
	long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
slouken@249
   150
	/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
slouken@249
   151
	if(ver>=((maj<<16)|(min<<8)|(rev))) {
slouken@249
   152
		printf("yes\n");
slouken@249
   153
		return 0;
slouken@249
   154
	}
slouken@249
   155
	printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
slouken@249
   156
	return 1;
slouken@249
   157
}
slouken@257
   158
],,CFLAGS="$CFLAGS_SAVED";LIBS="$LIBS_SAVED",
slouken@249
   159
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
slouken@249
   160
	fi
slouken@249
   161
fi
slouken@249
   162
slouken@1
   163
AC_ARG_ENABLE(music-mod,
slouken@1
   164
[  --enable-music-mod      enable MOD music via mikmod [default=yes]],
slouken@249
   165
, enable_music_mod=$no_libmikmod)
slouken@1
   166
if test x$enable_music_mod = xyes; then
slouken@294
   167
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC -I\$(srcdir)/mikmod"
slouken@294
   168
    SOURCES="$SOURCES $srcdir/mikmod/*.c"
slouken@1
   169
fi
slouken@0
   170
AC_ARG_ENABLE(music-midi,
slouken@0
   171
[  --enable-music-midi     enable MIDI music via timidity [default=yes]],
slouken@0
   172
              , enable_music_midi=yes)
slouken@0
   173
if test x$enable_music_midi = xyes; then
slouken@294
   174
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMID_MUSIC"
slouken@106
   175
    AC_ARG_ENABLE(music-timidity-midi,
slouken@106
   176
[  --enable-music-timidity-midi  enable timidity MIDI output [default=yes]],
slouken@106
   177
                  , enable_music_timidity_midi=yes)
slouken@106
   178
    if test x$enable_music_timidity_midi = xyes; then
slouken@294
   179
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_TIMIDITY_MIDI -I\$(srcdir)/timidity"
slouken@294
   180
        SOURCES="$SOURCES $srcdir/timidity/*.c"
slouken@106
   181
    fi
slouken@99
   182
    AC_ARG_ENABLE(music-native-midi,
slouken@99
   183
[  --enable-music-native-midi  enable native MIDI music output [default=yes]],
slouken@99
   184
                  , enable_music_native_midi=yes)
slouken@99
   185
    if test x$enable_music_native_midi = xyes; then
slouken@99
   186
        use_music_native_midi=no
slouken@289
   187
        case "$host" in
slouken@99
   188
            *-*-cygwin* | *-*-mingw32*)
slouken@99
   189
                use_music_native_midi=yes
slouken@294
   190
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
slouken@99
   191
                ;;
slouken@107
   192
            *-*-darwin*)
slouken@107
   193
                use_music_native_midi=yes
slouken@294
   194
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime"
slouken@107
   195
                ;;
slouken@99
   196
        esac
slouken@99
   197
        if test x$use_music_native_midi = xyes; then
slouken@294
   198
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   199
            SOURCES="$SOURCES $srcdir/native_midi/*.c"
slouken@99
   200
        fi
slouken@99
   201
    fi
slouken@160
   202
    AC_ARG_ENABLE(music-native-midi-gpl,
slouken@160
   203
[  --enable-music-native-midi-gpl  enable native MIDI on UNIX using GPL code [default=no]],
slouken@160
   204
                  , enable_music_native_midi_gpl=no)
slouken@160
   205
    if test x$enable_music_native_midi_gpl = xyes; then
slouken@160
   206
        use_music_native_midi_gpl=no
slouken@289
   207
        case "$host" in
slouken@160
   208
            *-*-linux* | *-*-freebsd*)
slouken@160
   209
                use_music_native_midi_gpl=yes
slouken@160
   210
                ;;
slouken@160
   211
        esac
slouken@160
   212
        if test x$use_music_native_midi_gpl = xyes; then
slouken@294
   213
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   214
            SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c"
slouken@160
   215
        fi
slouken@160
   216
    fi
slouken@0
   217
fi
slouken@63
   218
AC_ARG_ENABLE(music-ogg,
slouken@63
   219
[  --enable-music-ogg      enable Ogg Vorbis music [default=yes]],
slouken@63
   220
              , enable_music_ogg=yes)
slouken@63
   221
if test x$enable_music_ogg = xyes; then
slouken@63
   222
    AC_MSG_CHECKING(for Ogg Vorbis headers and libraries)
slouken@63
   223
    have_vorbis=no
slouken@63
   224
    AC_TRY_COMPILE([
slouken@63
   225
     #include <vorbis/vorbisfile.h>
slouken@63
   226
    ],[
slouken@63
   227
    ],[
slouken@63
   228
    have_vorbis=yes
slouken@63
   229
    ])
slouken@63
   230
    AC_MSG_RESULT($have_vorbis)
slouken@63
   231
    if test x$have_vorbis = xyes; then
slouken@294
   232
        SOURCES="$SOURCE $srcdir/load_ogg.c $srcdir/music_ogg.c"
slouken@294
   233
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
slouken@294
   234
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
slouken@63
   235
    fi
slouken@63
   236
fi
slouken@0
   237
AC_ARG_ENABLE(music-mp3,
slouken@0
   238
[  --enable-music-mp3      enable MP3 music via smpeg [default=yes]],
slouken@0
   239
              , enable_music_mp3=yes)
slouken@0
   240
if test x$enable_music_mp3 = xyes; then
slouken@83
   241
    SMPEG_VERSION=0.4.3
slouken@83
   242
    AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
slouken@0
   243
    if test x$have_smpeg = xyes; then
slouken@294
   244
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
slouken@294
   245
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
slouken@0
   246
    fi
slouken@0
   247
fi
slouken@0
   248
slouken@294
   249
OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@1
   250
slouken@294
   251
dnl Expand the sources and objects needed to build the library
slouken@294
   252
AC_SUBST(ac_aux_dir)
slouken@294
   253
AC_SUBST(SOURCES)
slouken@294
   254
AC_SUBST(OBJECTS)
slouken@294
   255
AC_SUBST(BUILD_CFLAGS)
slouken@294
   256
AC_SUBST(EXTRA_CFLAGS)
slouken@294
   257
AC_SUBST(BUILD_LDFLAGS)
slouken@294
   258
AC_SUBST(EXTRA_LDFLAGS)
slouken@294
   259
AC_SUBST(EXE)
slouken@294
   260
AC_SUBST(SDL_CFLAGS)
slouken@294
   261
AC_SUBST(SDL_LIBS)
slouken@206
   262
slouken@0
   263
AC_OUTPUT([
slouken@294
   264
    Makefile SDL_mixer.spec SDL_mixer.qpg
slouken@294
   265
], [
slouken@294
   266
    : >build-deps
slouken@294
   267
    if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
slouken@0
   268
])