configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 04 Oct 2009 22:21:17 +0000
changeset 217 b61658310831
parent 215 e91d1c0a829a
child 218 2de9bc66d664
permissions -rw-r--r--
Updated libtool to version 2.2.6a
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@206
    16
MICRO_VERSION=8
slouken@206
    17
INTERFACE_AGE=0
slouken@206
    18
BINARY_AGE=8
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@217
    29
LT_INIT([win32-dll])
slouken@217
    30
slouken@0
    31
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
slouken@0
    32
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
slouken@0
    33
LT_REVISION=$INTERFACE_AGE
slouken@0
    34
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
slouken@0
    35
slouken@0
    36
AC_SUBST(LT_RELEASE)
slouken@0
    37
AC_SUBST(LT_CURRENT)
slouken@0
    38
AC_SUBST(LT_REVISION)
slouken@0
    39
AC_SUBST(LT_AGE)
slouken@0
    40
slouken@122
    41
dnl Detect the canonical build and host environments
slouken@122
    42
AC_CANONICAL_HOST
slouken@2
    43
slouken@40
    44
dnl Setup for automake
slouken@40
    45
AM_INIT_AUTOMAKE(SDL_image, $VERSION)
slouken@40
    46
slouken@0
    47
dnl Check for tools
slouken@217
    48
AC_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@122
    60
case "$host" in
slouken@33
    61
    *-*-beos*)
slouken@33
    62
        ac_default_prefix=/boot/develop/tools/gnupro
slouken@33
    63
        ;;
slouken@2
    64
    *-*-cygwin* | *-*-mingw32*)
slouken@122
    65
        if test "$build" != "$host"; then # cross-compiling
slouken@44
    66
            # Default cross-compile location
slouken@157
    67
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32
slouken@44
    68
        else
slouken@44
    69
            # Look for the location of the tools and install there
slouken@113
    70
            if test "$BUILD_PREFIX" != ""; then
slouken@44
    71
                ac_default_prefix=$BUILD_PREFIX
slouken@44
    72
            fi
slouken@2
    73
        fi
slouken@164
    74
        if test x$WINDRES != x; then
slouken@164
    75
            use_version_rc=true
slouken@164
    76
        fi
slouken@2
    77
        ;;
slouken@0
    78
esac
slouken@164
    79
AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue)
slouken@0
    80
slouken@0
    81
dnl Check for SDL
slouken@144
    82
SDL_VERSION=1.2.10
slouken@196
    83
AC_SUBST(SDL_VERSION)
slouken@0
    84
AM_PATH_SDL($SDL_VERSION,
slouken@0
    85
            :,
slouken@137
    86
           AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
slouken@0
    87
)
slouken@191
    88
CFLAGS="$CFLAGS -DSDL_IMAGE_USE_COMMON_BACKEND $SDL_CFLAGS"
slouken@75
    89
LIBS="$LIBS $SDL_LIBS"
slouken@137
    90
saved_LIBS="$LIBS"
slouken@0
    91
slouken@0
    92
dnl Check command-line options
couriersud@189
    93
AC_ARG_ENABLE([bmp], [AC_HELP_STRING([--enable-bmp], [support loading BMP/ICO/CUR images [default=yes]])],
slouken@137
    94
 [], [enable_bmp=yes])
slouken@137
    95
AC_ARG_ENABLE([gif], [AC_HELP_STRING([--enable-gif], [support loading GIF images [default=yes]])],
slouken@137
    96
 [], [enable_gif=yes])
slouken@137
    97
AC_ARG_ENABLE([jpg], [AC_HELP_STRING([--enable-jpg], [support loading JPG images [default=yes]])],
slouken@137
    98
 [], [enable_jpg=yes])
slouken@143
    99
AC_ARG_ENABLE([jpg-shared], AC_HELP_STRING([--enable-jpg-shared], [dynamically load JPG support [[default=yes]]]),
slouken@143
   100
 [], [enable_jpg_shared=yes])
slouken@137
   101
AC_ARG_ENABLE([lbm], [AC_HELP_STRING([--enable-lbm], [support loading LBM images [default=yes]])],
slouken@137
   102
 [], [enable_lbm=yes])
