aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: d2739af395f86e562a2bbd7cb8af16eb40fa81bd (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
dnl  configure.ac -- an -*- autoconf -*- template for configure
dnl  Copyright (C) 2004--2007  Olaf Meeuwissen
dnl  Copyright (C) 2019  SEIKO EPSON Corporation
dnl
dnl  This file is part of the "Image Scan!" build infra-structure.
dnl
dnl  The "Image Scan!" build infra-structure is free software.
dnl  You can redistribute it and/or modify it under the terms of the GNU
dnl  General Public License as published by the Free Software Foundation;
dnl  either version 2 of the License or at your option any later version.
dnl
dnl  This program is distributed in the hope that it will be useful, but
dnl  WITHOUT ANY WARRANTY;  without even the implied warranty of FITNESS
dnl  FOR A PARTICULAR PURPOSE or MERCHANTABILITY.
dnl  See the GNU General Public License for more details.
dnl
dnl  You should have received a verbatim copy of the GNU General Public
dnl  License along with this program; if not, write to:
dnl
dnl	 Free Software Foundation, Inc.
dnl	 59 Temple Place, Suite 330
dnl	 Boston, MA  02111-1307	 USA
dnl
dnl  Process this file with autoconf to produce a configure script.


AC_PREREQ(2.60)
AC_INIT([Image Scan! for Linux],
	[2.30.4], [linux-printer@epson.jp], [iscan])

AC_SUBST(DATA_PKG_NAME, "iscan-data")
AC_SUBST(MODEL_DATA_DIR_NAME, "device")

AC_CONFIG_SRCDIR([backend/backend.h])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([1.7 gnu -Wall])


dnl  checks for programs

AC_PROG_CXX

#  Transitionary check for the C++ ABI while we are switching provided
#  binaries from gcc-3.[23] to gcc-3.4 or later.  Currently gcc-3.[23]
#  is still the official compiler version to use, but experimental bi-
#  naries are released with a ".c2" suffix.
#  The CXX_ABI for gcc-3.[23] is 102, btw.
#  Note that the PACKAGE_RELEASE for the gcc-3.4 or later packages has
#  to be larger than that for the gcc-3.[23] packages (as long as both
#  are distributed) for smooth upgrade paths.

if test x"$CXX" = xg++; then
    AC_MSG_CHECKING([C++ ABI version])
    CXX_ABI="`$CXX -E -dM - < /dev/null | $AWK '/GXX_ABI/ { print $3 }'`"
    AC_MSG_RESULT([$CXX_ABI])
    if test x"$CXX_ABI" = x1002; then
        PACKAGE_CXX_ABI=".c2"
    else
        PACKAGE_CXX_ABI=""
    fi
    AC_SUBST(PACKAGE_CXX_ABI)
fi

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

#  CxxTest unit testing support
AC_CHECK_PROGS([CXXTESTGEN], [cxxtestgen cxxtestgen.py cxxtestgen.pl])
AM_CONDITIONAL([HAVE_CXXTESTGEN], [test x"$CXXTESTGEN" != x])
if test x$CXXTESTGEN != x; then
    CXXTESTGEN_OPTS="--runner=ErrorPrinter"
fi
AC_SUBST(CXXTESTGEN_OPTS)

dnl  checks for modules

PKG_CHECK_MODULES(GTK, gtk+-2.0,
   [
    AC_DEFINE([HAVE_GTK_2], 1,
	      [Define to 1 if you have the gtk+-2.0 library.])
   ],[
    PKG_CHECK_MODULES(GTK, gtk+)
    PKG_CHECK_MODULES(GDK_IMLIB, imlibgdk)
   ])

AC_ARG_ENABLE(dependency-reduction,
	AC_HELP_STRING([--enable-dependency-reduction],
		[removes some unnecessary gtk related dependencies]),
	[if test "x$enable_dependency_reduction" = "xyes"; then
	    [GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-latk-[0-9.]*||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lfontconfig||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lgio-[0-9.]*||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lgdk_pixbuf-[0-9.]*||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lgmodule-[0-9.]*||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lcairo||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lpango-[0-9.]*||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lpangocairo-[0-9.]*||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lfreetype||"`
	    GTK_LIBS=`echo $GTK_LIBS | sed -e "s|-lpangoft2-[0-9.]*||"`
	    GTK_CFLAGS=`echo $GTK_CFLAGS | sed -e "s|-I/usr/include/pixman-[0-9.]*||"`
	    GTK_CFLAGS=`echo $GTK_CFLAGS | sed -e "s|-I/usr/include/freetype2||"`
	    GTK_CFLAGS=`echo $GTK_CFLAGS | sed -e "s|-I/usr/include/directfb||"`
	    GTK_CFLAGS=`echo $GTK_CFLAGS | sed -e "s|-I/usr/include/libpng12||"`]
	 fi])

PKG_CHECK_MODULES(GIMP, gimp-2.0,
   [
    AC_DEFINE([HAVE_GIMP_2], 1,
	      [Define to 1 if you have the gimp-2.0 library.])
    AC_DEFINE([HAVE_ANY_GIMP], 1,
	      [Define to 1 if you have the gimp library.])
   ],[
    AC_MSG_CHECKING(for GIMP - version >= 1.0.0)
    AC_PATH_PROG(GIMP_CONFIG, gimp-config, no)
    if test x"$GIMP_CONFIG" = xno; then
	AC_MSG_RESULT(no)
    else
	GIMP_CFLAGS=`$GIMP_CONFIG --cflags`
	AC_MSG_RESULT(yes)
	AC_DEFINE([HAVE_ANY_GIMP], 1,
		  [Define to 1 if you have the gimp library.])
    fi
   ])

AC_ARG_ENABLE(gimp,
	AC_HELP_STRING([--enable-gimp],
		[ensure GIMP plugin functionality is available]),
	[if test "x$enable_gimp" != xno; then
	    if test "x$GIMP_CONFIG" = xno; then
	        AC_MSG_ERROR([required module not found])
	    fi
	 fi])


dnl  checks for libraries

PKG_CHECK_MODULES(LIBPNG, libpng16)
PKG_CHECK_MODULES(XML, libxml-2.0)
PKG_CHECK_MODULES(LIBUSB_1_0, libusb-1.0,
    [
        AC_DEFINE([HAVE_LIBUSB_1_0], 1,
        [Define to 1 if you have the libusb-1.0 library.])
    ],[
        AC_CHECK_LIB([usb], [usb_get_busses])
    ])
AC_CHECK_LIB([sane], [sane_init])
AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT=1])


