configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 01 May 2006 09:09:45 +0000
changeset 137 b42b657ab1ac
parent 122 581f4fe08f8d
child 143 e01fee7bdf3b
permissions -rw-r--r--
Date: Wed, 26 Apr 2006 17:02:52 +0200
From: Julien Lecomte
Subject: Re: [SDL] SDL_image & libtiff

On 26/04/2006 13:43, I wrote:
> When configuring SDL_image with libtiff, libtiff wasn't found in my ca
se.
> I solved the problem by adding: 'LIBS="$LIBS $IMG_LIBS"' after line 16
3
> of configure.in ('if test x$enable_tif = xyes; then').
> I guess the problem is that my libtiff is a static lib, I didn't bothe
r
> to create the shared one, and that libtiff depends on libjpeg and libz
.
>
> I also guess that other static libraries (like possibly libpng) might
> share (sic) this problem.
>
> If I have a time, I'll review the configure.in and post a patch (don't

> use my solution above, it's ugly !)
>

Attached is a patch that modifies configure.in and makefile.am for
SDL_image.
*Changes are:*

- Checks for dependency libs before checking for other libraries (z is
checked before png, z and jpeg are checked before tiff) which was the
fix I was targetting (at the start)
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@137
    92
AC_ARG_ENABLE([lbm], [AC_HELP_STRING([--enable-lbm], [support loading LBM images [default=yes]])],
slouken@137
    93
 [], [enable_lbm=yes])
slouken@137
    94
AC_ARG_ENABLE([pcx], [AC_HELP_STRING([--enable-pcx], [support loading PCX images [default=yes]])],
slouken@137
    95
 [], [enable_pcx=yes])
slouken@137
    96
AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-bmp], [support loading PNG images [default=yes]])],
slouken@137
    97
 [], [enable_png=yes])
slouken@137
    98
AC_ARG_ENABLE([pnm], [AC_HELP_STRING([--enable-pnm], [support loading PNM images [default=yes]])],
slouken@137
    99
 [], [enable_pnm=yes])
slouken@137
   100
AC_ARG_ENABLE([tga], [AC_HELP_STRING([--enable-tga], [support loading TGA images [default=yes]])],
slouken@137
   101
 [], [enable_tga=yes])
slouken@137
   102
AC_ARG_ENABLE([tif], [AC_HELP_STRING([--enable-tif], [support loading TIFF images [default=no]])],
slouken@137
   103
 [], [enable_tif=no])
slouken@137
   104
AC_ARG_ENABLE([xcf], [AC_HELP_STRING([--enable-xcf], [support loading XCF images [default=yes]])],
slouken@137
   105
 [], [enable_xcf=yes])
slouken@137
   106
AC_ARG_ENABLE([xpm], [AC_HELP_STRING([--enable-xpm], [support loading XPM images [default=yes]])],
slouken@137
   107
 [], [enable_xpm=yes])
slouken@137
   108
AC_ARG_ENABLE([xv], [AC_HELP_STRING([--enable-xv], [support loading XV images [default=yes]])],
slouken@137
   109
 [], [enable_xv=yes])
slouken@137
   110
slouken@137
   111
if test x$enable_png = xyes || x$enable_tif = xyes; then
slouken@137
   112
    AC_CHECK_LIB([z], [uncompress], [
slouken@137
   113
        LIBS="-lz $LIBS"
slouken@137
   114
        IMG_LIBS="-lz $IMG_LIBS"
slouken@137
   115
    ])
slouken@0
   116
fi
slouken@137
   117
slouken@137
   118
if test x$enable_jpg = xyes || x$enable_tif = xyes; then
slouken@137
   119
    AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], [have_libjpeg=yes])
slouken@0
   120
    if test x$have_libjpeg = xyes; then
slouken@137
   121
        if test x$enable_jpg = xyes; then
slouken@137
   122
            AC_DEFINE(LOAD_JPG)
