configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 18 Jul 2007 04:00:40 +0000
changeset 164 4da51f0c28e4
parent 160 622e6e017512
child 165 a853241b7a26
permissions -rw-r--r--
Added support for building version.rc
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@0
    13
slouken@0
    14
MAJOR_VERSION=1
slouken@28
    15
MINOR_VERSION=2
slouken@160
    16
MICRO_VERSION=6
slouken@160
    17
INTERFACE_AGE=5
slouken@160
    18
BINARY_AGE=6
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@122
    39
dnl Detect the canonical build and host environments
slouken@122
    40
AC_CANONICAL_HOST
slouken@2
    41
slouken@40
    42
dnl Setup for automake
slouken@40
    43
AM_INIT_AUTOMAKE(SDL_image, $VERSION)
slouken@40
    44
slouken@0
    45
dnl Check for tools
slouken@0
    46
slouken@2
    47
AC_LIBTOOL_WIN32_DLL
slouken@2
    48
AM_PROG_LIBTOOL
slouken@0
    49
AC_PROG_CC
slouken@22
    50
AC_C_INLINE
slouken@0
    51
AC_PROG_INSTALL
slouken@164
    52
AC_PROG_MAKE_SET
slouken@164
    53
if test -z "$host_alias"; then
slouken@164
    54
    hostaliaswindres=
slouken@164
    55
else
slouken@164
    56
    hostaliaswindres="$host_alias-windres"
slouken@164
    57
fi
slouken@164
    58
AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
slouken@0
    59
slouken@0
    60
dnl The alpha architecture needs special flags for binary portability
slouken@122
    61
case "$host" in
slouken@0
    62
    alpha*-*-linux*)
slouken@0
    63
        CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
slouken@0
    64
        ;;
slouken@33
    65
    *-*-beos*)
slouken@33
    66
        ac_default_prefix=/boot/develop/tools/gnupro
slouken@33
    67
        ;;
slouken@2
    68
    *-*-cygwin* | *-*-mingw32*)
slouken@122
    69
        if test "$build" != "$host"; then # cross-compiling
slouken@44
    70
            # Default cross-compile location
slouken@157
    71
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32
slouken@44
    72
        else
slouken@44
    73
            # Look for the location of the tools and install there
slouken@113
    74
            if test "$BUILD_PREFIX" != ""; then
slouken@44
    75
                ac_default_prefix=$BUILD_PREFIX
slouken@44
    76
            fi
slouken@2
    77
        fi
slouken@164
    78
        if test x$WINDRES != x; then
slouken@164
    79
            use_version_rc=true
slouken@164
    80
        fi
slouken@2
    81
        ;;
slouken@0
    82
esac
slouken@164
    83
AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue)
slouken@0
    84
slouken@0
    85
dnl Check for SDL
slouken@144
    86
SDL_VERSION=1.2.10
slouken@0
    87
AM_PATH_SDL($SDL_VERSION,
slouken@0
    88
            :,
slouken@137
    89
           AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
slouken@0
    90
)
slouken@0
    91
CFLAGS="$CFLAGS $SDL_CFLAGS"
slouken@75
    92
LIBS="$LIBS $SDL_LIBS"
slouken@137
    93
saved_LIBS="$LIBS"
slouken@0
    94
slouken@0
    95
dnl Check command-line options
slouken@137
    96
AC_ARG_ENABLE([bmp], [AC_HELP_STRING([--enable-bmp], [support loading BMP images [default=yes]])],
slouken@137
    97
 [], [enable_bmp=yes])
slouken@137
    98
AC_ARG_ENABLE([gif], [AC_HELP_STRING([--enable-gif], [support loading GIF images [default=yes]])],
slouken@137
    99
 [], [enable_gif=yes])
slouken@137
   100
AC_ARG_ENABLE([jpg], [AC_HELP_STRING([--enable-jpg], [support loading JPG images [default=yes]])],
slouken@137
   101
 [], [enable_jpg=yes])
slouken@143
   102
AC_ARG_ENABLE([jpg-shared], AC_HELP_STRING([--enable-jpg-shared], [dynamically load JPG support [[default=yes]]]),
slouken@143
   103
 [], [enable_jpg_shared=yes])
slouken@137
   104
AC_ARG_ENABLE([lbm], [AC_HELP_STRING([--enable-lbm], [support loading LBM images [default=yes]])],
slouken@137
   105
 [], [enable_lbm=yes])
slouken@137
   106
AC_ARG_ENABLE([pcx], [AC_HELP_STRING([--enable-pcx], [support loading PCX images [default=yes]])],
slouken@137
   107
 [], [enable_pcx=yes])
slouken@143
   108
AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-png], [support loading PNG images [default=yes]])],
slouken@137
   109
 [], [enable_png=yes])
slouken@143
   110
AC_ARG_ENABLE([png-shared], AC_HELP_STRING([--enable-png-shared], [dynamically load PNG support [[default=yes]]]),
slouken@143
   111
 [], [enable_png_shared=yes])
slouken@137
   112
