1dnl  configure.ac -- an -*- autoconf -*- template for configure
2dnl  Copyright (C) 2004--2007  Olaf Meeuwissen
3dnl
4dnl  This file is part of the "Image Scan!" build infra-structure.
5dnl
6dnl  The "Image Scan!" build infra-structure is free software.
7dnl  You can redistribute it and/or modify it under the terms of the GNU
8dnl  General Public License as published by the Free Software Foundation;
9dnl  either version 2 of the License or at your option any later version.
10dnl
11dnl  This program is distributed in the hope that it will be useful, but
12dnl  WITHOUT ANY WARRANTY;  without even the implied warranty of FITNESS
13dnl  FOR A PARTICULAR PURPOSE or MERCHANTABILITY.
14dnl  See the GNU General Public License for more details.
15dnl
16dnl  You should have received a verbatim copy of the GNU General Public
17dnl  License along with this program; if not, write to:
18dnl
19dnl	 Free Software Foundation, Inc.
20dnl	 59 Temple Place, Suite 330
21dnl	 Boston, MA  02111-1307	 USA
22dnl
23dnl  Process this file with autoconf to produce a configure script.
24
25AC_PREREQ(2.57)
26AC_INIT([Image Scan! for Linux],
27	[2.11.0], [EPSON AVASYS Corporation <pipsnews@avasys.jp>], [iscan])
28AC_SUBST(PACKAGE_RELEASE,1)		dnl  keep ALL versioning info in
29					dnl  one location
30
31AC_CONFIG_HEADER([config.h])
32AC_CONFIG_SRCDIR([backend/epkowa.c])
33AC_CONFIG_SUBDIRS([libltdl])
34
35AM_INIT_AUTOMAKE([gnu 1.7])
36
37
38dnl  checks for programs
39
40AC_PROG_CXX
41
42#  Transitionary check for the C++ ABI while we are switching provided
43#  binaries from gcc-3.[23] to gcc-3.4 or later.  Currently gcc-3.[23]
44#  is still the official compiler version to use, but experimental bi-
45#  naries are released with a ".c2" suffix.
46#  The CXX_ABI for gcc-3.[23] is 102, btw.
47#  Note that the PACKAGE_RELEASE for the gcc-3.4 or later packages has
48#  to be larger than that for the gcc-3.[23] packages (as long as both
49#  are distributed) for smooth upgrade paths.
50
51if test x"$CXX" = xg++; then
52    AC_MSG_CHECKING([C++ ABI version])
53    CXX_ABI="`$CXX -E -dM - < /dev/null | $AWK '/GXX_ABI/ { print $3 }'`"
54    AC_MSG_RESULT([$CXX_ABI])
55    if test x"$CXX_ABI" = x1002; then
56        PACKAGE_CXX_ABI=".c2"
57    else
58        PACKAGE_CXX_ABI=""
59    fi
60    AC_SUBST(PACKAGE_CXX_ABI)
61fi
62
63AC_PROG_CC
64AC_PROG_CPP
65AC_PROG_INSTALL
66AC_PROG_LN_S
67AC_PROG_MAKE_SET
68
69
70dnl  checks for modules
71
72PKG_CHECK_MODULES(GTK, gtk+-2.0,
73   [
74    AC_DEFINE([HAVE_GTK_2], 1,
75	      [Define to 1 if you have the gtk+-2.0 library.])
76   ],[
77    PKG_CHECK_MODULES(GTK, gtk+)
78    PKG_CHECK_MODULES(GDK_IMLIB, imlibgdk)
79   ])
80
81PKG_CHECK_MODULES(GIMP, gimp-2.0,
82   [
83    AC_DEFINE([HAVE_GIMP_2], 1,
84	      [Define to 1 if you have the gimp-2.0 library.])
85    AC_DEFINE([HAVE_ANY_GIMP], 1,
86	      [Define to 1 if you have the gimp library.])
87   ],[
88    AC_MSG_CHECKING(for GIMP - version >= 1.0.0)
89    AC_PATH_PROG(GIMP_CONFIG, gimp-config, no)
90    if test x"$GIMP_CONFIG" = xno; then
91	AC_MSG_RESULT(no)
92    else
93	GIMP_CFLAGS=`$GIMP_CONFIG --cflags`
94	AC_MSG_RESULT(yes)
95	AC_DEFINE([HAVE_ANY_GIMP], 1,
96		  [Define to 1 if you have the gimp library.])
97    fi
98   ])
99
100
101dnl  checks for libraries
102
103AC_CHECK_LIB([usb], [usb_get_busses])
104AC_CHECK_LIB([sane], [sane_init])
105
106
107dnl  checks for header files
108
109AC_FUNC_ALLOCA
110AC_HEADER_DIRENT
111AC_HEADER_STDC
112AC_HEADER_SYS_WAIT
113AC_CHECK_HEADERS([\
114	fcntl.h \
115	libintl.h \
116	limits.h \
117	locale.h \
118	scsi/sg.h \
119	stddef.h \
120	stdint.h \
121	stdlib.h \
122	string.h \
123	sys/ioctl.h \
124	sys/param.h \
125	sys/time.h \
126	syslog.h \
127	unistd.h \
128	])
129
130dnl  Conditionally check for header files needed to enable GIMP plug-in
131dnl  functionality.
132if test x != x"${GTK_CFLAGS}"; then
133    iscan_save_CPPFLAGS="${CPPFLAGS}"
134    CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}"
135    AC_CHECK_HEADERS([\
136	gtk/gtk.h \
137	libgimp/gimp.h \
138	libgimp/gimpfeatures.h \
139	])
140    CPPFLAGS="${iscan_save_CPPFLAGS}"
141fi
142
143
144dnl  checks for typedefs, structures, and compiler characteristics
145
146AC_HEADER_STDBOOL
147AC_C_CONST
148AC_C_INLINE
149AC_TYPE_PID_T
150AC_TYPE_SIZE_T
151AC_STRUCT_TIMEZONE
152AC_HEADER_TIME
153AC_STRUCT_TM
154AC_TYPE_UID_T
155
156
157dnl  checks for library functions
158
159AM_GNU_GETTEXT
160AM_GNU_GETTEXT_VERSION(0.14)
161
162AC_FUNC_CLOSEDIR_VOID
163AC_FUNC_FORK
164AC_PROG_GCC_TRADITIONAL
165AC_FUNC_MALLOC
166AC_FUNC_MEMCMP
167AC_FUNC_REALLOC
168AC_FUNC_SELECT_ARGTYPES
169AC_FUNC_STAT
170AC_FUNC_STRTOD
171AC_FUNC_VPRINTF
172AC_CHECK_FUNCS([\
173	alarm \
174	atexit \
175	bzero \
176	floor \
177	memset \
178	regcomp \
179	select \
180	setenv \
181	setlocale \
182	strcasecmp \
183	strncasecmp \
184	strchr \
185	strdup \
186	strerror \
187	strndup \
188	strrchr \
189	strstr \
190	strtol \
191	strtoul \
192	])
193
194
195dnl  The somewhat obscure LT_AC_PROG_SED is here to make sure that the
196dnl  SED environment variable gets set before it's used by the libtool
197dnl  machinery.  This works around buggy libtool versions.
198LT_AC_PROG_SED
199AC_LIB_LTDL
200AC_LIBLTDL_CONVENIENCE
201AC_LIBTOOL_DLOPEN
202AC_PROG_LIBTOOL
203AC_SUBST(LTDLINCL)
204AC_SUBST(LIBLTDL)
205
206
207dnl  Graphic file format options
208
209AC_DEFUN([ISCAN_FILE_FORMAT],
210   [AC_ARG_ENABLE($1,
211		  AC_HELP_STRING([--enable-$1],
212				 [ensure support for the $3 file format]),
213		  [if test "x$enable_$1" != xno; then
214		      iff_header="`echo $2 | $as_tr_sh`"
215		      AC_CHECK_HEADERS([$2])
216		      if test `eval echo '$ac_cv_header_'$iff_header` \
217			       != yes; then
218			 AC_MSG_ERROR([required header file missing])
219		      fi
220		   fi],
221		  [AC_CHECK_HEADERS([$2])])
222   ])
223
224ISCAN_FILE_FORMAT(jpeg,jpeglib.h,JPEG)
225ISCAN_FILE_FORMAT(png,png.h,PNG)
226
227
228dnl  Facilitate builds on architectures other than i386 and friends.
229
230AC_SUBST(ISCAN_HOST_CPU,[$host_cpu])
231AC_MSG_CHECKING(whether to build the frontend application)
232AC_ARG_ENABLE(frontend,
233	      AC_HELP_STRING([--enable-frontend],
234			     [ensure the frontend application is built]),
235	      [if test "x$enable_frontend" != xno; then
236		  case $host_cpu in
237		    i?86) :
238			  ;;
239		    *)	  AC_MSG_ERROR([requires IA32 architecture])
240			  ;;
241		  esac
242	       fi],
243	      [case $host_cpu in
244	         i?86)   enable_frontend=yes ;;
245		 *)      enable_frontend=no  ;;
246	       esac])
247AC_MSG_RESULT([$enable_frontend])
248AM_CONDITIONAL(ENABLE_FRONTEND, test x$enable_frontend = xyes)
249
250
251dnl  SANE related issues
252
253dnl  The SANE version information is used by the epkowa backend and in
254dnl  the determination of the libtool -version-info.
255AC_SUBST(SANE_MAJOR,1)
256AC_SUBST(SANE_MINOR,0)
257AC_SUBST(SANE_REVISION,15)
258dnl  The files in sanei look for sane/config.h.
259AC_CONFIG_HEADER([include/sane/config.h:config.h.in])
260dnl  The code taken from sane-backends provides replacement code for a
261dnl  number of functions for reasons of portability.
262AC_REPLACE_FUNCS([\
263	sigprocmask \
264	])
265
266
267AC_CONFIG_FILES([
268	Makefile
269	backend/Makefile
270	doc/Makefile
271	frontend/Makefile
272	include/Makefile
273	intl/Makefile
274	lib/Makefile
275	non-free/Makefile
276	po/Makefile.in
277	sanei/Makefile
278	utils/Makefile
279	iscan.spec
280	])
281
282AC_OUTPUT
283