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
|
dnl KDE_FIND_GPHOTO2 - Find gphoto2 libraries and include files
dnl
dnl Adapted from tdebase/nsplugins/configure.in.in
AC_DEFUN([KDE_FIND_GPHOTO2],
[
# Clear working variables
gphoto2_includes=
gphoto2_libraries=
# Process user input to configure
AC_ARG_WITH(kamera,
AC_HELP_STRING([--without-kamera],[do not build kamera (gphoto2 required)]),
[if test "$withval" = "no" ; then
gphoto2_includes=none
gphoto2_libraries=none
fi])dnl
AC_ARG_WITH(gphoto2-includes,
AC_HELP_STRING([--with-gphoto2-includes=DIR],[gphoto2 include files are in DIR]),
gphoto2_includes="$withval")
AC_ARG_WITH(gphoto2-libraries,
AC_HELP_STRING([--with-gphoto2-libraries=DIR],[gphoto2 libraries are in DIR]),
gphoto2_libraries="$withval")
AC_MSG_CHECKING(for gPhoto2)
# the pkg-config way first, if user did not use --with-
AC_CHECK_PROG(gphoto2_config,gphoto2-config,gphoto2-config,no)
AC_CHECK_PROG(gphoto2_port_config,gphoto2-port-config,gphoto2-port-config,no)
if test "$gphoto2_includes" = "" -a "$gphoto2_libraries" = "" -a "$gphoto2_config" != "no" -a "$gphoto2_port_config" != "no"
then
with_kamera="yes"
GPHOTO2_INCS="`$gphoto2_config --cflags` `$gphoto2_port_config --cflags`"
GPHOTO2_LIBS="`$gphoto2_config --libs` `$gphoto2_port_config --libs`"
else
#
# Search for gphoto2 include files.
#
if test "$gphoto2_includes" = ""; then
AC_CACHE_VAL(ac_cv_gphoto2_includes, [
ac_gphoto2_save_LIBS="$LIBS"
LIBS="-lgphoto2 $LIBS"
ac_cv_gphoto2_includes="none"
AC_TRY_COMPILE([#include <gphoto2.h>],[int a;],
[
# gphoto2.h is in the standard search path.
ac_cv_gphoto2_includes=
],[
# gphoto2.h is not in the standard search path.
# Locate it and put its directory in `gphoto2_includes'
for dir in /usr/include /usr/local/include \
/usr/include/gphoto2 /usr/local/include/gphoto2; do
if test -f "$dir/gphoto2.h"; then
ac_cv_gphoto2_includes="$dir"
break
fi
done
])
#
LIBS="$ac_gphoto2_save_LIBS"
])
gphoto2_includes="$ac_cv_gphoto2_includes"
fi
#
# Search for libgphoto2
#
if test "$gphoto2_libraries" = ""; then
AC_CACHE_VAL(ac_cv_gphoto2_libraries,[
ac_gphoto2_save_LIBS="$LIBS"
LIBS="-lgphoto2_port -lgphoto2 $LIBS"
ac_cv_gphoto2_libraries="none"
AC_TRY_LINK([#include <gphoto2.h>],[gp_context_progress_start(0,0,0,0);], [
# libgphoto2 is in the standard search path.
ac_cv_gphoto2_libraries=
],[
# libgphoto2 is not in the standard search path.
# Locate it and put its directory in `gphoto2_libraries'
for dir in /usr/lib /usr/local/lib; do
if test -d "$dir" && test "`ls $dir/libgphoto2.* 2> /dev/null`" != ""; then
ac_cv_gphoto2_libraries="$dir"
break
fi
done
])
#
LIBS="$ac_gphoto2_save_LIBS"
])
#
gphoto2_libraries="$ac_cv_gphoto2_libraries"
fi
# Initialise compiler and linker flag variables for export
if test "$gphoto2_includes" = "none" -o "$gphoto2_libraries" = "none" ; then
with_kamera="no"
else
with_kamera="yes"
if test "$gphoto2_libraries" = "" -o "$gphoto2_libraries" = "none"; then
GPHOTO2_LIBS="-lgphoto2"
else
GPHOTO2_LIBS="-L$gphoto2_libraries -lgphoto2"
fi
if test "$gphoto2_includes" != "" -a "$gphoto2_includes" != "none"; then
GPHOTO2_INCS="-I$gphoto2_includes"
fi
fi
fi
if test "$with_kamera" = "yes" ; then
# Check if it works.
ac_gphoto2_save_LIBS="$LIBS"
ac_gphoto2_save_CFLAGS="$CFLAGS"
LIBS="$LIBS $GPHOTO2_LIBS"
CFLAGS="$CFLAGS $GPHOTO2_INCS"
AC_TRY_LINK([#include <gphoto2.h>],[gp_context_progress_start(0,0,0,0);], [
# It works.
AC_DEFINE(HAVE_GPHOTO2,1,[Define if you have gPhoto2 installed])
],[
with_kamera="no"
])
LIBS="$ac_gphoto2_save_LIBS"
CFLAGS="$ac_gphoto2_save_CFLAGS"
fi
dnl **** Check for va_copy ****
AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
AC_TRY_LINK(
[#include <stdarg.h>],
[va_list ap1, ap2;
va_copy(ap1,ap2);
],
[ac_cv_c_va_copy="yes"],
[ac_cv_c_va_copy="no"])
)
if test "$ac_cv_c_va_copy" = "yes"
then
AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
fi
AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
AC_TRY_LINK(
[#include <stdarg.h>],
[va_list ap1, ap2;
__va_copy(ap1,ap2);
],
[ac_cv_c___va_copy="yes"],
[ac_cv_c___va_copy="no"])
)
if test "$ac_cv_c___va_copy" = "yes"
then
AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
fi
# Export compiler and linker flags for replacement in Makefile
AC_SUBST(GPHOTO2_INCS)
AC_SUBST(GPHOTO2_LIBS)
# Display results of configuration
gphoto2_libraries_result="$gphoto2_libraries"
gphoto2_includes_result="$gphoto2_includes"
test "$gphoto2_libraries" = "" && gphoto2_libraries_result="in default path"
test "$gphoto2_includes" = "" && gphoto2_includes_result="in default path"
test "$gphoto2_libraries" = "none" && gphoto2_libraries_result="(none)"
test "$gphoto2_includes" = "none" && gphoto2_includes_result="(none)"
AC_MSG_RESULT(
[gphoto2 libraries $gphoto2_libraries_result, gphoto2 headers $gphoto2_includes_result])
]) dnl end of KDE_FIND_GPHOTO2 definition
KDE_FIND_GPHOTO2
if test "$with_kamera" = "no"; then
dnl AC_MSG_WARN([You need to install gphoto 2.0 (or later), e.g. http://gphoto.net/dist/gphoto2-2.0.tar.gz if your distributor doesn't have a package])
DO_NOT_COMPILE="$DO_NOT_COMPILE kamera"
fi
|