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

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

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

AC_SUBST(ABI_MAJOR)
AC_SUBST(VERSION_INFO)

KDCRAW_DIR="\$(libdir)/libkdcraw\$(ABI_MAJOR)"
AC_SUBST(KDCRAW_DIR)
# 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++)