summaryrefslogtreecommitdiffstats
path: root/libkdcraw/configure.in.in
blob: 068a6e07336694ce36714c600be7394079273743 (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
AC_ARG_VAR(PKGCONFIGFOUND, [Path to pkg-config])
AC_CHECK_PROG(PKGCONFIGFOUND, pkg-config,[yes])

#-----------------------------------------------------------------
# Library API version
# -----------------------------------------------------------------

ABI_MAJOR=4
VERSION_INFO="4:3:0"

AC_SUBST(ABI_MAJOR)
AC_SUBST(VERSION_INFO)

# AM_PROG_CC_C_O to avoid that automake complains for it
AM_PROG_CC_C_O

# -----------------------------------------------------------------
# lcms check
# -----------------------------------------------------------------

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 libkdcraw"
fi

AC_SUBST(LCMS_LIBS)

#AM_CONDITIONAL(compile_LIBKDCRAW, [test x$have_lcms != xyes])

AC_OUTPUT([ libkdcraw/libkdcraw.pc ])

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

AC_LANG_PUSH(C++)
libkdcraw_kdemacros_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $all_includes"  
AC_MSG_CHECKING([if kdemacros.h is usable])
AC_COMPILE_IFELSE(
 [
   #include <kdemacros.h>
   #include <string>
   int other_func( void ) KDE_EXPORT;
   int other_func( void )
   { 
      std::string s("KDE_EXPORT");
      return 0;
   }
 ], 
 [ AC_MSG_RESULT([yes])
   AC_DEFINE(KDEMACROS_USABLE, 1, [kdemacros.h usable]) ], 
 [ AC_MSG_RESULT([no]) ] 
)
CPPFLAGS=$libkdcraw_kdemacros_cppflags
AC_LANG_POP(C++)

# -----------------------------------------------------------------
# enable OpenMP support to use parallelized code from LibRaw
# (default: disabled). this mode speed-up demosaicing operations.
# -----------------------------------------------------------------

AC_MSG_CHECKING(whether to enable parallel demosaicing operation from LibRaw using openmp...)
AC_ARG_ENABLE([openmp], [AC_HELP_STRING([--enable-openmp],
        [enable openmp [default=disabled] ])],
        if test $enableval = yes; then
           [AC_MSG_RESULT(yes)]
           [AC_DEFINE([USING_OPENMP], 1, [using openmp])]
           USING_OPENMP=yes
           [CXXFLAGS="$CXXFLAGS -fopenmp"]
           [OPENMP_LDFLAGS=" -lgomp "]
        fi
        ,
        [AC_MSG_RESULT(no)]
        [AC_DEFINE([USING_OPENMP], 0, [using openmp])]
        USING_OPENMP=no
        [OPENMP_LDFLAGS=""]
        )
AC_SUBST(OPENMP_LDFLAGS)