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