summaryrefslogtreecommitdiffstats
path: root/digikam/configure.in.in
blob: 64247f2a8a4f29a3ea949cc39d128e2052e2f8cc (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
#MIN_CONFIG(3)

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

AC_LANG_PUSH(C++)
digikam_save_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $all_includes"  
AC_MSG_CHECKING([if hidden visibility should be enabled])
AC_COMPILE_IFELSE(
 [
   #include <tdeversion.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])
   digikam_enable_hidden_visibility="yes" ],
 [ AC_MSG_RESULT([no]) ] 
)
CPPFLAGS=$digikam_save_cppflags
AC_LANG_POP(C++)

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

# -----------------------------------------------------------------
#
# pkg config check
#
# -----------------------------------------------------------------

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

# -----------------------------------------------------------------
#
# sqlite2 type check
#
# -----------------------------------------------------------------

KDE_CHECK_TYPES

# -------------------------------------------------------
#
# Check endianness
#
# -------------------------------------------------------

AC_LANG_SAVE
AC_LANG_C
AC_C_BIGENDIAN
AC_LANG_RESTORE

# -----------------------------------------------------------------
#
# Check for liblcms
#
# -----------------------------------------------------------------

have_lcms_header='no'
KDE_CHECK_HEADER(lcms/lcms.h,have_lcms_header='yes',,)
if test "$have_lcms_header" = 'yes'
then
    AC_DEFINE(LCMS_HEADER, <lcms/lcms.h>, [The correct header])
else
    # Alternative! Debian does it this way...
    KDE_CHECK_HEADER(lcms.h,have_lcms_header='yes',,)
    if test "$have_lcms_header" = 'yes'
    then
        AC_DEFINE(LCMS_HEADER, <lcms.h>, [The correct header])
    fi
fi

LCMS_LIBS=''
have_lcms='no'
if test "$have_lcms_header" = 'yes'
then
    saved_cflags="$CFLAGS"
    saved_ldflags="$LDFLAGS"
    saved_libs=$LIBS
    LIBS="$LIBS -llcms"
    CFLAGS="$CFLAGS $all_includes"
    LDFLAGS="$LDFLAGS $all_libraries"
    AC_TRY_LINK([
#define inline __inline /* gcc is in ansi mode */
#include LCMS_HEADER
#if LCMS_VERSION < 112
choke!
#endif
], [
cmsOpenProfileFromFile("foo", "r");
],
        [LCMS_LIBS='-llcms'; have_lcms='yes'])
    LIBS=$saved_libs
    CFLAGS=$saved_cflags
    LDFLAGS=$saved_ldflags
fi

if test -z "$LCMS_LIBS"; then
    DO_NOT_COMPILE="$DO_NOT_COMPILE digikam"
fi

AC_SUBST(LCMS_LIBS)

#------------------------------------------------------------------
#
# Check for libgphoto2
#
#------------------------------------------------------------------

KDE_PKG_CHECK_MODULES(GPHOTO2, libgphoto2 >= 2.5,
         [have_libgphoto2=yes; have_gphoto25=yes], have_libgphoto2=no)
if test "x$have_libgphoto2" = "xno"; then
  KDE_PKG_CHECK_MODULES(GPHOTO2, libgphoto2,
         have_libgphoto2=yes, have_libgphoto2=no)
fi
if test "x$have_libgphoto2" = "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_VERSION="`$GPHOTO_CONFIG --version`"
    case "${GPHOTO_VERSION}" in "libgphoto2 2.5"*) CXXFLAGS="$CXXFLAGS -DHAVE_GPHOTO25";; esac
    GPHOTO_CFLAGS="`$GPHOTO_CONFIG --cflags`"
    AC_SUBST(GPHOTO_CFLAGS)
    LIB_GPHOTO="`$GPHOTO_CONFIG --libs` `$GPHOTO_PORT_CONFIG --libs`"
    AC_SUBST(LIB_GPHOTO)
    have_libgphoto2=yes
  else
    AC_MSG_WARN([gPhoto2 not found.])
    DO_NOT_COMPILE="digikam $DO_NOT_COMPILE"
  fi
else
  if test "x$have_gphoto25" = "xyes"; then
    GPHOTO_CFLAGS="$GPHOTO2_CFLAGS -DHAVE_GPHOTO25"
  else
    GPHOTO_CFLAGS="$GPHOTO2_CFLAGS"
  fi
  LIB_GPHOTO="$GPHOTO2_LIBS"
  AC_SUBST(GPHOTO_CFLAGS)
  AC_SUBST(LIB_GPHOTO)
fi

#------------------------------------------------------------------
#
# Check for libkipi 
#
#------------------------------------------------------------------

if test "$PKGCONFIGFOUND" = "yes" ; then
   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=""
        AC_MSG_RESULT([not found])
   else
	AC_MSG_RESULT([found])
   fi
else
   LIBKIPI_CFLAGS=""
   LIBKIPI_LIBS=""
   AC_MSG_RESULT([not found])
fi 
AC_SUBST(LIBKIPI_CFLAGS)
AC_SUBST(LIBKIPI_LIBS)

if test "x$have_libkipi" != "xyes"; then
     DO_NOT_COMPILE="$DO_NOT_COMPILE digikam"
fi

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

if test "$PKGCONFIGFOUND" = "yes" ; then
   have_libkexiv2=no

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

   if test "x$have_libkexiv2" = "xno"; then
       LIBKEXIV2_CFLAGS=""
       LIBKEXIV2_LIBS=""
       AC_MSG_RESULT([not found])
   else
       AC_MSG_RESULT([found])
   fi
