configure.ac 23.4 KB
Newer Older
Øyvind Kolås's avatar
Øyvind Kolås committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.54)

dnl Making releases on the stable branch:
dnl   GEGL_MICRO_VERSION += 1;
dnl   GEGL_INTERFACE_AGE += 1;
dnl   GEGL_BINARY_AGE += 1;
dnl if any functions have been added,
dnl    set GEGL_INTERFACE_AGE to 0.
dnl if backwards compatibility has been broken,
dnl    set GEGL_BINARY_AGE _and_ GEGL_INTERFACE_AGE to 0.


m4_define([gegl_major_version], [0])
m4_define([gegl_minor_version], [0])
17
m4_define([gegl_micro_version], [21])
Øyvind Kolås's avatar
Øyvind Kolås committed
18 19 20 21 22 23 24 25 26
m4_define([gegl_real_version],
          [gegl_major_version.gegl_minor_version.gegl_micro_version])
m4_define([gegl_version], [gegl_real_version])

dnl Number of releases since we've added interfaces
m4_define([gegl_interface_age], [0])
m4_define([gegl_binary_age],
          [m4_eval(100 * gegl_minor_version + gegl_micro_version)])

27 28
dnl The X.Y in -lgegl-X.Y line. This is expected to stay 0.0 until Gegl 1.
m4_define([gegl_api_version], [gegl_major_version.gegl_minor_version])
Øyvind Kolås's avatar
Øyvind Kolås committed
29 30 31 32 33 34 35 36 37 38 39 40

m4_define([stability_version_number],
          m4_if(m4_eval(gegl_major_version || gegl_minor_version), [0], 
                        [gegl_micro_version], [gegl_minor_version]))
m4_define([gegl_unstable],
          m4_if(m4_eval(stability_version_number % 2), [1], [yes], [no]))
m4_define([gegl_stable],
          m4_if(m4_eval(stability_version_number % 2), [0], [yes], [no]))

m4_define([gimp_full_name], [Generic Graphical Library])

# required versions of external libraries
41
m4_define([babl_required_version], [0.0.22])
42
m4_define([glib_required_version], [2.14.0])
Øyvind Kolås's avatar
Øyvind Kolås committed
43
m4_define([gtk_required_version], [2.8.6])
Kevin Cozens's avatar
Kevin Cozens committed
44
m4_define([lua_required_version], [5.1.0])
Øyvind Kolås's avatar
Øyvind Kolås committed
45 46 47 48 49 50 51
m4_define([cairo_required_version], [0.0.0])
m4_define([pango_required_version], [0.0.0])
m4_define([pangocairo_required_version], [0.0.0])
m4_define([png_required_version], [0.0.0])
m4_define([librsvg_required_version], [2.14.0])
m4_define([openexr_required_version], [0.0.0])
m4_define([sdl_required_version], [0.0.0])
52
m4_define([openraw_required_version], [0.0.5])
Øyvind Kolås's avatar
Øyvind Kolås committed
53 54 55
m4_define([graphviz_required_version], [0.0.0])

AC_INIT(gegl, gegl_major_version.gegl_minor_version.gegl_micro_version)
56
AC_CONFIG_SRCDIR([gegl/gegl.h.in])
Øyvind Kolås's avatar
Øyvind Kolås committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83

dnl ==========================================================================
dnl                              Versioning              
dnl ==========================================================================

dnl The triplet 
GEGL_MAJOR_VERSION=gegl_major_version
GEGL_MINOR_VERSION=gegl_minor_version
GEGL_MICRO_VERSION=gegl_micro_version
GEGL_INTERFACE_AGE=gegl_interface_age
GEGL_BINARY_AGE=gegl_binary_age
GEGL_VERSION=gegl_version
GEGL_REAL_VERSION=gegl_real_version
GEGL_VERSION=gegl_version
GEGL_API_VERSION=gegl_api_version
AC_SUBST(GEGL_MAJOR_VERSION)
AC_SUBST(GEGL_MINOR_VERSION)
AC_SUBST(GEGL_MICRO_VERSION)
AC_SUBST(GEGL_INTERFACE_AGE)
AC_SUBST(GEGL_BINARY_AGE)
AC_SUBST(GEGL_VERSION)
AC_SUBST(GEGL_REAL_VERSION)
AC_SUBST(GEGL_API_VERSION)

GEGL_RELEASE=gegl_api_version
AC_SUBST(GEGL_RELEASE)

84 85 86

AC_DEFINE_UNQUOTED(GEGL_LIBRARY, "$PACKAGE_NAME-$GEGL_API_VERSION",
                   [The name of the GEGL library])
