From 8f69f4d89eff16a16d8e8d73ec8c50e9faa33056 Mon Sep 17 00:00:00 2001 From: Henning Geinitz Date: Sun, 4 Nov 2001 20:20:48 +0000 Subject: [PATCH] Enabled warnings by default. Henning Meier-Geinitz --- configure | 69 ++++++------ configure.in | 303 ++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 264 insertions(+), 108 deletions(-) diff --git a/configure b/configure index 53f4f166e..2c737100f 100755 --- a/configure +++ b/configure @@ -1467,7 +1467,7 @@ esac fi else - if false; then # release (false) or development (true) + if true; then # release (false) or development (true) # Warnings enabled by default (development) for flag in $WARN_CFLAGS; do case "$CFLAGS" in @@ -1663,7 +1663,7 @@ else int main() { /* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; +typedef int charset[2]; const charset x = {0,0}; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; @@ -1738,7 +1738,7 @@ for ac_kw in inline __inline__ __inline; do #include "confdefs.h" int main() { -} $ac_kw foo() { +} int $ac_kw foo() { ; return 0; } EOF if { (eval echo configure:1745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then @@ -3338,7 +3338,7 @@ else #include "confdefs.h" #include int main() { -char *p = alloca(2 * sizeof(int)); +void *p = alloca(2 * sizeof(int)); ; return 0; } EOF if { (eval echo configure:3345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then @@ -3691,12 +3691,15 @@ else #include #include #include +#include +#include + +#ifdef HAVE_UNISTD_H +# include +#endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -3751,7 +3754,7 @@ main() /* * First, make a file with some known garbage in it. */ - data = malloc(pagesize); + data = (char*)malloc(pagesize); if (!data) exit(1); for (i = 0; i < pagesize; ++i) @@ -3772,7 +3775,7 @@ main() fd = open("conftestmmap", O_RDWR); if (fd < 0) exit(1); - data2 = malloc(2 * pagesize); + data2 = (char*)malloc(2 * pagesize); if (!data2) exit(1); data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); @@ -3790,7 +3793,7 @@ main() */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); + data3 = (char*)malloc(pagesize); if (!data3) exit(1); if (read(fd, data3, pagesize) != pagesize) @@ -3804,7 +3807,7 @@ main() } EOF -if { (eval echo configure:3808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3832,12 +3835,12 @@ for ac_func in atexit ioperm mkdir scsireq_enter sigprocmask \ getenv isfdtype vsyslog do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3836: checking for $ac_func" >&5 +echo "configure:3839: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3886,7 +3889,7 @@ done echo $ac_n "checking linker parameter to set runtime link path""... $ac_c" 1>&6 -echo "configure:3890: checking linker parameter to set runtime link path" >&5 +echo "configure:3893: checking linker parameter to set runtime link path" >&5 if eval "test \"`echo '$''{'LINKER_RPATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3979,7 +3982,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3983: checking for $ac_word" >&5 +echo "configure:3986: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4007,7 +4010,7 @@ else fi echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:4011: checking for BSD-compatible nm" >&5 +echo "configure:4014: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4043,7 +4046,7 @@ NM="$ac_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:4047: checking whether ln -s works" >&5 +echo "configure:4050: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4097,8 +4100,8 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. - echo '#line 4101 "configure"' > conftest.$ac_ext - if { (eval echo configure:4102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 4104 "configure"' > conftest.$ac_ext + if { (eval echo configure:4105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" @@ -4119,19 +4122,19 @@ case "$lt_target" in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:4123: checking whether the C compiler needs -belf" >&5 +echo "configure:4126: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -4154,7 +4157,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4158: checking for $ac_word" >&5 +echo "configure:4161: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4186,7 +4189,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4190: checking for $ac_word" >&5 +echo "configure:4193: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4221,7 +4224,7 @@ fi # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4225: checking for $ac_word" >&5 +echo "configure:4228: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4253,7 +4256,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4257: checking for $ac_word" >&5 +echo "configure:4260: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4288,7 +4291,7 @@ fi # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4292: checking for $ac_word" >&5 +echo "configure:4295: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4320,7 +4323,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4324: checking for $ac_word" >&5 +echo "configure:4327: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4572,7 +4575,7 @@ fi # Extract the first word of "sane-config", so it can be a program name with args. set dummy sane-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4576: checking for $ac_word" >&5 +echo "configure:4579: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SANE_CONFIG_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4606,7 +4609,7 @@ else fi echo $ac_n "checking for sane_init in -lsane""... $ac_c" 1>&6 -echo "configure:4610: checking for sane_init in -lsane" >&5 +echo "configure:4613: checking for sane_init in -lsane" >&5 ac_lib_var=`echo sane'_'sane_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4614,7 +4617,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsane $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index 88536c352..83a1db7ae 100644 --- a/configure.in +++ b/configure.in @@ -7,20 +7,27 @@ AC_ARG_PROGRAM # version code: V_MAJOR=1 V_MINOR=0 -V_REV=1 +V_REV=6 -PACKAGE=sane +PACKAGE=sane-backends VERSION=${V_MAJOR}.${V_MINOR}.${V_REV} PACKAGE_VERSION="$PACKAGE-$VERSION" -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION") -AC_DEFINE_UNQUOTED(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(PACKAGE_VERSION, "$PACKAGE_VERSION", + [The concatenation of the strings PACKAGE, "-", and VERSION.]) +AC_DEFINE_UNQUOTED(SANE_DLL_V_MAJOR, $V_MAJOR, [SANE DLL major number]) +AC_DEFINE_UNQUOTED(SANE_DLL_V_MINOR, $V_MINOR, [SANE DLL minor number]) +AC_DEFINE_UNQUOTED(SANE_DLL_V_BUILD, $V_REV, [SANE DLL revision number]) AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_SUBST(PACKAGE_VERSION) dnl Checks for programs. AC_PROG_CC +AC_PROG_LD AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_CPP @@ -28,21 +35,76 @@ AC_PROG_GCC_TRADITIONAL AC_AIX AC_MINIX AC_ISC_POSIX +AM_PROG_CC_STDC INCLUDES="${INCLUDES} -I/usr/local/include" CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE" + if test "${ac_cv_prog_gcc}" = "yes"; then - CFLAGS="${CFLAGS} -Wall" -fi + NORMAL_CFLAGS="\ + -W \ + -Wall" + WARN_CFLAGS="\ + -W \ + -Wall \ + -Wcast-align \ + -Wcast-qual \ + -Wmissing-declarations \ + -Wmissing-prototypes \ + -Wpointer-arith \ + -Wreturn-type \ + -Wstrict-prototypes \ + -pedantic" + + dnl OS/2 and others don't include some headers with -ansi enabled + ANSI_FLAG=-ansi + AC_CHECK_HEADER(os2.h,[ANSI_FLAG=],) + case "${host_os}" in + solaris*) + ANSI_FLAG= + ;; + esac + WARN_CFLAGS="${WARN_CFLAGS} ${ANSI_FLAG}" + + # Warnings enabled by default (development) + AC_ARG_ENABLE(warnings, + [ --enable-warnings turn on tons of compiler warnings (GCC only) + [default=yes]], + [ + if eval "test x$enable_warnings = xyes"; then + for flag in $WARN_CFLAGS; do + JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ]) + done + else + for flag in $NORMAL_CFLAGS; do + JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ]) + done + fi + ], + [if true; then # release (false) or development (true) + # Warnings enabled by default (development) + for flag in $WARN_CFLAGS; do + JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ]) + done + else + # Warnings disabled by default (release) + for flag in $NORMAL_CFLAGS; do + JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ]) + done + fi]) +fi # ac_cv_prog_gcc +echo using CFLAGS=${CFLAGS} dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h unistd.h libintl.h libc.h sys/dsreq.h sys/select.h \ - sys/time.h jconfig.h \ +AC_CHECK_HEADERS(fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \ + sys/time.h sys/shm.h \ sys/scanio.h scsi.h sys/scsi.h sys/scsicmd.h sys/scsiio.h \ bsd/dev/scsireg.h scsi/sg.h /usr/src/linux/include/scsi/sg.h io/cam/cam.h \ camlib.h os2.h sys/socket.h sys/io.h asm/io.h gscdds.h sys/hw.h \ - sys/types.h sys/scsi/sgdefs.h sys/scsi/targets/scgio.h apollo/scsi.h) + sys/types.h sys/scsi/scsi.h sys/scsi/sgdefs.h sys/scsi/targets/scgio.h \ + apollo/scsi.h sys/sdi_comm.h sys/passthrudef.h linux/ppdev.h usb.h \ + sys/bitypes.h sys/sem.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -51,10 +113,13 @@ 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) +SANE_CHECK_U_TYPES +AC_MSG_CHECKING([for struct flock in fcntl.h]) +AC_EGREP_HEADER([struct flock], fcntl.h, [AC_MSG_RESULT(yes) ; + AC_DEFINE(HAVE_STRUCT_FLOCK, 1, + [Define if struct flock is available.])], AC_MSG_RESULT(no)) + if test "$ac_cv_header_sys_scsiio_h" = "yes" \ -a "$ac_cv_header_scsi_h" = "yes"; then @@ -62,16 +127,50 @@ then #include #include ],[scsireq_t req],, - AC_DEFINE(scsireq_t, struct scsireq_t)) + AC_DEFINE(scsireq_t, struct scsireq_t, + [Define scsireq_t as \`struct scsireq\' if necessary.])) fi -dnl Checks for libraries. +AC_MSG_CHECKING([for socklen_t in ]) +AC_TRY_COMPILE([ +#include +],[socklen_t len],AC_MSG_RESULT(yes), +[AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int, +[Define socklen_t as \`int\' if necessary.])]) -AC_CHECK_LIB(scsi, scsireq_enter) # FreeBSD needs this +SANE_V4L_VERSION + +dnl Checks for dll libraries: dl +if test "${enable_dynamic}" != "no"; then + AC_CHECK_HEADERS(dlfcn.h, + [AC_CHECK_LIB(dl,dlopen, DL_LIB=-ldl) + saved_LIBS="${LIBS}" + LIBS="${LIBS} ${DL_LIB}" + AC_CHECK_FUNCS(dlopen, enable_dynamic=yes,) + LIBS="${saved_LIBS}" + ],) + + # HP/UX DLL handling + AC_CHECK_HEADERS(dl.h, + [AC_CHECK_LIB(dld,shl_load, DL_LIB=-ldld) + saved_LIBS="${LIBS}" + LIBS="${LIBS} ${DL_LIB}" + AC_CHECK_FUNCS(shl_load, enable_dynamic=yes,) + LIBS="${saved_LIBS}" + ],) +fi +AC_SUBST(DL_LIB) + +dnl Checks for Backend libraries. AC_CHECK_LIB(m,sqrt) -AC_CHECK_LIB(intl,gettext) -AC_CHECK_LIB(syslog,syslog) # OS/2 needs this -AC_CHECK_LIB(jpeg,jpeg_start_decompress) +AC_CHECK_LIB(scsi, scsireq_enter) # FreeBSD needs this +AC_CHECK_LIB(cam, cam_open_device) # FreeBSD 3+ needs this +AC_CHECK_LIB(syslog, syslog) # OS/2 needs this +AC_CHECK_LIB(usb, usb_open) + +SANE_CHECK_JPEG + +SANE_CHECK_GPHOTO2 dnl IRIX sometimes has SYSVR3/4 network DSOs, but we do not need or want dnl to use them! @@ -80,80 +179,60 @@ if test "`uname`" != "IRIX" -a "`uname`" != "IRIX64"; then AC_CHECK_LIB(socket,socket) fi +dnl check for PTAL library (used in hp backend) +SANE_CHECK_PTAL + +dnl look for /dev/urandom +if test -c /dev/urandom ; then + AC_DEFINE(HAVE_DEV_URANDOM, 1, [Is /dev/urandom available?]) +fi + dnl Checks for library functions. -AM_FUNC_ALLOCA +AC_FUNC_ALLOCA AC_FUNC_MMAP AC_CHECK_FUNCS(atexit ioperm mkdir scsireq_enter sigprocmask \ strdup strndup strftime strstr strsep strtod snprintf \ - cfmakeraw tcsendbreak usleep strcasecmp strncasecmp _portaccess) + cfmakeraw tcsendbreak usleep strcasecmp strncasecmp _portaccess \ + getenv isfdtype vsyslog) + +SANE_LINKER_RPATH dnl initialize libtool +AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL -dnl Checks for libraries. -#### Choose a window system. - -AC_PATH_X -if test "$no_x" = yes; then - window_system=none -else - window_system=x11 -fi - -if test "${enable_dynamic}" != "no"; then - AC_CHECK_HEADERS(dlfcn.h, - [AC_CHECK_LIB(dl,dlopen) - AC_CHECK_FUNCS(dlopen, enable_dynamic=yes,)],) - - # HP/UX DLL handling - AC_CHECK_HEADERS(dl.h, - [AC_CHECK_LIB(dld,shl_load) - AC_CHECK_FUNCS(shl_load, enable_dynamic=yes,)],) -fi - -AM_PATH_GTK(0.99.13, HAVE_GTK=yes, ) - -# Change CFLAGS temporarily so that C_SWITCH_X_SITE gets used -# for the tests that follow. We set it back to REAL_CFLAGS later on. - -if test "${HAVE_GTK}" = "yes"; then - XSCAN="xscanimage xcam" - - # According to Owen Taylor, GTK_CFLAGS is _guaranteed_ to contain - # -D and -I flags only, i.e., it really is GTK_CPPFLAGS... - saved_CPPFLAGS="${CPPFLAGS}" - saved_LIBS="${LIBS}" - CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}" - LIBS="${LIBS} ${GTK_LIBS}" - - AC_CHECK_FUNCS(gtk_tooltips_set_tips gtk_events_pending) - if test "${ac_cv_func_gtk_events_pending}" = "no"; then - saved_CPPFLAGS="${saved_CPPFLAGS} -Dgtk_events_pending=gdk_events_pending" - fi - - AC_CHECK_HEADERS(libgimp/gimp.h,GIMP_LIBS="-lgimp") - - CPPFLAGS="${saved_CPPFLAGS}" - LIBS="${saved_LIBS}" -fi AC_SUBST(INCLUDES) -AC_SUBST(XSCAN) -AC_SUBST(GTK_CFLAGS) -AC_SUBST(GTK_LIBS) -AC_SUBST(GIMP_LIBS) CPPFLAGS="${CPPFLAGS} -DPATH_SANE_CONFIG_DIR=\$(configdir) \ -DPATH_SANE_DATA_DIR=\$(datadir) \ -DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR}" -if test "${ac_cv_header_jconfig_h}" = "no"; then - echo "disabling DC210 backend (failed to find JPEG library)" +if test "${sane_cv_use_libjpeg}" != "yes"; then + echo "disabling DC210/DC240 backends (failed to find JPEG library)" DC210= + DC240= + DJPEG= else - echo "enabling DC210 backend" + echo "enabling DC210/DC240 backends" DC210=dc210 + DC240=dc240 + DJPEG=djpeg fi AC_SUBST(DC210) +AC_SUBST(DC240) +AC_SUBST(DJPEG) + + +if test "${HAVE_GPHOTO2}" != "gphoto2" \ + -o "${sane_cv_use_libjpeg}" != "yes"; then + echo "disabling GPHOTO2 backend (failed to find gphoto2 or JPEG lib)" + GPHOTO2= +else + echo "enabling GPHOTO2 backend" + GPHOTO2=gphoto2 +fi +AC_SUBST(GPHOTO2) + if test "${ac_cv_header_sys_scanio_h}" = "no"; then echo "disabling PINT backend" PINT= @@ -172,6 +251,15 @@ else QCAM=qcam fi AC_SUBST(QCAM) +if test "${sane_v4l_version}" = "v4l" +then + echo "enabling Video4Linux backend" + V4L=v4l +else + echo "disabling Video4Linux backend" + V4L= +fi +AC_SUBST(V4L) if test "${ac_cv_header_sys_socket_h}" = "no"; then echo "disabling NET backend" NET= @@ -183,6 +271,24 @@ else fi AC_SUBST(NET) AC_SUBST(SANED) +if test "${ac_cv_header_usb_h}" = "no" \ + -o "${ac_cv_lib_usb_usb_open}" = "no"; then + echo "disabling SM3600 backend" + SM3600= +else + echo "enabling SM3600 backend" + SM3600=sm3600 +fi +AC_SUBST(SM3600) +if test "${ac_cv_header_sys_sem_h}" = "no" ; then + echo "disabling SnapScan backend" + SNAPSCAN= +else + echo "enabling SnapScan backend" + SNAPSCAN=snapscan +fi +AC_SUBST(SNAPSCAN) + if test "${enable_shared}" = "no"; then enable_preload=yes fi @@ -192,6 +298,34 @@ if test "${enable_dynamic}" != yes || test "${enable_preload}" = "yes"; then else DLL_PRELOAD="" fi + +AC_ARG_ENABLE(pnm-backend, + [ --enable-pnm-backend enable the pnm backend for testing frontends. Warning: + This will be a security risk if used together with saned. + See PROBLEMS file for details. [default=no]], + [PNM="pnm"], [PNM=""]) +AC_SUBST(PNM) + +AC_ARG_ENABLE(scsibuffersize, + [ --enable-scsibuffersize=N specify the default size (in bytes) of the buffer + for SCSI commands [default=131072]], + [set_scsibuffersize="$enableval"], [set_scsibuffersize=131072]) +AC_DEFINE_UNQUOTED(SCSIBUFFERSIZE, $set_scsibuffersize, + [SCSI command buffer size]) +echo "scsi buffersize: $set_scsibuffersize" + +AC_ARG_ENABLE(directio, + [ --enable-directio enable direct IO (Linux only; can lead to crashes + with backends using shared memory) [default=no]], + [ + if eval "test x$enable_directio = xyes"; then + CFLAGS="$CFLAGS -DENABLE_DIRECTIO" + fi + ]) + +AC_PATH_PROG(SANE_CONFIG_PATH, sane-config, no) +AC_CHECK_LIB(sane, sane_init, LIBSANE_EXISTS="yes") + AC_SUBST(V_MAJOR) AC_SUBST(V_MINOR) AC_SUBST(V_REV) @@ -199,7 +333,26 @@ AC_SUBST(DLL_PRELOAD) AC_OUTPUT([Makefile lib/Makefile sanei/Makefile frontend/Makefile japi/Makefile backend/Makefile include/Makefile doc/Makefile - tools/Makefile],) + testsuite/Makefile + tools/Makefile tools/sane-config],) + +if test "$SANE_CONFIG_PATH" != "no" ; then + SANE_INSTALLED_VERSION=`$SANE_CONFIG_PATH --version` + SANE_INSTALLED_PREFIX=`$SANE_CONFIG_PATH --prefix` + if test "$SANE_INSTALLED_PREFIX" != "$prefix" ; then + echo "*** WARNING: SANE is already installed (version $SANE_INSTALLED_VERSION). The old" + echo "*** installation is at $SANE_INSTALLED_PREFIX while SANE will now be installed" + echo "*** at $prefix. It is recommended to uninstall the old SANE version" + echo "*** before installing the new one to avoid problems." + fi +else + if test "$LIBSANE_EXISTS" = "yes" ; then + echo "*** Warning: An old version of SANE was detected but the sane-config program" + echo "*** couldn't be found. If you encounter any problems with SANE remove the old" + echo "*** SANE files and reinstall this version." + fi +fi + echo "****************************************************************" echo "* Please be sure to read file PROBLEMS in this directory *"