dnl  checks for header files

AC_USE_SYSTEM_EXTENSIONS
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([\
	fcntl.h \
	libintl.h \
	limits.h \
	locale.h \
	sane/sane.h \
	scsi/sg.h \
	stddef.h \
	stdint.h \
	stdlib.h \
	string.h \
	sys/ioctl.h \
	sys/param.h \
	sys/time.h \
	syslog.h \
	unistd.h \
	])

dnl  Conditionally check for header files needed to enable GIMP plug-in
dnl  functionality.
if test x != x"${GTK_CFLAGS}"; then
    iscan_save_CPPFLAGS="${CPPFLAGS}"
    CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}"
    AC_CHECK_HEADERS([\
        gtk/gtk.h \
        ])
    CPPFLAGS="${iscan_save_CPPFLAGS}"
fi


dnl  checks for typedefs, structures, and compiler characteristics

AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TIMEZONE
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UID_T


dnl  checks for library functions

AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.14)

AC_FUNC_CLOSEDIR_VOID
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([\
	alarm \
	atexit \
	bzero \
	floor \
	memset \
	regcomp \
	select \
	setenv \
	setlocale \
	strcasecmp \
	strncasecmp \
	strchr \
	strdup \
	strerror \
	strndup \
	strrchr \
	strstr \
	strtol \
	strtoul \
	])