87

Øyvind Kolås's avatar
Øyvind Kolås committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116

dnl The symbol GEGL_UNSTABLE is defined above for substitution in
dnl Makefiles and conditionally defined here as a preprocessor symbol
dnl and automake conditional.
GEGL_UNSTABLE=gegl_unstable
if test "x$GEGL_UNSTABLE" = "xyes"; then
  AC_DEFINE(GEGL_UNSTABLE, 1,
            [Define to 1 if this is an unstable version of GEGL])
fi
AM_CONDITIONAL(GEGL_UNSTABLE, test "x$GEGL_UNSTABLE" = "xyes")


dnl libtool versioning
m4_define([lt_current], [m4_eval(100 * gegl_minor_version + gegl_micro_version - gegl_interface_age)])
m4_define([lt_revision], [gegl_interface_age])
m4_define([lt_age], [m4_eval(gegl_binary_age - gegl_interface_age)])
GEGL_LIBRARY_VERSION="lt_current:lt_revision:lt_age"
GEGL_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
AC_SUBST(GEGL_LIBRARY_VERSION)
AC_SUBST(GEGL_CURRENT_MINUS_AGE)

gegltargetlib=libgegl-$GEGL_API_VERSION.la
AC_SUBST(gegltargetlib)

GLIB_REQUIRED_VERSION=glib_required_version
GTK_REQUIRED_VERSION=gtk_required_version
AC_SUBST(GLIB_REQUIRED_VERSION)
AC_SUBST(GTK_REQUIRED_VERSION)

Kevin Cozens's avatar
Kevin Cozens committed
117 118 119
LUA_REQUIRED_VERSION=lua_required_version
AC_SUBST(LUA_REQUIRED_VERSION)

Øyvind Kolås's avatar
Øyvind Kolås committed
120 121 122 123 124 125 126 127 128 129
PACKAGE_NAME=gegl
AC_SUBST(PACKAGE_NAME)


dnl ==========================================================================

AM_INIT_AUTOMAKE(no-define)
AM_CONFIG_HEADER(config.h)

dnl Initialize libtool
130
AC_LIBTOOL_DLOPEN
Øyvind Kolås's avatar
Øyvind Kolås committed
131
AC_PROG_CC
132
AC_PROG_CXX
133
AM_DISABLE_STATIC
Øyvind Kolås's avatar
Øyvind Kolås committed
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

dnl Initialize maintainer mode
AM_MAINTAINER_MODE


###############
# Generic stuff
###############

dnl Checks for programs.
AC_ISC_POSIX
#AM_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

dnl Large file support.
AC_SYS_LARGEFILE


AC_MSG_CHECKING([whether to turn on debugging])
AC_ARG_ENABLE(debug,
157
              [  --enable-debug          turn on  debugging (default=no)],
Øyvind Kolås's avatar
Øyvind Kolås committed
158
              if eval "test x$enable_debug = xyes"; then
159
                DEBUGFLAG="-g -DGEGL_ENABLE_DEBUG"
Øyvind Kolås's avatar
Øyvind Kolås committed
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
              fi)

if test -n "$DEBUGFLAG"; then
  AC_MSG_RESULT([yes])
  CFLAGS="$DEBUGFLAG $CFLAGS"
else
  AC_MSG_RESULT([no])
fi

AC_MSG_CHECKING([whether to turn on profiling])
AC_ARG_ENABLE(profile,
              [  --enable-profile        turn on profiling (default=no)],
              if eval "test x$enable_profile = xyes"; then
                PROFFLAG="-pg"
              fi)

if test -n "$PROFFLAG"; then
  AC_MSG_RESULT([yes])
  CFLAGS="$PROFFLAG $CFLAGS"
else
  AC_MSG_RESULT([no])
fi

changequote(,)dnl
if eval "test x$GCC = xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
GEGL_DETECT_CFLAGS(extra_warnings, '-Wdeclaration-after-statement')
CFLAGS="$CFLAGS $extra_warnings"

GEGL_DETECT_CFLAGS(extra_warnings, '-Wmissing-prototypes')
CFLAGS="$CFLAGS $extra_warnings"

GEGL_DETECT_CFLAGS(extra_warnings, '-Wmissing-declarations')
CFLAGS="$CFLAGS $extra_warnings"

GEGL_DETECT_CFLAGS(extra_warnings, '-Winit-self')
CFLAGS="$CFLAGS $extra_warnings"

GEGL_DETECT_CFLAGS(extra_warnings, '-Wpointer-arith')
CFLAGS="$CFLAGS $extra_warnings"