else
   LIBKEXIV2_CFLAGS=""
   LIBKEXIV2_LIBS=""
   AC_MSG_RESULT([not found])
fi 
AC_SUBST(LIBKEXIV2_CFLAGS)
AC_SUBST(LIBKEXIV2_LIBS)

if test "x$have_libkexiv2" != "xyes"; then
   DO_NOT_COMPILE="$DO_NOT_COMPILE digikam"
fi

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

if test "$PKGCONFIGFOUND" = "yes" ; then
   have_libkdcraw=no

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

   if test "x$have_libkdcraw" = "xno"; then
       LIBKDCRAW_CFLAGS=""
       LIBKDCRAW_LIBS=""
       AC_MSG_RESULT([not found])
   else
       AC_MSG_RESULT([found])
   fi
else
   LIBKDCRAW_CFLAGS=""
   LIBKDCRAW_LIBS=""
   AC_MSG_RESULT([not found])
fi 
AC_SUBST(LIBKDCRAW_CFLAGS)
AC_SUBST(LIBKDCRAW_LIBS)

if test "x$have_libkdcraw" != "xyes"; then
   DO_NOT_COMPILE="$DO_NOT_COMPILE digikam"
fi

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

have_tiff=no
KDE_CHECK_LIB(tiff, TIFFWriteScanline,
  have_tiff=yes,
  AC_MSG_WARN([TIFF library not found]), 
  -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, digiKam will not be compiled.])
  DO_NOT_COMPILE="digikam $DO_NOT_COMPILE"
else
  LIB_TIFF="-ltiff"
  AC_SUBST(LIB_TIFF)
fi

#------------------------------------------------------------------
#
# Check for libpng (with png_set_add_alpha() function)
#
#------------------------------------------------------------------

have_png=no
KDE_CHECK_LIB(png, png_set_add_alpha,
        have_png=yes,
        AC_MSG_WARN([digiKam requires libpng >= 1.2.7]),
        -lpng -lz -lm)

if test "x$have_png" != "xyes"; then
  AC_WARN([digiKam requires libpng >= 1.2.7; digiKam will not be compiled.])
  DO_NOT_COMPILE="digikam $DO_NOT_COMPILE"
else
  LIB_PNG="-lpng"
  AC_SUBST(LIB_PNG)
fi

#------------------------------------------------------------------
#
# Check for libjasper (JPEG2000)
#
#------------------------------------------------------------------

have_jasper=no
KDE_CHECK_LIB(jasper, jas_init,
              have_jasper=yes,
              AC_MSG_WARN([digiKam requires libjasper >= 1.7.0]),
              -ljasper)

if test "x$have_jasper" != "xyes"; then
  AC_WARN([digiKam requires libjasper >= 1.7.0; digiKam will not be compiled.])
  DO_NOT_COMPILE="digikam $DO_NOT_COMPILE"
else
  LIB_JASPER="-ljasper"
  AC_SUBST(LIB_JASPER)
fi

#------------------------------------------------------------------
#
# Check for local/shared sqlite3
#
#------------------------------------------------------------------

LIB_SQLITE3=""

AC_ARG_WITH(included-sqlite3,
    AC_HELP_STRING([--without-included-sqlite3],[build digiKam using system sqlite3 library]),
    [included_sqlite3=$withval],
    [included_sqlite3=yes]
)

if test x$included_sqlite3 = xno; then
    if test x$PKGCONFIGFOUND = xyes; then
        PKG_CHECK_MODULES(SQLITE, sqlite3 >= 3.5, have_sqlite3=yes,have_sqlite3=no)

        if test x$have_sqlite3 = xyes; then
            ## AC_DEFINE(HAVE_SQLITE3, 1, [have SQLite3 database library])
            LIB_SQLITE3=`pkg-config --libs sqlite3`
        else
            # We don't support not having sqlite3 anymore
            DO_NOT_COMPILE="digikam $DO_NOT_COMPILE"
        fi
    fi
fi

AC_SUBST(LIB_SQLITE3)
AM_CONDITIONAL(with_included_sqlite3, [test x$included_sqlite3 = xyes])

###############################################################################
# END SQLITE CHECK
###############################################################################


#------------------------------------------------------------------
#
# NFS is Evil (sqlite makes use of file locking for allowing 
# multiple processes to access the database. but on many 
# nfs implementations, this file locking is horribly broken and
# can end up locking the app or not allowing access to the app. 
# since we use tdeioslaves which access the db too)
#
#------------------------------------------------------------------

AC_ARG_ENABLE(nfs-hack,
	AC_HELP_STRING([--enable-nfs-hack],
[Enable a hack for album libraries on a nfs mount, 
 which causes the database to be saved in 
 $HOMEDIR/.trinity/share/apps/digikam/directoryname.db [default=disable]]),
 [enable_nfs_hack=$enableval],
 [enable_nfs_hack=no]
)

if test "x$enable_nfs_hack" = "xyes"; then
   AC_DEFINE(NFS_HACK, 1, [NFS hack enabled])
   AC_MSG_NOTICE([NFS hack enabled. Make sure you know what you are doing])
fi

#------------------------------------------------------------------
#
# get the gcc version
#
# CImg.h version 1.2.8 do not compile fine with gcc 4.3.x
# See B.K.O #163118: digikam-0.9.4_beta5 compilation hangs with gcc 4.3
# Using -fno-tree-pre is work around this problem.
#
#------------------------------------------------------------------

KDE_CHECK_COMPILER_FLAG(fno-tree-pre,[CXXFLAGS="-fno-tree-pre $CXXFLAGS"])