slouken@137
   103
AC_ARG_ENABLE([pcx], [AC_HELP_STRING([--enable-pcx], [support loading PCX images [default=yes]])],
slouken@137
   104
 [], [enable_pcx=yes])
slouken@143
   105
AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-png], [support loading PNG images [default=yes]])],
slouken@137
   106
 [], [enable_png=yes])
slouken@143
   107
AC_ARG_ENABLE([png-shared], AC_HELP_STRING([--enable-png-shared], [dynamically load PNG support [[default=yes]]]),
slouken@143
   108
 [], [enable_png_shared=yes])
slouken@137
   109
AC_ARG_ENABLE([pnm], [AC_HELP_STRING([--enable-pnm], [support loading PNM images [default=yes]])],
slouken@137
   110
 [], [enable_pnm=yes])
slouken@137
   111
AC_ARG_ENABLE([tga], [AC_HELP_STRING([--enable-tga], [support loading TGA images [default=yes]])],
slouken@137
   112
 [], [enable_tga=yes])
slouken@143
   113
AC_ARG_ENABLE([tif], [AC_HELP_STRING([--enable-tif], [support loading TIFF images [default=yes]])],
slouken@143
   114
 [], [enable_tif=yes])
slouken@143
   115
AC_ARG_ENABLE([tif-shared], AC_HELP_STRING([--enable-tif-shared], [dynamically load TIFF support [[default=yes]]]),
slouken@143
   116
 [], [enable_tif_shared=yes])
slouken@137
   117
AC_ARG_ENABLE([xcf], [AC_HELP_STRING([--enable-xcf], [support loading XCF images [default=yes]])],
slouken@137
   118
 [], [enable_xcf=yes])
slouken@137
   119
AC_ARG_ENABLE([xpm], [AC_HELP_STRING([--enable-xpm], [support loading XPM images [default=yes]])],
slouken@137
   120
 [], [enable_xpm=yes])
slouken@137
   121
AC_ARG_ENABLE([xv], [AC_HELP_STRING([--enable-xv], [support loading XV images [default=yes]])],
slouken@137
   122
 [], [enable_xv=yes])
slouken@137
   123
slouken@168
   124
