summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/configure.in.in
blob: 085a52b125a5aee1a194caed09d9d4d177a26062 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
84
85
86
87
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
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
347
348
349
350
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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# ----------------------------------------------------------
#
# pkg-config check
#
# ----------------------------------------------------------

AC_ARG_VAR(PKGCONFIGFOUND, [Path to pkg-config])
AC_CHECK_PROG(PKGCONFIGFOUND, pkg-config,[yes])

# ----------------------------------------------------------
#
# common header files path for kipi-plugins
#
# ----------------------------------------------------------

KIPI_PLUGINS_COMMON_INCLUDE="-I\$(top_srcdir)/kipi-plugins/common/include"
AC_SUBST(KIPI_PLUGINS_COMMON_INCLUDE)

KIPI_PLUGINS_COMMON_LDFLAGS="-L\$(top_builddir)/kipi-plugins/common/libkipiplugins"
AC_SUBST(KIPI_PLUGINS_COMMON_LDFLAGS)

# -----------------------------------------------------------------
#
# enable hidden visibility only if kde >= 3.3.2 and kdelibs has
# been compiled with visibility enabled
#
# -----------------------------------------------------------------

AC_LANG_PUSH(C++)
kipiplugins_save_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $all_includes"  
AC_MSG_CHECKING([if hidden visibility should be enabled])
AC_COMPILE_IFELSE(
 [
   #include <kdeversion.h>
   #include <kdemacros.h>
   int other_func( void )
   { 
      #if KDE_IS_VERSION(3,3,2)
      #else
        iam dying;
      #endif
      #ifdef __KDE_HAVE_GCC_VISIBILITY
      #else
        no, iam really dead;
      #endif      
      return 0;
   }
 ], 
 [ AC_MSG_RESULT([yes])
   kipiplugins_enable_hidden_visibility="yes" ],
 [ AC_MSG_RESULT([no]) ] 
)
CPPFLAGS=$kipiplugins_save_cppflags
AC_LANG_POP(C++)

if test "x$kipiplugins_enable_hidden_visibility" = "xyes"; then
   KDE_ENABLE_HIDDEN_VISIBILITY 
fi

# ----------------------------------------------------------
#
# General kipi-plugin tests
#
# ----------------------------------------------------------

AC_MSG_CHECKING([for libkipi in our sources])
if test -d $srcdir/libkipi; then
    have_libkipi=yes
    LIBKIPI_CFLAGS='-I$(top_builddir)/libkipi -I$(top_srcdir)/libkipi'
    LIBKIPI_LIBS='$(top_builddir)/libkipi/libkipi/libkipi.la'
    LIBKIPI_LIBS_DEP='$(LIBKIPI_LIBS)'
    AC_MSG_RESULT([found])
    AC_SUBST(LIBKIPI_CFLAGS)
    AC_SUBST(LIBKIPI_LIBS)
    AC_SUBST(LIBKIPI_LIBS_DEP)
    AC_MSG_RESULT([found])
else
    AC_MSG_RESULT([not found in sources])
    if test "$PKGCONFIGFOUND" = "yes" ; then
        # check for libkipi
        have_libkipi=no

	KDE_PKG_CHECK_MODULES(LIBKIPI, libkipi >= 0.1.5,
		have_libkipi=yes, have_libkipi=no)

	if test "x$have_libkipi" = "xno"; then
	   LIBKIPI_CFLAGS=""
	   LIBKIPI_LIBS=""
	fi
     else
        LIBKIPI_CFLAGS=""
	LIBKIPI_LIBS=""
     fi
     AC_SUBST(LIBKIPI_CFLAGS)
     AC_SUBST(LIBKIPI_LIBS)
fi

if test "x$have_libkipi" != "xyes"; then
     AC_MSG_ERROR([libkipi library is required by kipi-plugins.])
     DO_NOT_COMPILE="$DO_NOT_COMPILE kipi-plugins"
fi