GEGL_DETECT_CFLAGS(extra_warnings, '-Wold-style-definition')
CFLAGS="$CFLAGS $extra_warnings"


211 212
dnl disable docs generation.
AC_ARG_ENABLE([docs],
213 214 215 216
              [  --disable-docs          disable docs generation (default=no)],,
              enable_docs="yes")

AM_CONDITIONAL(ENABLE_DOCS, test "x$enable_docs" == "xyes")
217

Øyvind Kolås's avatar
Øyvind Kolås committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238

dnl Cache $ACLOCAL_FLAGS
AC_CACHE_CHECK([for aclocal flags], ac_cv_gegl_aclocal_flags,[
   ac_cv_gegl_aclocal_flags="$ACLOCAL_FLAGS"
])
ACLOCAL="$ACLOCAL $ac_cv_gegl_aclocal_flags"


###########################
# Check target architecture
###########################

AC_MSG_CHECKING([for target architecture])
case x"$target" in
  xNONE | x)
    target_or_host="$host" ;;
  *)
    target_or_host="$target" ;;
esac
AC_MSG_RESULT([$target_or_host])

Øyvind Kolås's avatar
Øyvind Kolås committed
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
case "$target_or_host" in
  i*86-*-*)
    have_x86=yes
    AC_DEFINE(ARCH_X86, 1, [Define to 1 if you are compiling for ix86.])
    ;;
  x86_64-*-*)
    have_x86=yes
    AC_DEFINE(ARCH_X86, 1, [Define to 1 if you are compiling for ix86.])
    AC_DEFINE(ARCH_X86_64, 1, [Define to 1 if you are compiling for amd64.])
    ;;
  ppc-*-* | powerpc-*)
    have_ppc=yes
    AC_DEFINE(ARCH_PPC, 1, [Define to 1 if you are compiling for PowerPC.])
    ;;
  ppc64-*-* | powerpc64-*)
    have_ppc=yes
    AC_DEFINE(ARCH_PPC, 1, [Define to 1 if you are compiling for PowerPC.])
    AC_DEFINE(ARCH_PPC64, 1, [Define to 1 if you are compiling for PowerPC64.])
    ;;
  *)
    ;;
esac

262 263 264 265 266 267


####################################################
# Check how to generate plug-ins (with gcc at least)
####################################################

268
AC_MSG_CHECKING([for how to make dynamic libraries])
269 270
case "$target_or_host" in 
  *-*-darwin*)                 # darwin
271
    shrext=.dylib
272 273 274 275 276 277 278 279 280 281 282 283
    dynamiclib=-dynamiclib
    ;;
  *-*-mingw* | *-*-cygwin*)    # windows
    shrext=.dll
    dynamiclib=-shared
    ;;
  *)                           # linux (and BSD?)
    dynamiclib=-shared
    shrext=.so
    ;;
esac

284 285
AC_MSG_RESULT([flag=${dynamiclib}, extension=${shrext}])

286 287 288 289 290 291 292 293 294 295
SHREXT=$shrext
AC_SUBST(SHREXT)
AC_DEFINE_UNQUOTED(SHREXT,     "$shrext",     [File extension for shared libraries])

DYNAMICLIB=$dynamiclib
AC_SUBST(DYNAMICLIB)
AC_DEFINE_UNQUOTED(DYNAMICLIB, "$dynamiclib", [Dynamic shared library])

dnl ===========================================================================

296 297 298 299 300 301 302 303 304 305 306 307 308 309
#######################
# Check for Darwin/OSX
#######################
AC_MSG_CHECKING([for some Darwin platform])
case "${host}" in
  *-apple-darwin*)
    platform_darwin=yes
    ;;
  *)
    platform_darwin=no
    ;;
esac
AC_MSG_RESULT([$platform_darwin])
AM_CONDITIONAL(PLATFORM_DARWIN, test "$platform_darwin" = "yes")
310

Øyvind Kolås's avatar
Øyvind Kolås committed
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
#################
# Check for Win32
#################

AC_MSG_CHECKING([for some Win32 platform])
case "$target_or_host" in 
  *-*-mingw* | *-*-cygwin*)
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")

MATH_LIB=-lm
AC_MSG_CHECKING([for native Win32])
case "$target_or_host" in
  *-*-mingw*)
    os_win32=yes
    PATHSEP=';'
    MATH_LIB=
    ;;
  *)
    os_win32=no
    PATHSEP=':'
    ;;