dnl  The somewhat obscure LT_AC_PROG_SED is here to make sure that the
dnl  SED environment variable gets set before it's used by the libtool
dnl  machinery.  This works around buggy libtool versions.
LT_AC_PROG_SED
AC_LIBLTDL_INSTALLABLE
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_LIB_LTDL
AC_SUBST(LTDLINCL)
AC_SUBST(LIBLTDL)


dnl  Graphic file format options

AC_DEFUN([ISCAN_FILE_FORMAT],
   [AC_ARG_ENABLE($1,
		  AC_HELP_STRING([--enable-$1],
				 [ensure support for the $3 file format]),
		  [if test "x$enable_$1" != xno; then
		      iff_header="`echo $2 | $as_tr_sh`"
		      AC_CHECK_HEADERS([$2])
		      if test `eval echo '$ac_cv_header_'$iff_header` \
			       != yes; then
			 AC_MSG_ERROR([required header file missing])
		      fi
		   fi],
		  [AC_CHECK_HEADERS([$2])])
   ])

ISCAN_FILE_FORMAT(jpeg,jpeglib.h,JPEG)
ISCAN_FILE_FORMAT(png,png.h,PNG)
ISCAN_FILE_FORMAT(tiff,tiffio.h,TIFF)


dnl  Support for performance measurements.

AC_MSG_CHECKING(whether timing support will be activated)
AC_ARG_ENABLE(timing,
	      AC_HELP_STRING([--enable-timing],
			     [output crude scan timing statistics]),
	      [if test "x$enable_timing" != xno; then
	          if test "x$HAVE_LIBRT" != x1; then
		     enable_timing=no
		     AC_MSG_WARN([could not find library needed for timing support])
		  fi
	       fi
	      ],
	      [enable_timing=no])
AC_MSG_RESULT([$enable_timing])
AM_CONDITIONAL(ENABLE_TIMING, test x$enable_timing = xyes)


dnl  Facilitate builds on architectures other than i386 and friends.

AC_SUBST(ISCAN_HOST_CPU,[$host_cpu])
AC_DEFINE_UNQUOTED(ISCAN_HOST_CPU,["$host_cpu"],
	[Run-time architecture tag])
AC_MSG_CHECKING(whether to build the frontend application)
AC_ARG_ENABLE(frontend,
	      AC_HELP_STRING([--enable-frontend],
			     [ensure the frontend application is built]),
	      [if test "x$enable_frontend" != xno; then
		  case $host_cpu in
		    i?86) :
			  ;;
		    x86_64) :
			  ;;
		    *)	  AC_MSG_ERROR([requires IA32 architecture])
			  ;;
		  esac
	       fi],
	      [case $host_cpu in
	         i?86)   enable_frontend=yes ;;
		 x86_64) enable_frontend=yes ;;
		 *)      enable_frontend=no  ;;
	       esac])
AC_MSG_RESULT([$enable_frontend])
AM_CONDITIONAL(ENABLE_FRONTEND, test x$enable_frontend = xyes)


dnl  SANE related issues

dnl  The SANE version information is used by the epkowa backend and in
dnl  the determination of the libtool -version-info.
AC_SUBST(SANE_MAJOR,1)
AC_SUBST(SANE_MINOR,0)
AC_SUBST(SANE_REVISION,15)
AC_DEFINE_UNQUOTED(SANE_MAJOR, $SANE_MAJOR,
	[Major version of the SANE API that we claim to support.])
AC_DEFINE_UNQUOTED(SANE_MINOR, $SANE_MINOR,
	[Minor version of the SANE API that we claim to support.])
dnl  The code taken from sane-backends provides replacement code for a
dnl  number of functions for reasons of portability.
AC_REPLACE_FUNCS([\
	sigprocmask \
	])


AC_CONFIG_FILES([
	Makefile
	backend/Makefile
	backend/tests/Makefile
	doc/Makefile
	frontend/Makefile
	lib/Makefile
	lib/pdf/Makefile
	lib/tests/Makefile
	non-free/Makefile
	po/Makefile.in
	utils/Makefile
	])

AC_OUTPUT