AC_ARG_ENABLE([pnm], [AC_HELP_STRING([--enable-pnm], [support loading PNM images [default=yes]])],
slouken@137
   113
 [], [enable_pnm=yes])
slouken@137
   114
AC_ARG_ENABLE([tga], [AC_HELP_STRING([--enable-tga], [support loading TGA images [default=yes]])],
slouken@137
   115
 [], [enable_tga=yes])
slouken@143
   116
AC_ARG_ENABLE([tif], [AC_HELP_STRING([--enable-tif], [support loading TIFF images [default=yes]])],
slouken@143
   117
 [], [enable_tif=yes])
slouken@143
   118
AC_ARG_ENABLE([tif-shared], AC_HELP_STRING([--enable-tif-shared], [dynamically load TIFF support [[default=yes]]]),
slouken@143
   119
 [], [enable_tif_shared=yes])
slouken@137
   120
AC_ARG_ENABLE([xcf], [AC_HELP_STRING([--enable-xcf], [support loading XCF images [default=yes]])],
slouken@137
   121
 [], [enable_xcf=yes])
slouken@137
   122
AC_ARG_ENABLE([xpm], [AC_HELP_STRING([--enable-xpm], [support loading XPM images [default=yes]])],
slouken@137
   123
 [], [enable_xpm=yes])
slouken@137
   124
AC_ARG_ENABLE([xv], [AC_HELP_STRING([--enable-xv], [support loading XV images [default=yes]])],
slouken@137
   125
 [], [enable_xv=yes])
slouken@137
   126
slouken@143
   127
if test x$enable_png = xyes || test x$enable_tif = xyes; then
slouken@159
   128
    CHECK_ZLIB()
slouken@0
   129
fi
slouken@137
   130
slouken@143
   131
if test x$enable_jpg = xyes || test x$enable_tif = xyes; then
slouken@137
   132
    AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], [have_libjpeg=yes])
slouken@0
   133
    if test x$have_libjpeg = xyes; then
slouken@137
   134
        if test x$enable_jpg = xyes; then
slouken@137
   135
            AC_DEFINE(LOAD_JPG)
slouken@137
   136
        fi
slouken@137
   137
        LIBS="-ljpeg $LIBS"
slouken@143
   138
slouken@143
   139
        case "$host" in
slouken@143
   140
            *-*-darwin*) # FIXME when Mac OS X ships with libjpeg
slouken@143
   141
                jpg_lib=''
slouken@143
   142
                ;;
slouken@143
   143
            *-*-cygwin* | *-*-mingw32*)
slouken@143
   144
                jpg_lib='jpeg.dll'
slouken@143
   145
                ;;
slouken@143
   146
            *)
slouken@143
   147
                for path in /usr/lib /usr/local/lib; do
slouken@143
   148
                    if test x$jpg_lib = x; then
slouken@143
   149
                        jpg_lib=[`ls -- $path/libjpeg.so.[0-9][0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@143
   150
                    fi
slouken@143
   151
                done
slouken@143
   152
                ;;
slouken@143
   153
        esac
slouken@137
   154
    elif test x$enable_jpg = xyes; then
slouken@137
   155
        AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
slouken@0
   156
        AC_MSG_WARN([JPG image loading disabled])
slouken@0
   157
    fi
slouken@0
   158
fi
slouken@137
   159
slouken@0
   160
if test x$enable_png = xyes; then
slouken@137
   161
    AC_CHECK_LIB([png], [png_create_read_struct], [have_libpng=yes])
slouken@137
   162
    if test x$have_libpng = xyes; then
slouken@137
   163
        AC_DEFINE([LOAD_PNG])
slouken@143
   164
slouken@143
   165
        case "$host" in
slouken@143
   166
            *-*-darwin*) # FIXME when Mac OS X ships with libpng
slouken@143
   167
                png_lib=''
slouken@143
   168
                ;;
slouken@143
   169
            *-*-cygwin* | *-*-mingw32*)
slouken@143
   170
                png_lib='libpng13.dll'
slouken@143
   171
                ;;
slouken@143
   172
            *)
slouken@143
   173
                for path in /usr/lib /usr/local/lib; do
slouken@143
   174
                    if test x$png_lib = x; then
slouken@143
   175
                        png_lib=[`ls -- $path/libpng.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@143
   176
                    fi
slouken@143
   177
                done
slouken@143
   178
                ;;
slouken@143
   179
        esac
slouken@0
   180
    else
slouken@137
   181
        AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
slouken@0
   182
        AC_MSG_WARN([PNG image loading disabled])
slouken@0
   183
    fi
slouken@0
   184
fi
slouken@137
   185
slouken@0
   186
if test x$enable_tif = xyes; then
slouken@137
   187
    AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_libtiff=yes])
slouken@0
   188
    if test x$have_libtiff = xyes; then
slouken@137
   189
        AC_DEFINE([LOAD_TIF])
slouken@143
   190
slouken@143
   191
        case "$host" in
slouken@143
   192
            *-*-darwin*) # FIXME when Mac OS X ships with libtiff
slouken@143
   193
                tif_lib=''
slouken@143
   194
                ;;
slouken@143
   195
            *-*-cygwin* | *-*-mingw32*)