# --------------------------------------------------------------------
#
# Check for libkexiv2
#
# --------------------------------------------------------------------

AC_MSG_CHECKING([for libkexiv2 in our sources])
if test -d $srcdir/libkexiv2; then
    have_libkexiv2=yes
    LIBKEXIV2_CFLAGS='-I$(top_srcdir)/libkexiv2'
    LIBKEXIV2_LIBS='$(top_builddir)/libkexiv2/libkexiv2/libkexiv2.la'
    LIBKEXIV2_LIBS_DEP='$(LIBKEXIV2_LIBS)'
    AC_MSG_RESULT([found])
    AC_SUBST(LIBKEXIV2_CFLAGS)
    AC_SUBST(LIBKEXIV2_LIBS)
    AC_SUBST(LIBKEXIV2_LIBS_DEP)
else
    AC_MSG_RESULT([not found in sources])
    if test "$PKGCONFIGFOUND" = "yes" ; then
        # check for libkexiv2
        have_libkexiv2=no

        KDE_PKG_CHECK_MODULES(LIBKEXIV2, libkexiv2 >= 0.1.5,
                have_libkexiv2=yes, have_libkexiv2=no)

        if test "x$have_libkexiv2" = "xno"; then
           LIBKEXIV2_CFLAGS=""
           LIBKEXIV2_LIBS=""
        fi
     else
        LIBKEXIV2_CFLAGS=""
        LIBKEXIV2_LIBS=""
     fi
     AC_SUBST(LIBKEXIV2_CFLAGS)
     AC_SUBST(LIBKEXIV2_LIBS)
fi

if test x$have_libkexiv2 != xyes; then
  AC_MSG_ERROR([libkexiv2 library is required by kipi-plugins.])
  DO_NOT_COMPILE="$DO_NOT_COMPILE kipi-plugins"
fi

# --------------------------------------------------------------------
#
# Check for libkdcraw
#
# --------------------------------------------------------------------

AC_MSG_CHECKING([for libkdcraw in our sources])
if test -d $srcdir/libkdcraw; then
    have_libkdcraw=yes
    LIBKDCRAW_CFLAGS='-I$(top_builddir)/libkdcraw -I$(top_srcdir)/libkdcraw'
    LIBKDCRAW_LIBS='$(top_builddir)/libkdcraw/libkdcraw/libkdcraw.la'
    LIBKDCRAW_LIBS_DEP='$(LIBKDCRAW_LIBS)'
    AC_MSG_RESULT([found])
    AC_SUBST(LIBKDCRAW_CFLAGS)
    AC_SUBST(LIBKDCRAW_LIBS)
    AC_SUBST(LIBKDCRAW_LIBS_DEP)
    AC_MSG_RESULT([found])
else
    AC_MSG_RESULT([not found in sources])
    if test "$PKGCONFIGFOUND" = "yes" ; then
        # check for libkdcraw
        have_libkdcraw=no

        KDE_PKG_CHECK_MODULES(LIBKDCRAW, libkdcraw >= 0.1.4,
                have_libkdcraw=yes, have_libkdcraw=no)

        if test "x$have_libkdcraw" = "xno"; then
           LIBKDCRAW_CFLAGS=""
           LIBKDCRAW_LIBS=""
        fi
     else
        LIBKDCRAW_CFLAGS=""
        LIBKDCRAW_LIBS=""
     fi
     AC_SUBST(LIBKDCRAW_CFLAGS)
     AC_SUBST(LIBKDCRAW_LIBS)
fi

if test x$have_libkdcraw != xyes; then
  AC_MSG_ERROR([libkdcraw library is required by kipi-plugins.])
  DO_NOT_COMPILE="$DO_NOT_COMPILE kipi-plugins"
fi

#------------------------------------------------------------------
#
# Ability to fine-tune what plugins to build
#
#------------------------------------------------------------------

