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
|
dnl Process this file with autoconf to produce a configure script. -*-sh-*-
AC_INIT(include/config.h.in)
AC_CONFIG_HEADER(include/config.h)
# AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required.
# AC_ARG_PROGRAM
# version code:
V_MAJOR=0
V_MINOR=98b
PACKAGE=xsane
BINPROGS="xsane"
# languages
ALL_LINGUAS="cs da de es fr hu it ja nl pl pt pt_BR ro ru sk sl sr sv vi tr zh"
SANE_V_MAJOR=1
VERSION=${V_MAJOR}.${V_MINOR}
XSANE_PACKAGE_VERSION="$PACKAGE-$VERSION"
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of the distribution])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define to the version of the distribution])
AC_DEFINE_UNQUOTED(XSANE_PACKAGE_VERSION, "$XSANE_PACKAGE_VERSION", [Define to name and version of distribution])
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(XSANE_PACKAGE_VERSION)
AC_SUBST(SANE_MAJOR)
dnl Check args
echo ""
echo "**************************************************************************"
echo ""
dnl Check for gtk-2
AC_MSG_CHECKING([whether GTK+-2.0 is requested])
AC_ARG_ENABLE(gtk2, [ --disable-gtk2 do not use GTK+-2.0, if available use GTK+-1.2], USE_GTK2=$enableval, USE_GTK2=yes)
AC_MSG_RESULT($USE_GTK2)
dnl Check for gimp plugin support, default is enabled
AC_MSG_CHECKING([whether GIMP plugin is requested])
AC_ARG_ENABLE(gimp, [ --disable-gimp do not include GIMP plugin mode], USE_GIMP=$enableval, USE_GIMP=yes)
AC_MSG_RESULT($USE_GIMP)
if test "${USE_GIMP}" = "yes"; then
dnl Check for gimp-2 plugin support, default is enabled
AC_MSG_CHECKING([whether GIMP-2.0 is requested])
AC_ARG_ENABLE(gimp2, [ --disable-gimp2 do not use GIMP-2.0, use GIMP-1.x if available], TRY_GIMP_2=$enableval, TRY_GIMP_2=yes)
AC_MSG_RESULT($TRY_GIMP_2)
fi
dnl Check for jpeg support
AC_MSG_CHECKING([whether JPEG support is requested])
dnl Default is enabled JPEG
AC_ARG_ENABLE(jpeg, [ --disable-jpeg do not include JPEG support], USE_JPEG=$enableval, USE_JPEG=yes)
AC_MSG_RESULT($USE_JPEG)
dnl Check for png support
AC_MSG_CHECKING([whether PNG support is requested])
dnl Default is enabled PNG
AC_ARG_ENABLE(png, [ --disable-png do not include PNG support], USE_PNG=$enableval, USE_PNG=yes)
AC_MSG_RESULT($USE_PNG)
dnl Check for tiff support
AC_MSG_CHECKING([whether TIFF support is requested])
dnl Default is enabled TIFF
AC_ARG_ENABLE(tiff, [ --disable-tiff do not include TIFF support], USE_TIFF=$enableval, USE_TIFF=yes)
AC_MSG_RESULT($USE_TIFF)
echo ""
echo "**************************************************************************"
echo ""
dnl Checks for programs.
AC_PROG_CC
AC_AIX
AC_MINIX
AC_ISC_POSIX
AM_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
INCLUDES="${INCLUDES} -I/usr/local/include"
CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE"
if test "${ac_cv_prog_gcc}" = "yes"; then
CFLAGS="${CFLAGS} -Wall"
fi
AC_GCC_MSNATIVE_STRUCT
if test "${ac_cv_header_windows_h}" = "yes"; then
LDFLAGS="${LDFLAGS} -mwindows"
XSANE_ICON="xsane-icon.opc"
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(windows.h os2.h fcntl.h unistd.h libc.h sys/time.h sys/types.h zlib.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_CHECK_TYPE(ssize_t, long)
AC_CHECK_TYPE(u_char, unsigned char)
AC_CHECK_TYPE(u_int, unsigned int)
AC_CHECK_TYPE(u_long, unsigned long)
dnl Checks for libraries.
AC_CHECK_LIB(m, sqrt)
AC_CHECK_LIB(z, deflateInit_)
if test "${USE_JPEG}" = "yes"; then
AC_CHECK_LIB(jpeg, jpeg_start_decompress)
fi
# tiff test must stand after test for zlib
if test "${USE_TIFF}" = "yes"; then
AC_CHECK_LIB(tiff, TIFFOpen)
fi
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_CHECK_FUNCS(atexit mkdir sigprocmask strdup strndup strftime strstr strsep strtod snprintf usleep strcasecmp strncasecmp lstat)
dnl Check for NLS/gettext
AM_GNU_GETTEXT
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
if test "$USE_NLS" = yes; then
if test "$USE_INCLUDED_LIBINTL" = yes; then
CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl"
INTLSUB=intl
fi
fi
AC_SUBST(INTLSUB)
AM_PATH_SANE(1.0.0, HAVE_SANE=yes, )
if test "${USE_GIMP}" = "yes"; then
if test "${TRY_GIMP_2}" = "yes"; then
AM_PATH_GIMP_2_0(1.3.23, HAVE_GIMP=yes, )
fi
fi
if test "${HAVE_GIMP}" = "yes"; then
HAVE_GTK=yes
AC_DEFINE([HAVE_GIMP_2], 1, [Define to 1 if you have gimp-2.0.])
else
dnl *** We do not have gimp-2.0 ***
dnl *** if xsane is compiled as gimp plugin it is possible that we do not
dnl *** need the test for gtk, but when we have gimp-1.0.x installed
dnl *** (gimp-1.0.x does not have gimp-config) or we compile xsane without
dnl *** gimp support we need the test for gtk.
dnl *** we start with the test for GTK+-2.0, if this fails or is diabled
dnl *** then we test for gtk+-1.2
if test "${USE_GTK2}" = "yes"; then
AM_PATH_GTK_2_0(2.0.0, HAVE_GTK=yes, )
fi
if test "x${HAVE_GTK}" = "x"; then
AM_PATH_GTK(1.2.0, HAVE_GTK=yes, )
fi
if test "${USE_GIMP}" = "yes"; then
dnl *** now we can test for gimp-1.x.x, for gimp-1.0.x we need GTK_* settings ***
AM_PATH_GIMP_ORAUCH(1.0.0, HAVE_GIMP=yes)
fi
fi
if test "${HAVE_GIMP}" = "yes"; then
dnl *** we have gimp ***
dnl *** define macro HAVE_ANY_GIMP for sourcecode tests for gimp ***
AC_DEFINE([HAVE_ANY_GIMP], 1, [Define to 1 if you have gimp - no matter what version.])
fi
# png test must stand after test for zlib
# png test must stand behind GTK-check (X-Window-check)
# because png.h is located in the X11 directory on some systems
# so we have to use GTK_CFLAGS and GTK_LIBS to test for png
if test "${USE_PNG}" = "yes"; then
saved_CPPFLAGS="${CPPFLAGS}"
if test "x${HAVE_GTK}" != "x"; then
CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}"
fi
AC_CHECK_HEADERS(png.h, [AC_CHECK_LIB(png, png_create_info_struct,,, ${GTK_LIBS})])
CPPFLAGS="${saved_CPPFLAGS}"
fi
AC_SUBST(INCLUDES)
AC_SUBST(BINPROGS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(GIMP_LIBS)
CPPFLAGS="${CPPFLAGS} \
-DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR} -DSANE_V_MAJOR=${SANE_V_MAJOR}"
dnl Print error message if sane or gtk is missing
if test "x${HAVE_SANE}" = "x"; then
echo "****************************************************************"
echo "ERROR: SANE-1.0.0 or newer is needed for compiling xsane"
echo " - if you installed SANE as rpm make sure you also included"
echo " sane-devel"
echo "****************************************************************"
echo ""
exit
fi
if test "x${HAVE_GTK}" = "x"; then
echo "****************************************************************"
echo "ERROR: GTK-1.2.0 or newer is needed for compiling xsane"
echo " if you installed gtk as rpm make sure you also included"
echo " gtk-devel"
echo "****************************************************************"
echo ""
exit
fi
AC_SUBST(V_MAJOR)
AC_SUBST(V_MINOR)
AC_SUBST(DLL_PRELOAD)
AC_SUBST(XSANE_ICON)
AC_ARG_ENABLE(foo1, [
Used environment variables that can be set by user:
CFLAGS, CPPFLAGS, LDFLAGS, LIBS])
AC_ARG_ENABLE(foo2, [
To add include or library paths call:
[env] CPPFLAGS=\"-I/path/to/foo/include\" LDFLAGS=\"-L/path/to/foo/libs\" ./configure])
AC_OUTPUT([Makefile intl/Makefile po/Makefile lib/Makefile
src/Makefile include/Makefile doc/Makefile xsane.spec],)
echo "****************************************************************"
echo "* *"
echo "* XSANE configure status: *"
echo "* ----------------------- *"
if test "${USE_NLS}" = "yes"; then
if test "$USE_INCLUDED_LIBINTL" = yes; then
echo "* - NLS activated (package internal) *"
else
echo "* - NLS activated (external) *"
fi
else
echo "* - NLS deactivated *"
fi
if test "${GIMP_LIBS}set" != "set"; then
echo "* - GIMP plugin activated *"
else
echo "* - GIMP plugin deactivated *"
fi
if test "${ac_cv_lib_jpeg_jpeg_start_decompress}" = "yes"; then
echo "* - JPEG support activated *"
else
echo "* - JPEG support deactivated *"
fi
if test "${ac_cv_lib_tiff_TIFFOpen}" = "yes"; then
echo "* - TIFF support activated *"
else
echo "* - TIFF support deactivated *"
fi
if test "${ac_cv_lib_png_png_create_info_struct}" = "yes"; then
echo "* - PNG support activated *"
else
echo "* - PNG support deactivated *"
fi
echo "* *"
echo "****************************************************************"
echo "* *"
echo "* To compile XSANE: *"
echo "* ----------------- *"
echo "* make *"
echo "* make install *"
echo "* *"
echo "* ------------------------------------------------------------ *"
echo "* ... PLEASE READ SANE DOCUMENTATION BEFORE STARTING XSANE ... *"
echo "* ------------------------------------------------------------ *"
echo "****************************************************************"
cat xsane.NEWS
|