slouken@143
   196
                tif_lib='libtiff.dll'
slouken@143
   197
                ;;
slouken@143
   198
            *)
slouken@143
   199
                for path in /usr/lib /usr/local/lib; do
slouken@143
   200
                    if test x$tif_lib = x; then
slouken@143
   201
                        tif_lib=[`ls -- $path/libtiff.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@143
   202
                    fi
slouken@143
   203
                done
slouken@143
   204
                ;;
slouken@143
   205
        esac
slouken@0
   206
    else
slouken@143
   207
        AC_MSG_WARN([*** Unable to find Tiff library (http://www.remotesensing.org/libtiff/)])
slouken@0
   208
        AC_MSG_WARN([TIF image loading disabled])
slouken@0
   209
    fi
slouken@0
   210
fi
slouken@137
   211
slouken@137
   212
if test x$enable_bmp = xyes; then
slouken@137
   213
    AC_DEFINE([LOAD_BMP])
slouken@137
   214
fi
slouken@137
   215
slouken@137
   216
if test x$enable_gif = xyes; then
slouken@137
   217
    AC_DEFINE([LOAD_GIF])
slouken@137
   218
fi
slouken@137
   219
slouken@137
   220
if test x$enable_lbm = xyes; then
slouken@137
   221
    AC_DEFINE([LOAD_LBM])
slouken@137
   222
fi
slouken@137
   223
slouken@137
   224
if test x$enable_pcx = xyes; then
slouken@137
   225
    AC_DEFINE([LOAD_PCX])
slouken@137
   226
fi
slouken@137
   227
slouken@137
   228
if test x$enable_pnm = xyes; then
slouken@137
   229
    AC_DEFINE([LOAD_PNM])
slouken@137
   230
fi
slouken@137
   231
slouken@137
   232
if test x$enable_tga = xyes; then
slouken@137
   233
    AC_DEFINE([LOAD_TGA])
slouken@137
   234
fi
slouken@137
   235
slouken@26
   236
if test x$enable_xcf = xyes; then
slouken@137
   237
    AC_DEFINE([LOAD_XCF])
slouken@26
   238
fi
slouken@137
   239
slouken@7
   240
if test x$enable_xpm = xyes; then
slouken@137
   241
    AC_DEFINE([LOAD_XPM])
slouken@7
   242
fi
slouken@137
   243
slouken@119
   244
if test x$enable_xv = xyes; then
slouken@137
   245
    AC_DEFINE([LOAD_XV])
slouken@119
   246
fi
slouken@137
   247
slouken@155
   248
if test x$enable_tif = xyes -a x$have_libtiff = xyes; then
slouken@143
   249
    if test x$enable_tif_shared = xyes && test x$tif_lib != x; then
slouken@143
   250
        echo "-- dynamic libtiff -> $tif_lib"
slouken@143
   251
        AC_DEFINE_UNQUOTED(LOAD_TIF_DYNAMIC, "$tif_lib")
slouken@143
   252
    else
slouken@143
   253
        if test x$have_libjpeg = xyes; then
slouken@143
   254
            # Disable dynamic jpeg since we're linking it explicitly
slouken@143
   255
            jpg_lib=''
slouken@143
   256
        fi
slouken@156
   257
        IMG_LIBS="-ltiff -lz $IMG_LIBS"
slouken@143
   258
    fi
slouken@143
   259
fi
slouken@156
   260
if test x$enable_jpg = xyes -a x$have_libjpeg = xyes; then
slouken@143
   261
    if test x$enable_jpg_shared = xyes && test x$jpg_lib != x; then
slouken@143
   262
        echo "-- dynamic libjpeg -> $jpg_lib"
slouken@143
   263
        AC_DEFINE_UNQUOTED(LOAD_JPG_DYNAMIC, "$jpg_lib")
slouken@143
   264
    else
slouken@143
   265
        IMG_LIBS="-ljpeg $IMG_LIBS"
slouken@143
   266
    fi
slouken@143
   267
fi
slouken@155
   268
if test x$enable_png = xyes -a x$have_libpng = xyes; then
slouken@143
   269
    if test x$enable_png_shared = xyes && test x$png_lib != x; then
slouken@143
   270
        echo "-- dynamic libpng -> $png_lib"
slouken@143
   271
        AC_DEFINE_UNQUOTED(LOAD_PNG_DYNAMIC, "$png_lib")
slouken@143
   272
    else
slouken@143
   273
        IMG_LIBS="-lpng -lz $IMG_LIBS"
slouken@143
   274
    fi
slouken@143
   275
fi
slouken@143
   276
slouken@137
   277
LIBS="$saved_LIBS"
slouken@137
   278
slouken@164
   279
AC_SUBST(WINDRES)
slouken@164
   280
AC_SUBST(IMG_LIBS)
slouken@0
   281
slouken@0
   282
# Finally create all the generated files
slouken@0
   283
AC_OUTPUT([
slouken@0
   284
Makefile
slouken@0
   285
SDL_image.spec
slouken@93
   286
SDL_image.qpg
slouken@0
   287
])