esac
AC_MSG_RESULT([$os_win32])
AC_SUBST(PATH_SEP)
AC_SUBST(MATH_LIB)

AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")

Øyvind Kolås's avatar
Øyvind Kolås committed
347 348 349
dnl Checks for programs.
#AC_PROG_YACC
#AM_PROG_LEX
Øyvind Kolås's avatar
Øyvind Kolås committed
350

Øyvind Kolås's avatar
Øyvind Kolås committed
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428

########################
# Check for MMX assembly
########################

dnl GEGL_DETECT_CFLAGS(RESULT, FLAGSET)
dnl Detect if the compiler supports a set of flags

AC_DEFUN([GEGL_DETECT_CFLAGS],
[
  $1=
  for flag in $2; do
    if test -z "[$]$1"; then
      $1_save_CFLAGS="$CFLAGS"
      CFLAGS="$CFLAGS $flag"
      AC_MSG_CHECKING([whether [$]CC understands [$]flag])
      AC_TRY_COMPILE([], [], [$1_works=yes], [$1_works=no])
      AC_MSG_RESULT([$]$1_works)
      CFLAGS="[$]$1_save_CFLAGS"
      if test "x[$]$1_works" = "xyes"; then
        $1="$flag"
      fi
    fi
  done
])

AC_ARG_ENABLE(mmx,
                [  --enable-mmx            enable MMX support (default=auto)],,
                  enable_mmx=$have_x86)

AC_ARG_ENABLE(sse,
  [  --enable-sse            enable SSE support (default=auto)],,
  enable_sse=$enable_mmx)

if test "x$enable_mmx" = xyes; then
  GEGL_DETECT_CFLAGS(MMX_EXTRA_CFLAGS, '-mmmx')
  SSE_EXTRA_CFLAGS=

  AC_MSG_CHECKING(whether we can compile MMX code)

  mmx_save_CFLAGS="$CFLAGS"
  CFLAGS="$mmx_save_CFLAGS $MMX_EXTRA_CFLAGS"

  AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],

    AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
    AC_MSG_RESULT(yes)

    if test "x$enable_sse" = xyes; then
      GEGL_DETECT_CFLAGS(sse_flag, '-msse')
      SSE_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $sse_flag"

      AC_MSG_CHECKING(whether we can compile SSE code)

      CFLAGS="$CFLAGS $sse_flag"

      AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");],
        AC_DEFINE(USE_SSE, 1, [Define to 1 if SSE assembly is available.])
        AC_MSG_RESULT(yes)
      ,
        enable_sse=no
        AC_MSG_RESULT(no)
        AC_MSG_WARN([The assembler does not support the SSE command set.])
      )

    fi
  ,
    enable_mmx=no
    AC_MSG_RESULT(no)
    AC_MSG_WARN([The assembler does not support the MMX command set.])
  )

  CFLAGS="$mmx_save_CFLAGS"

  AC_SUBST(MMX_EXTRA_CFLAGS)
  AC_SUBST(SSE_EXTRA_CFLAGS)
fi

429
CFLAGS="$CFLAGS $SSE_EXTRA_CFLAGS"
Øyvind Kolås's avatar
Øyvind Kolås committed
430 431 432 433 434 435 436 437


###############################
# Checks for required libraries
###############################

PKG_CHECK_MODULES(BABL, babl >= babl_required_version)

438
GLIB_PACKAGES="gobject-2.0 gmodule-2.0 "
Øyvind Kolås's avatar
Øyvind Kolås committed
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
AC_SUBST(GLIB_PACKAGES)

dnl This PATH_GLIB is somewhat redundant, but does a sanity compile and 
dnl importantly defines the GLIB_GENMARSHAL variable for subst into the
dnl Makefile
AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, :,
  AC_MSG_ERROR([
*** GLIB $GLIB_REQUIRED_VERSION or better is required. The latest version of 
*** GLIB is always available from ftp://ftp.gtk.org/.]),
  gobject gmodule)

PKG_CHECK_MODULES(DEP,
	          glib-2.0 >= $GLIB_REQUIRED_VERSION $GLIB_PACKAGES, ,
                  AC_MSG_ERROR([
        *** GLib not found. You can find it on ftp://ftp.gtk.org
        *** Errors follow:
            $DEP_PKG_ERRORS]))

457 458 459 460 461 462 463
PKG_CHECK_MODULES(GIO, gio-2.0, 
	have_gio="yes"
	AC_DEFINE(HAVE_GIO, 1, [Define to 1 to compile with gio support.])
	GLIB_PACKAGES="$GLIB_PACKAGES gio-2.0",
	have_gio="no (gio not found)")
AM_CONDITIONAL(HAVE_GIO, test "x$have_gio" = "xyes")

Øyvind Kolås's avatar
Øyvind Kolås committed
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
# Rerun PKG_CONFIG to add gthread-2.0 cflags and libs
DEP_CFLAGS=`$PKG_CONFIG --cflags $GLIB_PACKAGES gthread-2.0`
DEP_LIBS=`$PKG_CONFIG --libs $GLIB_PACKAGES gthread-2.0`

PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED_VERSION,
  have_gtk="yes"
  AC_DEFINE(HAVE_GTK, 1, [Define to 1 to compile with gtk support.])
  GTK_CFLAGS="$GTK_CFLAGS"
  GTK_LIBS="$GTK_LIBS",
  have_gtk="no  (gtk+ not found)")
AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = "xyes")

AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)


480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
######################
# gettext i18n support
######################

AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "gegl-$GEGL_API_VERSION",
                   [Our gettext translation domain.])

# GNU format message catalogs go into $datadir/locale,
# standard location is $libdir/locale. DATADIRNAME set accordingly.

GEGL_LOCALEDIR="$datadir/locale"
if test "$DATADIRNAME" = "lib"; then
   GEGL_LOCALEDIR="$libdir/locale"
fi
AC_SUBST(GEGL_LOCALEDIR)

# Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
gegl_save_LIBS=$LIBS
LIBS="$LIBS $GLIB_LIBS"
AC_CHECK_FUNCS(bind_textdomain_codeset,,
  AC_MSG_ERROR([
*** Check for bind_textdomain_codeset() failed!  This is required.
]))
LIBS=$gegl_save_LIBS


Øyvind Kolås's avatar
Øyvind Kolås committed
506 507 508 509
#########################
# Disable deprecated APIs
#########################

510 511 512
AC_MSG_CHECKING([if GLib is version 2.17.0 or newer])
if $PKG_CONFIG --atleast-version=2.17.0 glib-2.0; then
  have_glib_2_17=yes
Øyvind Kolås's avatar
Øyvind Kolås committed
513
else
514
  have_glib_2_17=no
Øyvind Kolås's avatar
Øyvind Kolås committed
515
fi
516
AC_MSG_RESULT($have_glib_2_17)
Øyvind Kolås's avatar
Øyvind Kolås committed
517

518
if test "x$have_glib_2_17" != "xyes"; then
Øyvind Kolås's avatar
Øyvind Kolås committed
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535
  CPPFLAGS="${CPPFLAGS} -DG_DISABLE_DEPRECATED"
fi


######################################
# Checks for gtk-doc and docbook-tools
######################################

GTK_DOC_CHECK([1.0])

dnl NOTE: We need to use a separate automake conditional for this
dnl   	  to make this work with the tarballs.
AM_CONDITIONAL(ENABLE_GTK_DOC, test "x$enable_gtk_doc" = "xyes")

AC_CHECK_PROGS(PERL, perl5 perl)


536 537 538 539
###############
# Check for Lua
###############

Manish Singh's avatar
Manish Singh committed
540
PKG_CHECK_MODULES(LUA, lua >= $LUA_REQUIRED_VERSION,
541
  have_lua="yes",
Manish Singh's avatar
Manish Singh committed
542 543 544
  [PKG_CHECK_MODULES(LUA, lua5.1 >= $LUA_REQUIRED_VERSION,
     have_lua="yes",
     have_lua="no  (usable lua not found)")])
545 546 547 548 549 550
AM_CONDITIONAL(HAVE_LUA, test "x$have_lua" = "xyes")

AC_SUBST(LUA_CFLAGS) 
AC_SUBST(LUA_LIBS) 


Øyvind Kolås's avatar
Øyvind Kolås committed
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
#######################################
# Checks for Ruby used to make API docs
#######################################

AC_CHECK_PROG(RUBY, ruby, yes, no)
if test "$RUBY" = "no"; then
  AC_MSG_WARN([
*** Could not find Ruby interpreter. The HTML API reference
will not be updated.
])
  have_ruby=no
else
  RUBY_BIN="$RUBY"
  have_ruby=yes
fi
AM_CONDITIONAL(HAVE_RUBY, test "x$have_ruby" = "xyes")

AC_SUBST(RUBY_BIN)


#################
# Check for Cairo
#################

PKG_CHECK_MODULES(CAIRO, cairo,
  have_cairo="yes",
  have_cairo="no  (usable cairo not found)")
AM_CONDITIONAL(HAVE_CAIRO, test "x$have_cairo" = "xyes")