slouken@137
   123
        fi
slouken@137
   124
        LIBS="-ljpeg $LIBS"
slouken@137
   125
        IMG_LIBS="-ljpeg $IMG_LIBS"
slouken@137
   126
    elif test x$enable_jpg = xyes; then
slouken@137
   127
        AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
slouken@0
   128
        AC_MSG_WARN([JPG image loading disabled])
slouken@0
   129
    fi
slouken@0
   130
fi
slouken@137
   131
slouken@0
   132
if test x$enable_png = xyes; then
slouken@137
   133
    AC_CHECK_LIB([png], [png_create_read_struct], [have_libpng=yes])
slouken@137
   134
    if test x$have_libpng = xyes; then
slouken@137
   135
        AC_DEFINE([LOAD_PNG])
slouken@137
   136
        IMG_LIBS="-lpng $IMG_LIBS"
slouken@0
   137
    else
slouken@137
   138
        AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
slouken@0
   139
        AC_MSG_WARN([PNG image loading disabled])
slouken@0
   140
    fi
slouken@0
   141
fi
slouken@137
   142
slouken@0
   143
if test x$enable_tif = xyes; then
slouken@137
   144
    AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_libtiff=yes])
slouken@0
   145
    if test x$have_libtiff = xyes; then
slouken@137
   146
        AC_DEFINE([LOAD_TIF])
slouken@137
   147
        IMG_LIBS="-ltiff $IMG_LIBS"
slouken@0
   148
    else
slouken@137
   149
        AC_MSG_WARN([*** Unable to find Tiff library (ftp://ftp.sgi.com/graphics/tiff/)])
slouken@0
   150
        AC_MSG_WARN([TIF image loading disabled])
slouken@0
   151
    fi
slouken@0
   152
fi
slouken@137
   153
slouken@137
   154
if test x$enable_bmp = xyes; then
slouken@137
   155
    AC_DEFINE([LOAD_BMP])
slouken@137
   156
fi
slouken@137
   157
slouken@137
   158
if test x$enable_gif = xyes; then
slouken@137
   159
    AC_DEFINE([LOAD_GIF])
slouken@137
   160
fi
slouken@137
   161
slouken@137
   162
if test x$enable_lbm = xyes; then
slouken@137
   163
    AC_DEFINE([LOAD_LBM])
slouken@137
   164
fi
slouken@137
   165
slouken@137
   166
if test x$enable_pcx = xyes; then
slouken@137
   167
    AC_DEFINE([LOAD_PCX])
slouken@137
   168
fi
slouken@137
   169
slouken@137
   170
if test x$enable_pnm = xyes; then
slouken@137
   171
    AC_DEFINE([LOAD_PNM])
slouken@137
   172
fi
slouken@137
   173
slouken@137
   174
if test x$enable_tga = xyes; then
slouken@137
   175
    AC_DEFINE([LOAD_TGA])
slouken@137
   176
fi
slouken@137
   177
slouken@26
   178
if test x$enable_xcf = xyes; then
slouken@137
   179
    AC_DEFINE([LOAD_XCF])
slouken@26
   180
fi
slouken@137
   181
slouken@7
   182
if test x$enable_xpm = xyes; then
slouken@137
   183
    AC_DEFINE([LOAD_XPM])
slouken@7
   184
fi
slouken@137
   185
slouken@119
   186
if test x$enable_xv = xyes; then
slouken@137
   187
    AC_DEFINE([LOAD_XV])
slouken@119
   188
fi
slouken@137
   189
slouken@137
   190
LIBS="$saved_LIBS"
slouken@137
   191
slouken@137
   192
AC_SUBST([IMG_LIBS])
slouken@0
   193
slouken@0
   194
# Finally create all the generated files
slouken@0
   195
AC_OUTPUT([
slouken@0
   196
Makefile
slouken@0
   197
SDL_image.spec
slouken@93
   198
SDL_image.qpg
slouken@0
   199
])