1dnl $Id: configure.ac,v 1.185 2015/06/20 02:30:15 nkbj Exp $ 2AC_INIT([UFRaw],[0.23]) 3AC_PREREQ([2.69]) 4 5# Create host_os, host_cpu, host_alias variables. 6AC_CANONICAL_HOST 7 8AM_INIT_AUTOMAKE([foreign]) 9m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 10AC_CONFIG_HEADERS(config.h) 11AC_PROG_CC 12AC_PROG_CXX 13AC_PROG_CPP 14AC_PROG_INSTALL 15AC_PROG_RANLIB 16 17AC_CHECK_PROGS(POD2MAN, pod2man, 18 [ echo pod2man is missing on this system; \ 19 echo you can ignore this problem by typing: touch ufraw.1; \ 20 echo cannot execute: pod2man], $PATH) 21AC_FUNC_FSEEKO 22 23# Ensure that getopt_long is available. It is included in GNU libc and 24# in at least most BSD libcs. If not found, search for it in libgnugetopt. 25AC_SEARCH_LIBS(getopt_long, gnugetopt, , 26 AC_MSG_ERROR(can not build UFRaw without getopt_long)) 27 28# Make sure that pow is available, trying libm if necessary. 29AC_SEARCH_LIBS(pow, m) 30AC_CHECK_FUNCS(canonicalize_file_name) 31AC_CHECK_FUNCS(memmem) 32AC_CHECK_FUNCS(strcasecmp) 33AC_CHECK_FUNCS(strcasestr) 34 35# For binary package creation, adjusting for the build CPU is not appropriate. 36case $host_cpu in 37 i686) 38 UFRAW_MARCH="-march=i686" 39 ;; 40 * ) 41 UFRAW_MARCH="" 42 ;; 43esac 44 45# Default CFLAGS, CXXFLAGS for GCC in case they were not set by the user. 46if test "$GCC" = "yes"; then 47 if test -z $CFLAGS; then 48 CFLAGS="-W -Wall -g -O3 -fomit-frame-pointer -D_FORTIFY_SOURCE=2 $UFRAW_MARCH" 49 fi 50 if test -z $CXXFLAGS; then 51 CXXFLAGS="-W -Wall -g -O3 -fomit-frame-pointer -D_FORTIFY_SOURCE=2 $UFRAW_MARCH" 52 fi 53fi 54 55m4_ifndef([AC_OPENMP], [m4_include([ac_openmp.m4])]) 56AC_OPENMP 57CFLAGS="$CFLAGS $OPENMP_CFLAGS" 58CXXFLAGS="$CXXFLAGS $OPENMP_CFLAGS" 59 60# Point to programs/libraries installed in a non-default place. 61AC_ARG_WITH(prefix, 62 [ --with-prefix=PREFIX use also PREFIX as an input prefix for the build], 63 [ with_prefix=$withval 64 echo "Adding pkgconfig/cppflags/ldflags for $with_prefix." 65 export PKG_CONFIG_PATH="$with_prefix/lib/pkgconfig$PATH_SEPARATOR$PKG_CONFIG_PATH" 66 CPPFLAGS="$CPPFLAGS -I$with_prefix/include" 67 LDFLAGS="$LDFLAGS -L$with_prefix/lib" 68 ], 69 [ with_prefix=NONE ] ) 70 71PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.12 gthread-2.0) 72 73PKG_CHECK_MODULES(LCMS2, lcms2) 74 75AC_ARG_WITH([gtk], 76 [AS_HELP_STRING([--with-gtk], 77 [build the GTK GUI @<:@default=check@:>@])], 78 [], 79 [with_gtk=check]) 80 81have_gtk=no 82AS_IF([test "x$with_gtk" != xno], 83 [PKG_CHECK_MODULES(GTKBASE, gtk+-2.0 >= 2.12, 84 [ have_gtk=yes ], 85 [ have_gtk=no 86 if test "x$with_gtk" != xcheck; then 87 AC_MSG_FAILURE( 88 [--with-gtk was given, but test for gtk failed]) 89 fi 90 ] ) ] ) 91 92have_gimp=no 93if test "$have_gtk" = "yes"; then 94 PKG_CHECK_MODULES(GTK, gtkimageview >= 1.6) 95 96# It is not clear if we should install the GIMP plugin 97# in the corresponding place in our prefix, or in GIMP's 98# lib dir in its prefix. Currently, we install the 99# plugin in our prefix. If the GIMP prefix and the 100# configured UFRaw prefix are the same, this doesn't matter. 101 pkg_prefix="$PKG_CONFIG" 102 test $prefix = NONE || pkg_prefix="$pkg_prefix --define-variable=prefix=$prefix" 103 test $exec_prefix = NONE || pkg_prefix="$pkg_prefix --define-variable=exec_prefix=$exec_prefix" 104 105 AC_ARG_WITH([gimp], 106 [AS_HELP_STRING([--with-gimp], 107 [build gimp plugin @<:@default=check@:>@])], 108 [], 109 [with_gimp=check]) 110 111 AS_IF([test "x$with_gimp" != xno], 112 [PKG_CHECK_MODULES(GIMP, gimpui-2.0 >= 2.2.0, 113 [ have_gimp=yes 114 GIMP_LIBDIR=`$pkg_prefix --variable=gimplibdir gimp-2.0` ], 115 [ have_gimp=no 116 GIMP_LIBDIR= 117 if test "x$with_gimp" != xcheck; then 118 AC_MSG_FAILURE( 119 [--with-gimp was given, but test for gimp failed]) 120 fi 121 ] ) ] ) 122 if test "$have_gimp" = "yes"; then 123 PKG_CHECK_MODULES(GIMP_2_4, gimpui-2.0 >= 2.4.0, 124 [ AC_DEFINE_UNQUOTED(HAVE_GIMP_2_4, 1, have Gimp 2.4 or later) ], 125 [ AC_DEFINE_UNQUOTED(HAVE_GIMP_2_4, 0, have Gimp 2.4 or later) ]) 126 PKG_CHECK_MODULES(GIMP_2_9, gimpui-2.0 >= 2.9.0, 127 [ AC_DEFINE_UNQUOTED(HAVE_GIMP_2_9, 1, have Gimp 2.9 or later) ], 128 [ AC_DEFINE_UNQUOTED(HAVE_GIMP_2_9, 0, have Gimp 2.9 or later) ]) 129 fi 130 131 # Disable deprecated functions on tested versions of GTK. 132 if $PKG_CONFIG --max-version=2.18.99 gtk+-2.0; then 133 AC_DEFINE(G_DISABLE_DEPRECATED, [], disable deprecated glib features) 134 AC_DEFINE(GDK_DISABLE_DEPRECATED, [], disable deprecated gdk features) 135 AC_DEFINE(GTK_DISABLE_DEPRECATED, [], disable deprecated gtk+ features) 136 AC_DEFINE(GTK_DISABLE_SINGLE_INCLUDES, [], disable deprecated gtk headers) 137 AC_DEFINE(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES, [], disable deprecated gdk headers) 138 fi 139fi 140AM_CONDITIONAL(MAKE_GTK, test $have_gtk = yes) 141AC_SUBST(GTK_LIBS) 142 143AM_CONDITIONAL(MAKE_GIMP, test $have_gimp = yes) 144AC_SUBST(GIMP_CFLAGS) 145AC_SUBST(GIMP_LIBS) 146AC_SUBST(GIMP_LIBDIR) 147 148# Check for zlib. 149AC_CHECK_LIB(z, deflate) 150have_zlib=${ac_cv_lib_z_deflate:-no} 151 152# Check for libbz2. 153AC_CHECK_LIB(bz2, BZ2_bzReadOpen) 154have_libbz2=${ac_cv_lib_bz2_BZ2_bzReadOpen:-no} 155 156# Check for jpeg headers and library. 157AC_CHECK_HEADER(jpeglib.h, 158 AC_CHECK_LIB(jpeg, jpeg_CreateCompress)) 159have_jpeg=${ac_cv_lib_jpeg_jpeg_CreateCompress:-no} 160 161# Check for libjasper. 162AC_ARG_ENABLE([jasper], 163 AS_HELP_STRING([--enable-jasper], [enable JPEG2000 support])) 164 165have_jasper=no 166AS_IF([test "x$enable_jasper" = "xyes"], [ 167 AC_SEARCH_LIBS([jas_image_decode], [jasper], [have_jasper=yes], [ 168 AC_MSG_ERROR([unable to find the jas_image_decode() function]) 169 ]) 170]) 171 172 173# Check for tiff headers and library. 174PKG_CHECK_MODULES(LIBTIFF, libtiff-4, 175 [ have_tiff=yes 176 AC_DEFINE(HAVE_LIBTIFF, 1, have the tiff library) ], 177 [ have_tiff=no 178 AC_MSG_RESULT($LIBTIFF_PKG_ERRORS) ] ) 179if test $have_tiff = no; then 180 AC_CHECK_HEADER(tiffio.h, 181 AC_CHECK_LIB(tiff, TIFFSetErrorHandler)) 182 have_tiff=${ac_cv_lib_tiff_TIFFSetErrorHandler:-no} 183fi 184 185PKG_CHECK_MODULES(LIBPNG, libpng >= 1.2, 186 [ have_png=yes 187 AC_DEFINE(HAVE_LIBPNG, 1, have the png library) ], 188 [ have_png=no 189 AC_MSG_RESULT($LIBPNG_PKG_ERRORS) ] ) 190 191AC_ARG_WITH([cfitsio], 192 [AS_HELP_STRING([--with-cfitsio], 193 [build fits support @<:@default=check@:>@])], 194 [], 195 [with_cfitsio=check]) 196 197have_cfitsio=no 198AS_IF([test "x$with_cfitsio" != xno], 199 [PKG_CHECK_MODULES(CFITSIO, cfitsio, 200 [ have_cfitsio=yes 201 AC_DEFINE(HAVE_LIBCFITSIO, 1, have the cfitsio library) ], 202 [ have_cfitsio=no 203 AC_MSG_RESULT($CFITSIO_PKG_ERRORS) ] ) ] ) 204 205PKG_CHECK_MODULES(EXIV2, exiv2 >= 0.20, 206 [ have_exiv2=yes 207 AC_DEFINE(HAVE_EXIV2, 1, have the exiv2 library) ], 208 [ have_exiv2=no 209 AC_MSG_RESULT($EXIV2_PKG_ERRORS) ] ) 210 211PKG_CHECK_MODULES(LENSFUN, lensfun >= 0.2.5, 212 [ have_lensfun=yes 213 AC_DEFINE(HAVE_LENSFUN, 1, have the lensfun library) ], 214 [ have_lensfun=no 215 AC_MSG_RESULT($LENSFUN_PKG_ERRORS) ] ) 216 217# Make sure MSGFMT_OPTS is defined for all combinations of autoconf and glib. 218MSGFMT_OPTS= 219ALL_LINGUAS="ca cs da de es fr it ja ko nb nl pl pt ru sr sr@latin sv zh_CN zh_TW" 220AM_GNU_GETTEXT_VERSION([0.21]) 221AM_GNU_GETTEXT([external]) 222LIBS="$LIBS $INTLLIBS" 223# The following might not work with some combinations of autoconf and glib due 224# to a missing update of the glib-gettext.m4 file. 225#AM_GLIB_DEFINE_LOCALEDIR(UFRAW_LOCALEDIR) 226GETTEXT_PACKAGE=ufraw 227AC_SUBST(GETTEXT_PACKAGE) 228AC_SUBST(MSGFMT_OPTS) 229 230# UFRAW_CPPFLAGS is added to the preprocessor flags AM_CPPFLAGS, 231# affecting also the C and C++ compilers. 232UFRAW_CPPFLAGS="$UFRAW_CPPFLAGS $EXIV2_CFLAGS $GTK_CFLAGS $GLIB_CFLAGS $LCMS2_CFLAGS $LENSFUN_CFLAGS $LIBTIFF_CFLAGS $LIBPNG_CFLAGS $CFITSIO_CFLAGS" 233AC_SUBST(UFRAW_CPPFLAGS) 234 235# UFRAW_LDADD is added to the linker flags LDADD. 236UFRAW_LDADD="$UFRAW_LDADD $EXIV2_LIBS $GLIB_LIBS $LCMS2_LIBS $LENSFUN_LIBS $LIBTIFF_LIBS $LIBPNG_LIBS $CFITSIO_LIBS $CARBON_LIBS" 237AC_SUBST(UFRAW_LDADD) 238 239# Windows and Darwin (Mac OS X) will require some special attention. 240case $host_os in 241 *mingw* ) 242 ufraw_win32=yes 243 ufraw_darwin=no 244 ;; 245 *darwin* ) 246 ufraw_win32=no 247 ufraw_darwin=yes 248 ;; 249 * ) 250 ufraw_win32=no 251 ufraw_darwin=no 252 ;; 253esac 254AM_CONDITIONAL(UFRAW_WIN32, test x$ufraw_win32 = xyes) 255 256if test $ufraw_win32 = yes; then 257 CFLAGS="$CFLAGS -mwindows -mms-bitfields" 258 CXXFLAGS="$CXXFLAGS -mwindows -mms-bitfields" 259 CONSOLE="-mconsole" 260 AC_MSG_CHECKING(whether to add the -mno-cygwin flag to CFLAGS and CXXFLAGS) 261 AC_ARG_ENABLE(no_cygwin, 262 [ --enable-no-cygwin add the -mno-cygwin flag to CFLAGS and CXXFLAGS 263 (only in Windows) ], 264 , enable_no_cygwin=no) 265 AC_MSG_RESULT($enable_no_cygwin) 266 if test $enable_no_cygwin = yes; then 267 CFLAGS="$CFLAGS -mno-cygwin" 268 CXXFLAGS="$CXXFLAGS -mno-cygwin" 269 fi 270else 271 CONSOLE= 272fi 273AC_SUBST(CONSOLE) 274 275# Check for the Apple Carbon framework (needed for GDK_WINDOWING_QUARTZ). 276CARBON_LIBS= 277if test $ufraw_darwin = yes; then 278 carbon_ok=no 279 AC_MSG_CHECKING([for Mac OS X Carbon support]) 280 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ 281 #include <Carbon/Carbon.h> 282 #include <ApplicationServices/ApplicationServices.h> 283 #include <CoreServices/CoreServices.h> 284 ]])],[carbon_ok=yes],[]) 285 AC_MSG_RESULT($carbon_ok) 286 if test "x$carbon_ok" = "xyes"; then 287 CARBON_LIBS="-framework Carbon -framework Cocoa" 288 fi 289fi 290AC_SUBST(CARBON_LIBS) 291 292AC_ARG_WITH(dosprefix, 293 [ --with-dosprefix=PREFIX PREFIX is the prefix in dos format 294 (needed only in Windows) ], 295 [ with_dosprefix=$withval], 296 [ with_dosprefix=NONE ] ) 297 298# The ws2_32 library is required for the ntohs symbol on win32. 299if test $ufraw_win32 = yes; then 300 LIBS="$LIBS -lws2_32" 301fi 302 303if test $ufraw_win32 = yes; then 304 AC_CHECK_PROGS(WINDRES, $host_alias-windres $target_alias-windres windres, , $PATH) 305 AC_SUBST(WINDRES) 306 # For the Windows-installer make needs the location of the DLLs 307 PREFIX=$with_prefix 308 AC_SUBST(PREFIX) 309 # and ISCC (ufraw-setup.iss.in) needs them in DOS format... 310 DOSPREFIX=$with_dosprefix 311 AC_SUBST(DOSPREFIX) 312 ISCC="\"\$(PROGRAMFILES)\"/Inno\ Setup\ 5/ISCC.exe" 313 AC_SUBST(ISCC) 314 case $build_os in 315 *cygwin* | *mingw* ) 316 WINE="" 317 COMMENT_ICON="" 318 ;; 319 * ) 320 # Only needed if you plan to cross-build Windows-installer from Linux. 321 test -z "$PROGRAMFILES" && PROGRAMFILES="C:\\Program Files" 322 AC_SUBST(PROGRAMFILES) 323 WINE="wine" 324 COMMENT_ICON=";" 325 esac 326 AC_SUBST(WINE) 327 AC_SUBST(COMMENT_ICON) 328fi 329 330AC_MSG_CHECKING(whether to install mime types) 331AC_ARG_ENABLE(mime, 332 [ --enable-mime install mime files, see README for more information], 333 , enable_mime=no) 334AC_MSG_RESULT($enable_mime) 335AM_CONDITIONAL(INSTALL_MIME, test $enable_mime = yes) 336 337AC_MSG_CHECKING(whether to build extras) 338AC_ARG_ENABLE(extras, 339 [ --enable-extras build extra (dcraw, nikon-curve) executables], , 340 enable_extras=no) 341AC_MSG_RESULT($enable_extras) 342AM_CONDITIONAL(MAKE_EXTRAS, test $enable_extras = yes) 343 344AC_MSG_CHECKING(whether to enable DST correction for file timestamps) 345AC_ARG_ENABLE(dst_correction, 346 [ --enable-dst-correction enable DST correction for file timestamps], 347 AC_DEFINE(LOCALTIME, 1, DST correction enabled), 348 enable_dst_correction=no) 349AC_MSG_RESULT($enable_dst_correction) 350 351AC_MSG_CHECKING(whether to enable the contrast setting option) 352AC_ARG_ENABLE(contrast, 353 [ --enable-contrast enable the contrast setting option], 354 AC_DEFINE(UFRAW_CONTRAST, 1, Contrast setting option enabled), 355 enable_contrast=no) 356AC_MSG_RESULT($enable_contrast) 357 358AC_MSG_CHECKING(whether to enable 'None' interpolation) 359AC_ARG_ENABLE(interp_none, 360 [ --enable-interp-none enable 'None' interpolation (mostly for debugging)], 361 AC_DEFINE(ENABLE_INTERP_NONE, 1, 'None' interpolation enabled), 362 enable_interp_none=no) 363AC_MSG_RESULT($enable_interp_none) 364 365AC_MSG_CHECKING(whether to enable debugging with valgrind) 366AC_ARG_ENABLE(valgrind, 367 [ --enable-valgrind enable debugging with valgrind], 368 AC_DEFINE(UFRAW_VALGRIND, 1, Debugging with valgrind enabled), 369 enable_valgrind=no) 370AC_MSG_RESULT($enable_valgrind) 371 372AC_CONFIG_FILES(Makefile) 373AC_CONFIG_FILES(icons/Makefile) 374AC_CONFIG_FILES(po/Makefile.in) 375AC_CONFIG_FILES(ufraw-setup.iss) 376AC_OUTPUT 377 378AC_MSG_NOTICE(====================== summary =====================) 379AC_MSG_NOTICE(build GTK GUI: $have_gtk) 380AC_MSG_NOTICE(build GIMP plug-in: $have_gimp) 381AC_MSG_NOTICE(EXIF support using exiv2: $have_exiv2) 382AC_MSG_NOTICE(JPEG support: $have_jpeg) 383AC_MSG_NOTICE(JPEG2000 (libjasper) support: $have_jasper) 384AC_MSG_NOTICE(TIFF support: $have_tiff) 385AC_MSG_NOTICE(PNG support: $have_png) 386AC_MSG_NOTICE(FITS support: $have_cfitsio) 387AC_MSG_NOTICE(gzip compressed raw support: $have_zlib) 388AC_MSG_NOTICE(bzip2 compressed raw support: $have_libbz2) 389AC_MSG_NOTICE(lens defects correction support using lensfun: $have_lensfun) 390