AC_SUBST(CAIRO_CFLAGS) 
AC_SUBST(CAIRO_LIBS) 


########################
# Checks for Pango stuff
########################

PKG_CHECK_MODULES(PANGO, pango,
  have_pango="yes",
  have_pango="no  (usable pango not found)")
AM_CONDITIONAL(HAVE_PANGO, test "x$have_pango" = "xyes")

PKG_CHECK_MODULES(PANGOCAIRO, pangocairo,
  have_pangocairo="yes",
  have_pangocairo="no  (usable pangocairo not found)")
AM_CONDITIONAL(HAVE_PANGOCAIRO, test "x$have_pangocairo" = "xyes")

AC_SUBST(PANGO_CFLAGS) 
AC_SUBST(PANGO_LIBS) 
AC_SUBST(PANGOCAIRO_CFLAGS) 
AC_SUBST(PANGOCAIRO_LIBS) 


604 605 606 607 608 609 610 611 612 613
######################
# Check for gdk-pixbuf
######################

PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= gtk_required_version,
  have_gdk_pixbuf="yes",
  have_gdk_pixbuf="no  (gdk-pixbuf not found)")
AM_CONDITIONAL(HAVE_GDK_PIXBUF, test "x$have_gdk_pixbuf" = "xyes")


Øyvind Kolås's avatar
Øyvind Kolås committed
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
###################
# Check for libjpeg
###################

AC_ARG_WITH(libjpeg, [  --without-libjpeg       build without JPEG support])
  if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
    AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
      jpeg_ok=yes,
      [jpeg_ok="no  (usable JPEG library not found)"])
    if test "$jpeg_ok" = yes; then
      AC_MSG_CHECKING([for jpeglib.h])
      AC_TRY_CPP([
#include <stdio.h>
#undef HAVE_STDDEF_H
#undef HAVE_STDLIB_H
#undef PACKAGE
#undef VERSION
#include <jpeglib.h>],
        jpeg_ok="yes",
        jpeg_ok="no  (Can't include jpeglib.h)")
      AC_MSG_RESULT($jpeg_ok)
      if test "$jpeg_ok" = yes; then
        AC_CHECK_LIB(jpeg, jpeg_save_markers,
        LIBJPEG='-ljpeg',
        jpeg_ok="no  (JPEG library is too old)")
      else
        jpeg_ok="no  (JPEG header file not found)"
      fi
    fi
  fi

  if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
     AC_MSG_RESULT([*** Checks for JPEG library failed.])
  fi
AM_CONDITIONAL(HAVE_JPEG, test "x$jpeg_ok" = "xyes")

AC_SUBST(LIBJPEG)


##################
# Check for libpng
##################

PKG_CHECK_MODULES(PNG, libpng,
  have_libpng="yes",
  have_libpng="no  (usable libpng not found)")
AM_CONDITIONAL(HAVE_PNG, test "x$have_libpng" = "xyes")

AC_SUBST(PNG_CFLAGS) 
AC_SUBST(PNG_LIBS) 


###################
# Check for librsvg
###################

PKG_CHECK_MODULES(RSVG, librsvg-2.0 >= librsvg_required_version,
  have_librsvg="yes",
  have_librsvg="no  (usable librsvg not found)")
AM_CONDITIONAL(HAVE_RSVG, test "x$have_librsvg" = "xyes")

AC_SUBST(RSVG_CFLAGS) 
AC_SUBST(RSVG_LIBS) 

Sven Neumann's avatar
Sven Neumann committed
678

Øyvind Kolås's avatar
Øyvind Kolås committed
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705
###################
# Check for OpenEXR
###################

PKG_CHECK_MODULES(OPENEXR, OpenEXR,
  have_openexr="yes",
  have_openexr="no  (usable OpenEXR not found)")
AM_CONDITIONAL(HAVE_OPENEXR, test "x$have_openexr" = "xyes")

AC_SUBST(OPENEXR_CFLAGS) 
AC_SUBST(OPENEXR_LIBS) 


###############
# Check for SDL
###############

dnl check for SDL
AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
if test "$SDL_CONFIG" = "no"; then
  have_sdl="no  (usable libsdl not found)"
  AC_MSG_RESULT([*** Check for SDL library failed.])
else
  have_sdl="yes"
  SDL_CFLAGS=`$SDL_CONFIG --cflags`
  SDL_LIBS=`$SDL_CONFIG --libs`
fi
706
AM_CONDITIONAL(HAVE_SDL, test "x$have_sdl" = "xyes")
Øyvind Kolås's avatar
Øyvind Kolås committed
707 708 709 710

AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)