# Following macro sets up individual kipi-plugins. It generates AC_ARG_ENABLE.
# Third argument, plugin_dependencies is an optional space-separated list of dependencies.
# In case the plugin is enabled, it sets build_${dependency}=yes (for every dependency)
# KIPI_PLUGIN_PRE(plugin_directory, plugin_name[, plugin_depencencies])
AC_DEFUN([KIPI_PLUGIN_PRE], [
  AC_ARG_ENABLE([$1],
    AC_HELP_STRING([--disable-$1], [$2 kipi plugin.] m4_if([$3], [], [], [[ Requires $3.]]) [ [[enable]]]),
    [enable_$1="$enableval"],
    [enable_$1="check"],
  )
  if test "${enable_$1}" != "yes" -a "${enable_$1}" != "no"; then
    enable_$1="check"
  fi
  kipi_plug_deps_$1="$3"
  kipi_plug_name_$1="$2"
  if test "$enable_$1" != "no" -a -n "$3"; then
    for dep in $3; do
      eval build_${dep}="yes"   # we must use eval because we use shell variable inside variable name
    done
  fi
])

# Add entry for every new conditional dependency here
build_gphoto=no
build_libgpod=no
build_libkcal=no
build_tiff=no
build_xslt=no
build_opengl=no

# Please keep this list sorted and add all new plugins
KIPI_PLUGIN_PRE([acquireimages], [Acquire Images], [tiff])
KIPI_PLUGIN_PRE([batchprocessimages], [Batch Process Images])
KIPI_PLUGIN_PRE([calendar], [Calendar], [libkcal])
KIPI_PLUGIN_PRE([cdarchiving], [CD Archiving])
KIPI_PLUGIN_PRE([findimages], [Find Images])
KIPI_PLUGIN_PRE([flickrexport], [Flickr Exporter])
KIPI_PLUGIN_PRE([galleryexport], [Remote Gallery Export])
KIPI_PLUGIN_PRE([gpssync], [GPS Synchronization])
KIPI_PLUGIN_PRE([htmlexport], [HTML Gallery], [xslt])
#KIPI_PLUGIN_PRE([imagesgallery], [Images Gallery])      # ???
KIPI_PLUGIN_PRE([imageviewer], [Viewer], [opengl])
KIPI_PLUGIN_PRE([ipodexport], [iPod Export], [libgpod])
KIPI_PLUGIN_PRE([jpeglossless], [JPEG Lossless]) # Does it depend on tiff?
KIPI_PLUGIN_PRE([kameraklient], [Kamera Klient], [gphoto])
KIPI_PLUGIN_PRE([metadataedit], [Metadata Editor])
KIPI_PLUGIN_PRE([mpegencoder], [MPEG Encoder])
KIPI_PLUGIN_PRE([picasawebexport], [Picasaweb Exporter])
KIPI_PLUGIN_PRE([printwizard], [Print Wizard])
KIPI_PLUGIN_PRE([rawconverter], [RAW converter], [tiff])
KIPI_PLUGIN_PRE([sendimages], [Send Images])
KIPI_PLUGIN_PRE([simpleviewerexport], [Simple Viewer])
KIPI_PLUGIN_PRE([slideshow], [Slideshow], [opengl])
#KIPI_PLUGIN_PRE([sync], [Sync])   # ???
KIPI_PLUGIN_PRE([timeadjust], [Date & Time Adjust])
KIPI_PLUGIN_PRE([wallpaper], [Wallpaper])

#------------------------------------------------------------------
#
# Check for libtiff
#
#------------------------------------------------------------------

have_tiff=no

if test "x$build_tiff" != "xno"; then
  AC_CHECK_LIB(tiff, TIFFWriteScanline,
    have_tiff=yes,
    AC_MSG_WARN([TIFF library not found]),
    $all_libraries -ljpeg -lz -lm)

  if test "x$have_tiff" = "xyes"; then
    KDE_CHECK_HEADER(tiffio.h, have_tiff=yes, have_tiff=no)
  fi

  if test "x$have_tiff" != "xyes"; then
    AC_WARN([TIFF library not found, some plugins will not be compiled.])
  else
    LIB_TIFF="-ltiff"
    AC_SUBST(LIB_TIFF)
  fi
