https://svn.lrde.epita.fr/svn/oln/trunk
The updates to Milena follow.
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Improve support for the FreeImagePlus library.
* build-aux/freeimageplus.m4: New.
Provide the Autoconf macro OLN_WITH_FREEIMAGEPLUS.
Inspired by Olena 0.11's macros AC_WITH_CXX_ZLIB and
AC_WITH_CXX_FFTW.
Use this macro...
* configure.ac: ...here, instead of the previous ad hoc solution.
Rename the Automake conditional FREE_IMAGE_PLUS as FREEIMAGEPLUS,
and adjust it.
* Makefile.am (ACLOCAL_AMFLAGS): New.
Set it to `-I build-aux' to have aclocal visit
build-aux/freeimageplus.m4.
Makefile.am | 2 +
build-aux/freeimageplus.m4 | 48 +++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 5 +---
3 files changed, 52 insertions(+), 3 deletions(-)
Index: build-aux/freeimageplus.m4
--- build-aux/freeimageplus.m4 (revision 0)
+++ build-aux/freeimageplus.m4 (revision 0)
@@ -0,0 +1,48 @@
+# -*- Autoconf -*-
+
+# OLN_WITH_FREEIMAGEPLUS
+# ----------------------
+# Checks whether the FreeImagePlus library is available from C++
+# programs.
+#
+# This macro sets FREEIMAGEPLUS_CXXFLAGS and FREEIMAGEPLUS_LDFLAGS if
+# the library is found and its functions available from C++.
+AC_DEFUN([OLN_WITH_FREEIMAGEPLUS],
+[dnl
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_LANG_PUSH([C++])
+
+ AC_ARG_WITH([freeimageplus],
+ [AC_HELP_STRING([--with-freeimageplus@<:@=DIR@:>@],
+ [using FreeImage (DIR = prefix for FreeImage installation)])])
+ FREEIMAGEPLUS_CXXFLAGS=''
+ FREEIMAGEPLUS_LDFLAGS=''
+ if test "x$with_freeimageplus" != xno; then
+ if test -n "$with_freeimageplus"; then
+ FREEIMAGEPLUS_CXXFLAGS="-I${with_freeimageplus}/include"
+ FREEIMAGEPLUS_LDFLAGS="-L${with_freeimageplus}/lib"
+ fi
+ oln_save_CXXFLAGS=$CXXFLAGS
+ oln_save_LDFLAGS=$LDFLAGS
+ CXXFLAGS="$CXXFLAGS $FREEIMAGEPLUS_CXXFLAGS"
+ LDFLAGS="$LDFLAGS $FREEIMAGEPLUS_LDFLAGS"
+ oln_have_freeimageplus=no
+ AC_CHECK_HEADER([FreeImagePlus.h],
+ [AC_CHECK_LIB([freeimageplus],
+ [main],
+ [oln_have_freeimageplus=yes
+ FREEIMAGEPLUS_LDFLAGS="$FREEIMAGEPLUS_LDFLAGS -lfreeimageplus"
+ AC_DEFINE([HAVE_FREEIMAGEPLUS], 1,
+ [Define to 1 if we can use FreeImage])
+ ]
+ )]
+ )
+ CXXFLAGS=$oln_save_CXXFLAGS
+ LDFLAGS=$oln_save_LDFLAGS
+ TOOLS_LDFLAGS="$TOOLS_LDFLAGS $FREEIMAGEPLUS_LDFLAGS"
+ fi
+ AC_SUBST([FREEIMAGEPLUS_CXXFLAGS])
+ AC_SUBST([FREEIMAGEPLUS_LDFLAGS])
+
+ AC_LANG_POP([C++])
+])
Index: configure.ac
--- configure.ac (revision 1408)
+++ configure.ac (working copy)
@@ -59,9 +59,8 @@
## -------------- ##
# FreeImage library.
-AC_CHECK_HEADERS([FreeImagePlus.h],
- [AM_CONDITIONAL([FREE_IMAGE_PLUS], [true])])
-AC_CHECK_LIB([freeimageplus], [main])
+OLN_WITH_FREEIMAGEPLUS
+AM_CONDITIONAL([FREEIMAGEPLUS], [test x$oln_have_freeimageplus = xyes])
## ------- ##
Index: Makefile.am
--- Makefile.am (revision 1408)
+++ Makefile.am (working copy)
@@ -1,3 +1,5 @@
## Process this file through Automake to produce Makefile.in -*- Makefile -*-
+ACLOCAL_AMFLAGS = -I build-aux
+
SUBDIRS = build-aux metalic extended static milena olena dynamic