Sven Neumann's avatar
Sven Neumann committed
711

712
######################
713
# Check for libopenraw
714
######################
715 716

dnl check for libopenraw
717
PKG_CHECK_MODULES(OPENRAW, libopenraw-1.0 >= openraw_required_version,
718
  have_openraw="yes",
719
  have_openraw="no  (usable libopenraw not found)")
720 721 722 723 724 725
AM_CONDITIONAL(HAVE_OPENRAW, test "x$have_openraw" = "xyes")

AC_SUBST(OPENRAW_CFLAGS) 
AC_SUBST(OPENRAW_LIBS) 


Øyvind Kolås's avatar
Øyvind Kolås committed
726 727 728 729
####################
# Check for graphviz
####################
 
730 731
AC_PATH_PROG(GRAPHVIZ, dot, no)
if test "$GRAPHVIZ" = "no"; then
Øyvind Kolås's avatar
Øyvind Kolås committed
732 733 734 735 736 737 738 739 740 741 742 743
  have_graphviz="no  (graphviz not found)"
  AC_MSG_RESULT([*** Check for dot command from graphviz failed.])
else
  have_graphviz="yes"
fi
AM_CONDITIONAL(HAVE_GRAPHVIZ, test "x$have_graphviz" = "xyes")


####################
# Check for enscript
####################
 
744 745
AC_PATH_PROG(ENSCRIPT, enscript, no)
if test "$ENSCRIPT" = "no"; then
Øyvind Kolås's avatar
Øyvind Kolås committed
746 747 748 749 750 751 752 753
  have_enscript="no  (enscript not found)"
  AC_MSG_RESULT([*** Check for enscript command failed.])
else
  have_enscript="yes"
fi
AM_CONDITIONAL(HAVE_ENSCRIPT, test "x$have_enscript" = "xyes")


Sven Neumann's avatar
Sven Neumann committed
754 755 756 757 758 759 760 761 762 763 764 765 766 767
####################
# Check for asciidoc
####################
 
AC_PATH_PROG(ASCIIDOC, asciidoc, no)
if test "$ASCIIDOC" = "no"; then
  have_asciidoc="no  (asciidoc not found)"
  AC_MSG_RESULT([*** Check for asciidoc failed.])
else
  have_asciidoc="yes"
fi
AM_CONDITIONAL(HAVE_ASCIIDOC, test "x$have_asciidoc" = "xyes")


768 769 770 771 772
####################################
# Check for libavformat / libavcodec
####################################

AC_ARG_WITH(libavformat,  [  --without-libavformat   build without libavformat support])
Øyvind Kolås's avatar
Øyvind Kolås committed
773

774 775 776 777 778 779 780 781
if test "x$with_libavformat" != xno; then
  PKG_CHECK_MODULES(AVFORMAT, libavformat libavcodec,
    have_libavformat="yes",
    have_libavformat="no  (libavformat not found)")
else
  have_libavformat="no  (disabled)"
fi
AM_CONDITIONAL(HAVE_AVFORMAT, test "x$have_libavformat" = "xyes")
Øyvind Kolås's avatar
Øyvind Kolås committed
782 783


784 785 786 787 788 789 790 791 792
###############
# Check for V4L
###############
 
have_v4l=no
AC_CHECK_HEADER(linux/videodev.h, have_v4l=yes)

AM_CONDITIONAL(HAVE_V4L, test "x$have_v4l" = "xyes")

Øyvind Kolås's avatar
Øyvind Kolås committed
793 794


Øyvind Kolås's avatar
Øyvind Kolås committed
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814
################
# Check for lcms
################
 
#have_lcms=no
#AC_CHECK_LIB(lcms, cmsCreateProofingTransform, [
#  AC_CHECK_HEADER(lcms.h,
#    have_lcms=yes
#    LCMS_LIBS="-llcms", [
#    AC_CHECK_HEADER(lcms/lcms.h,
#      have_lcms=yes
#      AC_DEFINE(HAVE_LCMS_LCMS_H, 1,
#        [Define to 1 if the lcms header must be included as lcms/lcms.h])
#      LCMS_LIBS="-llcms")])
#])
# 
#AM_CONDITIONAL(HAVE_LCMS, test "x$have_lcms" = "xyes")
#AC_SUBST(LCMS_LIBS)


815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842
####################
# Check for libspiro
####################

AC_ARG_WITH(libspiro, [  --without-spiro         build without SPIRO support])