fi

#---------------------------------------------------------
#
# gphoto2 detection - KameraKlient plugin
#
#---------------------------------------------------------

have_gphoto=no

if test "x$build_gphoto" != "xno"; then
  AC_PATH_PROG(GPHOTO_CONFIG,gphoto2-config)
  AC_PATH_PROG(GPHOTO_PORT_CONFIG,gphoto2-port-config)
  if test -n "${GPHOTO_CONFIG}"; then
    GPHOTO_CFLAGS="`$GPHOTO_CONFIG --cflags`"
    AC_SUBST(GPHOTO_CFLAGS)
    LIB_GPHOTO="`$GPHOTO_CONFIG --libs` `$GPHOTO_PORT_CONFIG --libs`"
    AC_SUBST(LIB_GPHOTO)
    have_gphoto=yes
  else
    AC_MSG_WARN([gPhoto2 not found, some plugins will not be compiled.])
  fi
fi

#---------------------------------------------------------
#
# xslt detection - HTML export plugin
#
#---------------------------------------------------------

have_xslt=no

if test "x$build_xslt" != "xno"; then
  AC_PATH_PROG(XSLT_CONFIG,xslt-config)
  if test -n "${XSLT_CONFIG}"; then
    LIBXSLT_CFLAGS="`$XSLT_CONFIG --cflags`"
    AC_SUBST(LIBXSLT_CFLAGS)
    LIBXSLT_LIBS="`$XSLT_CONFIG --libs`"
    AC_SUBST(LIBXSLT_LIBS)
    have_xslt=yes
  else
    AC_MSG_WARN([libxslt library not found, some plugins will not be compiled])
  fi
fi

#------------------------------------------------------------------
#
# Check for libgpod - ipod export plugin
#
#------------------------------------------------------------------

have_libgpod=no

if test "x$build_libgpod" != "xno"; then
    if test "$PKGCONFIGFOUND" = "yes" ; then

        KDE_PKG_CHECK_MODULES(LIBGPOD, libgpod-1.0 >= 0.4.2 gobject-2.0, have_libgpod=yes,have_libgpod=no)

        if test "x$have_libgpod" = "xyes"; then
            AC_DEFINE(HAVE_LIBGPOD, 1, [have libgpod])
            ac_cppflags_save=$CPPFLAGS
            ac_cflags_save=$CFLAGS
            ac_ldflags_save=$LDFLAGS

            CPPFLAGS="$CPPFLAGS $LIBGPOD_INCLUDES"
            CFLAGS="$CFLAGS $LIBGPOD_CFLAGS"
            LDFLAGS="$LDFLAGS $LIBGPOD_LIBS"
        else
            AC_MSG_WARN([libgpod is required for the iPod export plugin.])
        fi
    fi
fi

#------------------------------------------------------------------
#
# Check for libkcal - iCalendar support library
#
#------------------------------------------------------------------

have_libkcal=no

if test "x$build_libkcal" != "xno"; then
  KDE_CHECK_HEADERS(libkcal/calendarlocal.h, have_libkcal=yes, have_libkcal=no)
  if test "x$have_libkcal" != "xyes"; then
    AC_WARN([libkcal not found, some plugins will not be compiled.])
  else
    LIB_KCAL="-llibkcal"
    AC_SUBST(LIB_KCAL)
  fi
fi

# ----------------------------------------------------------
#
# Qt OpenGl check (fudged from Amarok) - Slideshow plugin
#
# ----------------------------------------------------------

have_opengl=no