find_lib()
slouken@168
   125
{
slouken@173
   126
    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@173
   127
    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@168
   128
    env_lib_path=[`echo $LIBS $LDFLAGS | sed 's/-L[ ]*//g'`]
slouken@211
   129
    if test "$cross_compiling" = yes; then
slouken@211
   130
        host_lib_path=""
slouken@211
   131
    else
slouken@211
   132
        host_lib_path="/usr/lib /usr/local/lib"
slouken@211
   133
    fi
slouken@211
   134
    for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
slouken@168
   135
        lib=[`ls -- $path/$1 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@168
   136
        if test x$lib != x; then
slouken@168
   137
            echo $lib
slouken@168
   138
            return
slouken@168
   139
        fi
slouken@168
   140
    done
slouken@168
   141
}
slouken@168
   142
slouken@143
   143
if test x$enable_jpg = xyes || test x$enable_tif = xyes; then
slouken@168
   144
    AC_CHECK_HEADER([jpeglib.h], [have_jpg_hdr=yes])
slouken@168
   145
    AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], [have_jpg_lib=yes])
slouken@168
   146
    if test x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
slouken@137
   147
        if test x$enable_jpg = xyes; then
slouken@168
   148
            AC_DEFINE([LOAD_JPG])
slouken@137
   149
        fi
slouken@137
   150
        LIBS="-ljpeg $LIBS"
slouken@143
   151
slouken@143
   152
        case "$host" in
slouken@168
   153
            *-*-darwin*)
slouken@169
   154
                jpg_lib=[`find_lib libjpeg*.dylib`]
slouken@143
   155
                ;;
slouken@143
   156
            *-*-cygwin* | *-*-mingw32*)
slouken@173
   157
                jpg_lib=[`find_lib "jpeg.dll"`]
slouken@143
   158
                ;;
slouken@143
   159
            *)
slouken@170
   160
                jpg_lib=[`find_lib "libjpeg.so.[0-9]"`]
slouken@170
   161
                if test x$jpg_lib = x; then
slouken@177
   162
                    jpg_lib=[`find_lib "libjpeg.so.[0-9][0-9]"`]
slouken@177
   163
                fi
slouken@177
   164
                if test x$jpg_lib = x; then
slouken@170
   165
                    jpg_lib=[`find_lib "libjpeg.so.[0-9]*"`]
slouken@170
   166
                fi
slouken@143
   167
                ;;
slouken@143
   168
        esac
slouken@137
   169
    elif test x$enable_jpg = xyes; then
slouken@137
   170
        AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
slouken@0
   171
        AC_MSG_WARN([JPG image loading disabled])
slouken@0
   172
    fi
slouken@0
   173
fi
slouken@137
   174
slouken@0
   175
if test x$enable_png = xyes; then
slouken@168
   176
    AC_CHECK_HEADER([png.h], [have_png_hdr=yes])
slouken@203
   177
    AC_CHECK_LIB([png], [png_create_read_struct], [have_png_lib=yes], [], [-lz])
slouken@168
   178
    if test x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
slouken@137
   179
        AC_DEFINE([LOAD_PNG])
slouken@143
   180
slouken@143
   181
        case "$host" in
slouken@168
   182
            *-*-darwin*)
slouken@169
   183
                png_lib=[`find_lib libpng*.dylib`]
slouken@143
   184
                ;;
slouken@143
   185
            *-*-cygwin* | *-*-mingw32*)
slouken@173
   186
                png_lib=[`find_lib "libpng*.dll"`]
slouken@143
   187
                ;;
slouken@143
   188
            *)
slouken@170
   189
                png_lib=[`find_lib "libpng.so.[0-9]"`]
slouken@170
   190
                if test x$png_lib = x; then
slouken@170
   191
                    png_lib=[`find_lib "libpng.so.[0-9]*"`]
slouken@170
   192
                fi
slouken@215
   193
                if test x$png_lib = x; then
slouken@215
   194
                    png_lib=[`find_lib "libpng*.so.[0-9]"`]
slouken@215
   195
                fi
slouken@215
   196
                if test x$png_lib = x; then
slouken@215
   197
                    png_lib=[`find_lib "libpng*.so.[0-9]*"`]
slouken@215
   198
                fi
slouken@143
   199
                ;;
slouken@143
   200
        esac
slouken@0
   201
    else
slouken@137
   202
        AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
slouken@0
   203
        AC_MSG_WARN([PNG image loading disabled])
slouken@0
   204
    fi
slouken@0
   205
fi
slouken@137
   206
slouken@0
   207
if test x$enable_tif = xyes; then
slouken@168
   208
    AC_CHECK_HEADER([tiffio.h], [have_tif_hdr=yes])
slouken@203
   209
    AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_tif_lib=yes], [], [-lz])
slouken@168
   210
    if test x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
slouken@137
   211
        AC_DEFINE([LOAD_TIF])
slouken@143
   212
slouken@143
   213
        case "$host" in
slouken@168
   214
            *-*-darwin*)
slouken@169
   215
                tif_lib=[`find_lib libtiff*.dylib`]
slouken@143
   216
                ;;
slouken@143
   217
            *-*-cygwin* | *-*-mingw32*)
slouken@173
   218
                tif_lib=[`find_lib "libtiff-*.dll"`]
slouken@143
   219
                ;;
slouken@143
   220
            *)
slouken@170
   221
                tif_lib=[`find_lib "libtiff.so.[0-9]"`]
slouken@170
   222
                if test x$tif_lib = x; then
slouken@170
   223
                    tif_lib=[`find_lib "libtiff.so.[0-9]*"`]
slouken@170
   224
                fi
slouken@143
   225
                ;;
slouken@143
   226
        esac
slouken@0
   227
    else
slouken@143
   228
        AC_MSG_WARN([*** Unable to find Tiff library (http://www.remotesensing.org/libtiff/)])
slouken@0
   229
        AC_MSG_WARN([TIF image loading disabled])
slouken@0
   230
    fi
slouken@0
   231
fi
slouken@137
   232
slouken@137
   233
if test x$enable_bmp = xyes; then
slouken@137
   234
    AC_DEFINE([LOAD_BMP])
slouken@137
   235
fi
slouken@137
   236
slouken@137
   237
if test x$enable_gif = xyes; then
slouken@137
   238
    AC_DEFINE([LOAD_GIF])
slouken@137
   239
fi
slouken@137
   240
slouken@137
   241
if test x$enable_lbm = xyes; then
slouken@137
   242
    AC_DEFINE([LOAD_LBM])
slouken@137
   243
fi
slouken@137
   244
slouken@137
   245
if test x$enable_pcx = xyes; then
slouken@137
   246
    AC_DEFINE([LOAD_PCX])
slouken@137
   247
fi
slouken@137
   248
slouken@137
   249
if test x$enable_pnm = xyes; then
slouken@137
   250
    AC_DEFINE([LOAD_PNM])
slouken@137
   251
fi
slouken@137
   252
slouken@137
   253
if test x$enable_tga = xyes; then
slouken@137
   254
    AC_DEFINE([LOAD_TGA])
slouken@137
   255
fi
slouken@137
   256
slouken@26
   257
if test x$enable_xcf = xyes; then
slouken@137
   258
    AC_DEFINE([LOAD_XCF])
slouken@26
   259
fi
slouken@137
   260
slouken@7
   261
if test x$enable_xpm = xyes; then
slouken@137
   262
    AC_DEFINE([LOAD_XPM])
slouken@7
   263
fi
slouken@137
   264
slouken@119
   265
if test x$enable_xv = xyes; then
slouken@137
   266
    AC_DEFINE([LOAD_XV])
slouken@119
   267
fi
slouken@137
   268
slouken@168
   269
if test x$enable_tif = xyes -a x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
slouken@143
   270
    if test x$enable_tif_shared = xyes && test x$tif_lib != x; then
slouken@143
   271
        echo "-- dynamic libtiff -> $tif_lib"
slouken@143
   272
        AC_DEFINE_UNQUOTED(LOAD_TIF_DYNAMIC, "$tif_lib")
slouken@143
   273
    else
slouken@143
   274
        if test x$have_libjpeg = xyes; then
slouken@143
   275
            # Disable dynamic jpeg since we're linking it explicitly
slouken@143
   276
            jpg_lib=''
slouken@143
   277
        fi
slouken@156
   278
        IMG_LIBS="-ltiff -lz $IMG_LIBS"
slouken@143
   279
    fi
slouken@143
   280
fi
slouken@168
   281
if test x$enable_jpg = xyes -a x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
slouken@143
   282
    if test x$enable_jpg_shared = xyes && test x$jpg_lib != x; then
slouken@143
   283
        echo "-- dynamic libjpeg -> $jpg_lib"
slouken@143
   284
        AC_DEFINE_UNQUOTED(LOAD_JPG_DYNAMIC, "$jpg_lib")
slouken@143
   285
    else
slouken@143
   286
        IMG_LIBS="-ljpeg $IMG_LIBS"
slouken@143
   287
    fi
slouken@143
   288
fi
slouken@168
   289
if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
slouken@143
   290
    if test x$enable_png_shared = xyes && test x$png_lib != x; then
slouken@143
   291
        echo "-- dynamic libpng -> $png_lib"
slouken@143
   292
        AC_DEFINE_UNQUOTED(LOAD_PNG_DYNAMIC, "$png_lib")
slouken@143
   293
    else
slouken@143
   294
        IMG_LIBS="-lpng -lz $IMG_LIBS"
slouken@143
   295
    fi
slouken@143
   296
fi
slouken@143
   297
slouken@137
   298
LIBS="$saved_LIBS"
slouken@137
   299
slouken@168
   300
AC_SUBST([WINDRES])
slouken@168
   301
AC_SUBST([IMG_LIBS])
slouken@0
   302
slouken@0
   303
# Finally create all the generated files
slouken@0
   304
AC_OUTPUT([
slouken@0
   305
Makefile
slouken@0
   306
SDL_image.spec
slouken@197
   307
SDL_image.pc
slouken@0
   308
])