spiro_ok="no"
if test "x$with_libspiro" != "xno" && test -z "$LIBSPIRO"; then
  AC_CHECK_LIB(spiro, run_spiro,
    spiro_ok="yes",
    spiro_ok="no  (usable SPIRO library not found)")
  if test "$spiro_ok" = "yes"; then
    AC_MSG_CHECKING([for spirolib.h])
    AC_TRY_CPP([#include <spiro.h>],
      spiro_ok="yes"
      AC_DEFINE(HAVE_SPIRO, 1,
                [Define to 1 if the spiro library is available])
      LIBSPIRO='-lspiro',
      spiro_ok="no  (Can't include spiro.h)")
      AC_MSG_RESULT($spiro_ok)
  fi
fi

AM_CONDITIONAL(HAVE_SPIRO, test "$spiro_ok" = "yes")

AC_SUBST(LIBSPIRO)


Øyvind Kolås's avatar
Øyvind Kolås committed
843 844


Øyvind Kolås's avatar
Øyvind Kolås committed
845 846 847 848 849 850 851 852 853
#######################
# Check for other items
#######################


# w3m is used to autogenerate README
AC_PATH_PROG(W3M, w3m, no)
AM_CONDITIONAL(HAVE_W3M, test "x$W3M" != "xno")

854 855 856 857 858 859 860
dnl disable build of workshop operations.
AC_ARG_ENABLE([workshop],
              [  --enable-workshop       enable build of workshop operations (default=no)],,
              enable_workshop="no")

AM_CONDITIONAL(ENABLE_WORKSHOP, test "x$enable_workshop" == "xyes")

Øyvind Kolås's avatar
Øyvind Kolås committed
861

862
dnl bin/node-editors/Makefile
Øyvind Kolås's avatar
Øyvind Kolås committed
863 864 865 866
AC_OUTPUT([
Makefile
bin/Makefile
gegl/Makefile
867
gegl/gegl.h
Øyvind Kolås's avatar
Øyvind Kolås committed
868 869 870 871 872 873 874 875 876
gegl/buffer/Makefile
gegl/graph/Makefile
gegl/module/Makefile
gegl/operation/Makefile
gegl/process/Makefile
gegl/property-types/Makefile
operations/Makefile
operations/affine/Makefile
operations/core/Makefile
877
operations/common/Makefile
Étienne Bersac's avatar
Étienne Bersac committed
878
operations/common/perlin/Makefile
879
operations/external/Makefile
Øyvind Kolås's avatar
Øyvind Kolås committed
880 881
operations/generated/Makefile
operations/workshop/Makefile
882
operations/workshop/external/Makefile
Øyvind Kolås's avatar
Øyvind Kolås committed
883 884 885
operations/workshop/generated/Makefile
tools/Makefile
docs/Makefile
886
docs/index-static.txt
Øyvind Kolås's avatar
Øyvind Kolås committed
887 888
docs/gallery/Makefile
docs/gallery/data/Makefile
889
examples/Makefile
890
examples/data/Makefile
Øyvind Kolås's avatar
Øyvind Kolås committed
891 892 893 894 895 896 897 898
gegl.pc
gegl-uninstalled.pc
])

dnl Print a summary of features enabled/disabled:
AC_MSG_RESULT([
Building GEGL with prefix=$prefix

899 900
Optional features:
  GEGL docs:      $enable_docs
901
  Build workshop: $enable_workshop
Sven Neumann's avatar
Sven Neumann committed
902
  Build website:  $have_asciidoc
903
  SIMD:           sse:$enable_sse mmx:$enable_mmx
904

Øyvind Kolås's avatar
Øyvind Kolås committed
905
Optional dependencies:
906
  GTK+:           $have_gtk
907
  GIO:            $have_gio
908 909 910 911 912 913 914 915 916 917 918
  Ruby:           $have_ruby
  Lua:            $have_lua
  Cairo:          $have_cairo
  Pango:          $have_pango
  pangocairo:     $have_pangocairo
  GDKPixbuf:      $have_gdk_pixbuf
  JPEG:           $jpeg_ok
  PNG:            $have_libpng
  OpenEXR:        $have_openexr
  rsvg:           $have_librsvg
  SDL:            $have_sdl
919
  openraw:        $have_openraw
920 921 922
  asciidoc:       $have_asciidoc
  enscript:       $have_enscript
  graphviz:       $have_graphviz
Øyvind Kolås's avatar
Øyvind Kolås committed
923
  avformat:       $have_libavformat
924
  V4L:            $have_v4l
925
  spiro:          $spiro_ok
Øyvind Kolås's avatar
Øyvind Kolås committed
926
]);