if test "x$build_opengl" != "xno"; then
    AC_MSG_CHECKING(for Qt with OpenGL support)
    AC_CACHE_VAL(ac_cv_kde_qt_has_opengl,
    [
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS

    save_CXXFLAGS="$CXXFLAGS"
    save_LIBS="$LIBS"
    save_LDFLAGS="$LDFLAGS"

    CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
    LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
    LIBS="$LIBS $LIBQT $KDE_MT_LIBS"

    AC_TRY_LINK([
    #include <qgl.h>
    ],
    [
    (void)new QGLWidget((QWidget*)0, "qgl");
    ],
    ac_cv_kde_qt_has_opengl=yes,
    ac_cv_kde_qt_has_opengl=no)

    CXXFLAGS="$save_CXXFLAGS"
    LIBS="$save_LIBS"
    LDFLAGS="$save_LDFLAGS"
    AC_LANG_RESTORE
    ])
    AC_MSG_RESULT($ac_cv_kde_qt_has_opengl)

    if test x$ac_cv_kde_qt_has_opengl = xyes; then
       have_opengl="yes"
       GL_LIBS="-lGL"
    else
       have_opengl="no"
       GL_LIBS=""
    fi

    AC_SUBST(GL_LIBS)
fi

# ----------------------------------------------------------
#
# Second stage of kipi-plugin fine-tuning.
#
# ----------------------------------------------------------

# Following macro checks if particular plugin should be enabled and for
# its dependencies. (have_$dependency must be either yes or no). Sets
# AM_CONDITIONAL accordingly. KIPI_PLUGIN_PRE must precede it.
# KIPI_PLUGIN_POST([plugin_directory])
AC_DEFUN([KIPI_PLUGIN_POST], [
  test="test $enable_$1 != no"
  if test $enable_$1 != no; then
    for dep in $kipi_plug_deps_$1; do
      test="${test} -a \$have_${dep} = yes"
      if eval test \$have_${dep} != "yes"; then   # we must use eval cos we use shell variable inside variable name
        AC_MSG_WARN([$dep could not be found, $kipi_plug_name_$1 ($1) plugin will not be built.])
      fi
    done
  fi
  if eval $test; then
    enabled_kipi_plugins="$enabled_kipi_plugins $1"
  else
    disabled_kipi_plugins="$disabled_kipi_plugins $1"
    if test $enable_$1 = yes; then
      AC_MSG_ERROR([Failing as hard-enabled plugin cannot be compiled.])
    fi
  fi
  AM_CONDITIONAL([compile_]m4_toupper($1), [eval $test])
])

enabled_kipi_plugins=""
disabled_kipi_plugins=""

# Please keep this list sorted and add all new plugins
KIPI_PLUGIN_POST([acquireimages])
KIPI_PLUGIN_POST([batchprocessimages])
KIPI_PLUGIN_POST([calendar])
KIPI_PLUGIN_POST([cdarchiving])
KIPI_PLUGIN_POST([findimages])
KIPI_PLUGIN_POST([flickrexport])
KIPI_PLUGIN_POST([galleryexport])
KIPI_PLUGIN_POST([gpssync])
KIPI_PLUGIN_POST([htmlexport])
#KIPI_PLUGIN_POST([imagesgallery])   # ???
KIPI_PLUGIN_POST([imageviewer])
KIPI_PLUGIN_POST([ipodexport])
KIPI_PLUGIN_POST([jpeglossless])
KIPI_PLUGIN_POST([kameraklient])
KIPI_PLUGIN_POST([metadataedit])
KIPI_PLUGIN_POST([mpegencoder])
KIPI_PLUGIN_POST([picasawebexport])
KIPI_PLUGIN_POST([printwizard])
KIPI_PLUGIN_POST([rawconverter])
KIPI_PLUGIN_POST([sendimages])
KIPI_PLUGIN_POST([simpleviewerexport])
KIPI_PLUGIN_POST([slideshow])
#KIPI_PLUGIN_POST([sync])   # ???
KIPI_PLUGIN_POST([timeadjust])
KIPI_PLUGIN_POST([wallpaper])