1dnl 2dnl Contains the following macros 3dnl SANE_SET_AM_CFLAGS(is_release) 4dnl SANE_CHECK_MISSING_HEADERS 5dnl SANE_SET_AM_LDFLAGS 6dnl SANE_CHECK_DLL_LIB 7dnl SANE_EXTRACT_LDFLAGS(LIBS, LDFLAGS) 8dnl SANE_CHECK_JPEG 9dnl SANE_CHECK_IEEE1284 10dnl SANE_CHECK_PTHREAD 11dnl SANE_CHECK_LOCKING 12dnl JAPHAR_GREP_AM_CFLAGS(flag, cmd_if_missing, cmd_if_present) 13dnl SANE_CHECK_U_TYPES 14dnl SANE_CHECK_GPHOTO2 15dnl SANE_CHECK_IPV6 16dnl SANE_CHECK_BACKENDS 17dnl SANE_PROTOTYPES 18dnl AC_PROG_LIBTOOL 19dnl 20 21# SANE_SET_AM_CFLAGS(is_release) 22# Set default AM_CFLAGS if gcc is used. Enable/disable additional 23# compilation warnings. The extra warnings are enabled by default 24# during the development cycle but disabled for official releases. 25# The argument is_release is either yes or no. 26AC_DEFUN([SANE_SET_AM_CFLAGS], 27[ 28if test "${ac_cv_c_compiler_gnu}" = "yes"; then 29 DEFAULT_WARNINGS="\ 30 -Wall" 31 EXTRA_WARNINGS="\ 32 -Wextra \ 33 -pedantic" 34 35 for flag in $DEFAULT_WARNINGS; do 36 JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ]) 37 JAPHAR_GREP_AM_CXXFLAGS($flag, [ AM_CXXFLAGS="$AM_CXXFLAGS $flag" ]) 38 done 39 40 AC_ARG_ENABLE(warnings, 41 AS_HELP_STRING([--enable-warnings], 42 [turn on tons of compiler warnings (GCC only)]), 43 [ 44 if eval "test x$enable_warnings = xyes"; then 45 for flag in $EXTRA_WARNINGS; do 46 JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ]) 47 JAPHAR_GREP_AM_CXXFLAGS($flag, [ AM_CXXFLAGS="$AM_CXXFLAGS $flag" ]) 48 done 49 fi 50 ], 51 [if test x$1 = xno; then 52 # Warnings enabled by default (development) 53 for flag in $EXTRA_WARNINGS; do 54 JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ]) 55 JAPHAR_GREP_AM_CXXFLAGS($flag, [ AM_CXXFLAGS="$AM_CXXFLAGS $flag" ]) 56 done 57 fi]) 58fi # ac_cv_c_compiler_gnu 59]) 60 61dnl SANE_CHECK_MISSING_HEADERS 62dnl Do some sanity checks. It doesn't make sense to proceed if those headers 63dnl aren't present. 64AC_DEFUN([SANE_CHECK_MISSING_HEADERS], 65[ 66 MISSING_HEADERS= 67 if test "${ac_cv_header_fcntl_h}" != "yes" ; then 68 MISSING_HEADERS="${MISSING_HEADERS}\"fcntl.h\" " 69 fi 70 if test "${ac_cv_header_sys_time_h}" != "yes" ; then 71 MISSING_HEADERS="${MISSING_HEADERS}\"sys/time.h\" " 72 fi 73 if test "${ac_cv_header_unistd_h}" != "yes" ; then 74 MISSING_HEADERS="${MISSING_HEADERS}\"unistd.h\" " 75 fi 76 if test "${MISSING_HEADERS}" != "" ; then 77 echo "*** The following essential header files couldn't be found:" 78 echo "*** ${MISSING_HEADERS}" 79 echo "*** Maybe the compiler isn't ANSI C compliant or not properly installed?" 80 echo "*** For details on what went wrong see config.log." 81 AC_MSG_ERROR([Exiting now.]) 82 fi 83]) 84 85# SANE_SET_AM_LDFLAGS 86# Add special AM_LDFLAGS 87AC_DEFUN([SANE_SET_AM_LDFLAGS], 88[ 89 # Define stricter linking policy on GNU systems. This is not 90 # added to global LDFLAGS because we may want to create convenience 91 # libraries that don't require such strick linking. 92 if test "$GCC" = yes; then 93 case ${host_os} in 94 linux* | solaris*) 95 STRICT_LDFLAGS="-Wl,-z,defs" 96 ;; 97 esac 98 fi 99 AC_SUBST(STRICT_LDFLAGS) 100 case "${host_os}" in 101 aix*) #enable .so libraries, disable archives 102 AM_LDFLAGS="$AM_LDFLAGS -Wl,-brtl" 103 ;; 104 darwin*) #include frameworks 105 LIBS="$LIBS -framework CoreFoundation -framework IOKit" 106 ;; 107 esac 108]) 109 110# SANE_CHECK_DLL_LIB 111# Find dll library 112AC_DEFUN([SANE_CHECK_DLL_LIB], 113[ 114 dnl Checks for dll libraries: dl 115 DL_LIBS="" 116 if test "${enable_dynamic}" = "auto"; then 117 # default to disabled unless library found. 118 enable_dynamic=no 119 # dlopen 120 AC_CHECK_HEADERS(dlfcn.h, 121 [AC_CHECK_LIB(dl, dlopen, DL_LIBS=-ldl) 122 saved_LIBS="${LIBS}" 123 LIBS="${LIBS} ${DL_LIBS}" 124 AC_CHECK_FUNCS(dlopen, enable_dynamic=yes,) 125 LIBS="${saved_LIBS}" 126 ],) 127 # HP/UX DLL handling 128 AC_CHECK_HEADERS(dl.h, 129 [AC_CHECK_LIB(dld,shl_load, DL_LIBS=-ldld) 130 saved_LIBS="${LIBS}" 131 LIBS="${LIBS} ${DL_LIBS}" 132 AC_CHECK_FUNCS(shl_load, enable_dynamic=yes,) 133 LIBS="${saved_LIBS}" 134 ],) 135 if test -z "$DL_LIBS" ; then 136 # old Mac OS X/Darwin (without dlopen) 137 AC_CHECK_HEADERS(mach-o/dyld.h, 138 [AC_CHECK_FUNCS(NSLinkModule, enable_dynamic=yes,) 139 ],) 140 fi 141 fi 142 AC_SUBST(DL_LIBS) 143 144 DYNAMIC_FLAG= 145 if test "${enable_dynamic}" = yes ; then 146 DYNAMIC_FLAG=-module 147 fi 148 AC_SUBST(DYNAMIC_FLAG) 149]) 150 151# 152# Separate LIBS from LDFLAGS to link correctly on HP/UX (and other 153# platforms who care about the order of params to ld. It removes all 154# non '-l..'-params from passed in $1(LIBS), and appends them to $2(LDFLAGS). 155# 156# Use like this: SANE_EXTRACT_LDFLAGS(PKGNAME_LIBS, PKGNAME_LDFLAGS) 157 AC_DEFUN([SANE_EXTRACT_LDFLAGS], 158[ 159 tmp_LIBS="" 160 for param in ${$1}; do 161 case "${param}" in 162 -l*) 163 tmp_LIBS="${tmp_LIBS} ${param}" 164 ;; 165 *) 166 $2="${$2} ${param}" 167 ;; 168 esac 169 done 170 $1="${tmp_LIBS}" 171 unset tmp_LIBS 172 unset param 173]) 174 175# 176# 177# Checks for ieee1284 library, needed for canon_pp backend. 178AC_DEFUN([SANE_CHECK_IEEE1284], 179[ 180 AC_CHECK_HEADER(ieee1284.h, [ 181 AC_CACHE_CHECK([for libieee1284 >= 0.1.5], sane_cv_use_libieee1284, [ 182 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ieee1284.h>]], [[ 183 struct parport p; char *buf; 184 ieee1284_nibble_read(&p, 0, buf, 1); 185 ]])], 186 [sane_cv_use_libieee1284="yes"; IEEE1284_LIBS="-lieee1284" 187 ],[sane_cv_use_libieee1284="no"]) 188 ],) 189 ],) 190 if test "$sane_cv_use_libieee1284" = "yes" ; then 191 AC_DEFINE(HAVE_LIBIEEE1284,1,[Define to 1 if you have the `ieee1284' library (-lcam).]) 192 fi 193 AC_SUBST(IEEE1284_LIBS) 194]) 195 196# 197# Checks for pthread support 198AC_DEFUN([SANE_CHECK_PTHREAD], 199[ 200 201 case "${host_os}" in 202 linux* | darwin* | mingw*) # enabled by default on Linux, MacOS X and MINGW 203 use_pthread=yes 204 ;; 205 *) 206 use_pthread=no 207 esac 208 have_pthread=no 209 210 # 211 # now that we have the systems preferences, we check 212 # the user 213 214 AC_ARG_ENABLE([pthread], 215 AS_HELP_STRING([--enable-pthread], 216 [use pthread instead of fork (default=yes for Linux/MacOS X/MINGW, no for everything else)]), 217 [ 218 if test $enableval = yes ; then 219 use_pthread=yes 220 else 221 use_pthread=no 222 fi 223 ]) 224 225 if test $use_pthread = yes ; then 226 AC_CHECK_HEADERS(pthread.h, 227 [ 228 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS="-lpthread") 229 have_pthread=yes 230 save_LIBS="$LIBS" 231 LIBS="$LIBS $PTHREAD_LIBS" 232 AC_CHECK_FUNCS([pthread_create pthread_kill pthread_join pthread_detach pthread_cancel pthread_testcancel], 233 ,[ have_pthread=no; use_pthread=no ]) 234 LIBS="$save_LIBS" 235 ],[ have_pthread=no; use_pthread=no ]) 236 fi 237 238 # Based on a similar test for pthread_key_t from the Python project. 239 # See https://bugs.python.org/review/25658/patch/19209/75870 240 AC_MSG_CHECKING(whether pthread_t is integer) 241 AC_COMPILE_IFELSE( 242 [AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t k; k * 1;]])], 243 [ac_pthread_t_is_integer=yes], 244 [ac_pthread_t_is_integer=no] 245 ) 246 AC_MSG_RESULT($ac_pthread_t_is_integer) 247 if test "$ac_pthread_t_is_integer" = yes ; then 248 AC_DEFINE(PTHREAD_T_IS_INTEGER, 1, 249 [Define if pthread_t is integer.]) 250 else 251 # Until the sanei_thread implementation is fixed. 252 use_pthread=no 253 fi 254 255 if test "$have_pthread" = "yes" ; then 256 AM_CPPFLAGS="${AM_CPPFLAGS} -D_REENTRANT" 257 fi 258 AC_SUBST(PTHREAD_LIBS) 259 260 if test $use_pthread = yes ; then 261 AC_DEFINE_UNQUOTED(USE_PTHREAD, "$use_pthread", 262 [Define if pthreads should be used instead of forked processes.]) 263 SANEI_THREAD_LIBS=$PTHREAD_LIBS 264 else 265 SANEI_THREAD_LIBS="" 266 fi 267 AC_SUBST(SANEI_THREAD_LIBS) 268 AC_MSG_CHECKING([whether to enable pthread support]) 269 AC_MSG_RESULT([$have_pthread]) 270 AC_MSG_CHECKING([whether to use pthread instead of fork]) 271 AC_MSG_RESULT([$use_pthread]) 272]) 273 274# 275# Checks for jpeg library >= v6B (61), needed for DC210, DC240, 276# GPHOTO2 and dell1600n_net backends. 277AC_DEFUN([SANE_CHECK_JPEG], 278[ 279 AC_CHECK_LIB(jpeg,jpeg_start_decompress, 280 [ 281 AC_CHECK_HEADER(jconfig.h, 282 [ 283 AC_MSG_CHECKING([for jpeglib - version >= 61 (6a)]) 284 AC_EGREP_CPP(sane_correct_jpeg_lib_version_found, 285 [ 286 #include <jpeglib.h> 287 #if JPEG_LIB_VERSION >= 61 288 sane_correct_jpeg_lib_version_found 289 #endif 290 ], [sane_cv_use_libjpeg="yes"; JPEG_LIBS="-ljpeg"; 291 AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) 292 ],) 293 ],) 294 if test "$sane_cv_use_libjpeg" = "yes" ; then 295 AC_DEFINE(HAVE_LIBJPEG,1,[Define to 1 if you have the libjpeg library.]) 296 fi 297 AC_SUBST(JPEG_LIBS) 298]) 299 300# Checks for tiff library dell1600n_net backend. 301AC_DEFUN([SANE_CHECK_TIFF], 302[ 303 AC_CHECK_LIB(tiff,TIFFFdOpen, 304 [ 305 AC_CHECK_HEADER(tiffio.h, 306 [sane_cv_use_libtiff="yes"; TIFF_LIBS="-ltiff"],) 307 ],) 308 AC_SUBST(TIFF_LIBS) 309]) 310 311AC_DEFUN([SANE_CHECK_PNG], 312[ 313 AC_CHECK_LIB(png,png_init_io, 314 [ 315 AC_CHECK_HEADER(png.h, 316 [sane_cv_use_libpng="yes"; PNG_LIBS="-lpng"],) 317 ],) 318 if test "$sane_cv_use_libpng" = "yes" ; then 319 AC_DEFINE(HAVE_LIBPNG,1,[Define to 1 if you have the libpng library.]) 320 fi 321 AC_SUBST(PNG_LIBS) 322]) 323 324# 325# Checks for pthread support 326AC_DEFUN([SANE_CHECK_LOCKING], 327[ 328 LOCKPATH_GROUP=uucp 329 use_locking=yes 330 case "${host_os}" in 331 os2* ) 332 use_locking=no 333 ;; 334 esac 335 336 # 337 # we check the user 338 AC_ARG_ENABLE( [locking], 339 AS_HELP_STRING([--enable-locking], 340 [activate device locking (default=yes, but only used by some backends)]), 341 [ 342 if test $enableval = yes ; then 343 use_locking=yes 344 else 345 use_locking=no 346 fi 347 ]) 348 if test $use_locking = yes ; then 349 AC_ARG_WITH([group], 350 AS_HELP_STRING([--with-group], 351 [use the specified group for lock dir @<:@default=uucp@:>@]), 352 [LOCKPATH_GROUP="$withval"] 353 ) 354 # check if the group does exist 355 lasterror="" 356 touch sanetest.file 357 chgrp $LOCKPATH_GROUP sanetest.file 2>/dev/null || lasterror=$? 358 rm -f sanetest.file 359 if test ! -z "$lasterror"; then 360 AC_MSG_WARN([Group $LOCKPATH_GROUP does not exist on this system.]) 361 AC_MSG_WARN([Locking feature will be disabled.]) 362 use_locking=no 363 fi 364 fi 365 if test $use_locking = yes ; then 366 INSTALL_LOCKPATH=install-lockpath 367 AC_DEFINE([ENABLE_LOCKING], 1, 368 [Define to 1 if device locking should be enabled.]) 369 else 370 INSTALL_LOCKPATH= 371 fi 372 AC_MSG_CHECKING([whether to enable device locking]) 373 AC_MSG_RESULT([$use_locking]) 374 if test $use_locking = yes ; then 375 AC_MSG_NOTICE([Setting lockdir group to $LOCKPATH_GROUP]) 376 fi 377 AC_SUBST(INSTALL_LOCKPATH) 378 AC_SUBST(LOCKPATH_GROUP) 379]) 380 381dnl 382dnl JAPHAR_GREP_AM_CFLAGS(flag, cmd_if_missing, cmd_if_present) 383dnl 384dnl From Japhar. Report changes to japhar@hungry.com 385dnl 386AC_DEFUN([JAPHAR_GREP_AM_CFLAGS], 387[case "$AM_CFLAGS" in 388"$1" | "$1 "* | *" $1" | *" $1 "* ) 389 ifelse($#, 3, [$3], [:]) 390 ;; 391*) 392 $2 393 ;; 394esac 395]) 396 397dnl 398dnl JAPHAR_GREP_AM_CXXFLAGS(flag, cmd_if_missing, cmd_if_present) 399dnl 400AC_DEFUN([JAPHAR_GREP_AM_CXXFLAGS], 401[case "$AM_CXXFLAGS" in 402"$1" | "$1 "* | *" $1" | *" $1 "* ) 403 ifelse($#, 3, [$3], [:]) 404 ;; 405*) 406 $2 407 ;; 408esac 409]) 410 411dnl 412dnl SANE_CHECK_U_TYPES 413dnl 414AC_DEFUN([SANE_CHECK_U_TYPES], 415[ 416dnl Use new style of check types that doesn't take default to use. 417dnl The old style would add an #undef of the type check on platforms 418dnl that defined that type... That is not portable to platform that 419dnl define it as a #define. 420AC_CHECK_TYPES([u_char, u_short, u_int, u_long],,,) 421]) 422 423# 424# Checks for gphoto2 libs, needed by gphoto2 backend 425AC_DEFUN([SANE_CHECK_GPHOTO2], 426[ 427 AC_ARG_WITH(gphoto2, 428 AS_HELP_STRING([--with-gphoto2], 429 [include the gphoto2 backend @<:@default=yes@:>@]), 430 [# If --with-gphoto2=no or --without-gphoto2, disable backend 431 # as "$with_gphoto2" will be set to "no"]) 432 433 # If --with-gphoto2=yes (or not supplied), first check if 434 # pkg-config exists, then use it to check if libgphoto2 is 435 # present. If all that works, then see if we can actually link 436 # a program. And, if that works, then add the -l flags to 437 # GPHOTO2_LIBS and any other flags to GPHOTO2_LDFLAGS to pass to 438 # sane-config. 439 if test "$with_gphoto2" != "no" ; then 440 AC_CHECK_TOOL(HAVE_GPHOTO2, pkg-config, false) 441 442 if test ${HAVE_GPHOTO2} != "false" ; then 443 if pkg-config --exists libgphoto2 ; then 444 with_gphoto2="`pkg-config --modversion libgphoto2`" 445 GPHOTO2_CPPFLAGS="`pkg-config --cflags libgphoto2`" 446 GPHOTO2_LIBS="`pkg-config --libs libgphoto2`" 447 448 saved_CPPFLAGS="${CPPFLAGS}" 449 CPPFLAGS="${GPHOTO2_CPPFLAGS}" 450 saved_LIBS="${LIBS}" 451 LIBS="${LIBS} ${GPHOTO2_LIBS}" 452 # Make sure we an really use the library 453 AC_CHECK_FUNCS(gp_camera_init, HAVE_GPHOTO2=true, HAVE_GPHOTO2=false) 454 if test "${HAVE_GPHOTO2}" = "true"; then 455 AC_CHECK_FUNCS(gp_port_info_get_path) 456 fi 457 CPPFLAGS="${saved_CPPFLAGS}" 458 LIBS="${saved_LIBS}" 459 else 460 HAVE_GPHOTO2=false 461 fi 462 if test "${HAVE_GPHOTO2}" = "false"; then 463 GPHOTO2_CPPFLAGS="" 464 GPHOTO2_LIBS="" 465 else 466 SANE_EXTRACT_LDFLAGS(GPHOTO2_LIBS, GPHOTO2_LDFLAGS) 467 if pkg-config --atleast-version=2.5.0 libgphoto2; then 468 AC_DEFINE([GPLOGFUNC_NO_VARGS], [1], 469 [Define if GPLogFunc does not take a va_list.]) 470 fi 471 fi 472 fi 473 fi 474 AC_SUBST(GPHOTO2_CPPFLAGS) 475 AC_SUBST(GPHOTO2_LIBS) 476 AC_SUBST(GPHOTO2_LDFLAGS) 477]) 478 479# 480# Check for AF_INET6, determines whether or not to enable IPv6 support 481# Check for ss_family member in struct sockaddr_storage 482AC_DEFUN([SANE_CHECK_IPV6], 483[ 484 AC_MSG_CHECKING([whether to enable IPv6]) 485 AC_ARG_ENABLE(ipv6, 486 AS_HELP_STRING([--disable-ipv6],[disable IPv6 support]), 487 [ if test "$enableval" = "no" ; then 488 AC_MSG_RESULT([no, manually disabled]) 489 ipv6=no 490 fi 491 ]) 492 493 if test "$ipv6" != "no" ; then 494 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 495 #define INET6 496 #include <sys/types.h> 497 #include <sys/socket.h> ]], [[ 498 /* AF_INET6 available check */ 499 if (socket(AF_INET6, SOCK_STREAM, 0) < 0) 500 exit(1); 501 else 502 exit(0); 503 ]])],[ 504 AC_MSG_RESULT(yes) 505 AC_DEFINE([ENABLE_IPV6], 1, [Define to 1 if the system supports IPv6]) 506 ipv6=yes 507 ],[ 508 AC_MSG_RESULT([no (couldn't compile test program)]) 509 ipv6=no 510 ]) 511 fi 512 513 if test "$ipv6" != "no" ; then 514 AC_MSG_CHECKING([whether struct sockaddr_storage has an ss_family member]) 515 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 516 #define INET6 517 #include <sys/types.h> 518 #include <sys/socket.h> ]], [[ 519 /* test if the ss_family member exists in struct sockaddr_storage */ 520 struct sockaddr_storage ss; 521 ss.ss_family = AF_INET; 522 exit (0); 523 ]])], [ 524 AC_MSG_RESULT(yes) 525 AC_DEFINE([HAS_SS_FAMILY], 1, [Define to 1 if struct sockaddr_storage has an ss_family member]) 526 ], [ 527 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 528 #define INET6 529 #include <sys/types.h> 530 #include <sys/socket.h> ]], [[ 531 /* test if the __ss_family member exists in struct sockaddr_storage */ 532 struct sockaddr_storage ss; 533 ss.__ss_family = AF_INET; 534 exit (0); 535 ]])], [ 536 AC_MSG_RESULT([no, but __ss_family exists]) 537 AC_DEFINE([HAS___SS_FAMILY], 1, [Define to 1 if struct sockaddr_storage has __ss_family instead of ss_family]) 538 ], [ 539 AC_MSG_RESULT([no]) 540 ipv6=no 541 ]) 542 ]) 543 fi 544]) 545 546# 547# Verifies that values in $BACKENDS and updates FILTERED_BACKEND 548# with either backends that can be compiled or fails the script. 549AC_DEFUN([SANE_CHECK_BACKENDS], 550[ 551if test "${user_selected_backends}" = "yes"; then 552 DISABLE_MSG="aborting" 553else 554 DISABLE_MSG="disabling" 555fi 556 557FILTERED_BACKENDS="" 558for be in ${BACKENDS}; do 559 backend_supported="yes" 560 case $be in 561 plustek_pp) 562 case "$host_os" in 563 gnu*) 564 echo "*** $be backend not supported on GNU/Hurd - $DISABLE_MSG" 565 backend_supported="no" 566 ;; 567 esac 568 ;; 569 570 dc210|dc240|pixma) 571 if test "${sane_cv_use_libjpeg}" != "yes"; then 572 echo "*** $be backend requires JPEG library - $DISABLE_MSG" 573 backend_supported="no" 574 fi 575 ;; 576 577 canon_pp|hpsj5s) 578 if test "${sane_cv_use_libieee1284}" != "yes"; then 579 echo "*** $be backend requires libieee1284 library - $DISABLE_MSG" 580 backend_supported="no" 581 fi 582 ;; 583 584 genesys) 585 if test "${HAVE_CXX11}" != "1"; then 586 echo "*** $be backend requires C++11 support - $DISABLE_MSG" 587 backend_supported="no" 588 fi 589 ;; 590 591 mustek_pp) 592 if test "${sane_cv_use_libieee1284}" != "yes" && test "${enable_parport_directio}" != "yes"; then 593 echo "*** $be backend requires libieee1284 or parport-directio libraries - $DISABLE_MSG" 594 backend_supported="no" 595 fi 596 ;; 597 598 dell1600n_net) 599 if test "${sane_cv_use_libjpeg}" != "yes" || test "${sane_cv_use_libtiff}" != "yes"; then 600 echo "*** $be backend requires JPEG and TIFF library - $DISABLE_MSG" 601 backend_supported="no" 602 fi 603 ;; 604 605 epsonds) 606 if test "${sane_cv_use_libjpeg}" != "yes"; then 607 echo "*** $be backend requires JPEG library - $DISABLE_MSG" 608 backend_supported="no" 609 fi 610 ;; 611 612 escl) 613 if test "x${with_avahi}" != "xyes"; then 614 echo "*** $be backend requires AVAHI library - $DISABLE_MSG" 615 backend_supported="no" 616 fi 617 if test "x${with_libcurl}" != "xyes"; then 618 echo "*** $be backend requires cURL library - $DISABLE_MSG" 619 backend_supported="no" 620 fi 621 if test "x${have_libxml}" != "xyes"; then 622 echo "*** $be backend requires XML library - $DISABLE_MSG" 623 backend_supported="no" 624 fi 625 # FIXME: Remove when PNG and/or PDF support have been added. 626 if test "x${sane_cv_use_libjpeg}" != "xyes"; then 627 echo "*** $be backend currently requires JPEG library - $DISABLE_MSG" 628 backend_supported="no" 629 else 630 if test "x${ac_cv_func_jpeg_crop_scanline}" != "xyes" \ 631 || test "x${ac_cv_func_jpeg_skip_scanlines}" != "xyes"; then 632 echo "*** $be backend requires a newer JPEG library - $DISABLE_MSG" 633 backend_supported="no" 634 fi 635 fi 636 637 ;; 638 639 gphoto2) 640 if test "${HAVE_GPHOTO2}" != "true" \ 641 || test "${sane_cv_use_libjpeg}" != "yes"; then 642 echo "*** $be backend requires gphoto2 and JPEG libraries - $DISABLE_MSG" 643 backend_supported="no" 644 fi 645 ;; 646 647 pint) 648 if test "${ac_cv_header_sys_scanio_h}" = "no"; then 649 echo "*** $be backend requires sys/scanio.h - $DISABLE_MSG" 650 backend_supported="no" 651 fi 652 ;; 653 654 qcam) 655 if ( test "${ac_cv_func_ioperm}" = "no" || test "${sane_cv_have_sys_io_h_with_inb_outb}" = "no" )\ 656 && test "${ac_cv_func__portaccess}" = "no"; then 657 echo "*** $be backend requires (ioperm, inb and outb) or portaccess functions - $DISABLE_MSG" 658 backend_supported="no" 659 fi 660 ;; 661 662 v4l) 663 if test "${have_linux_ioctl_defines}" != "yes" \ 664 || test "${have_libv4l1}" != "yes"; then 665 echo "*** $be backend requires v4l libraries - $DISABLE_MSG" 666 backend_supported="no" 667 fi 668 ;; 669 670 net) 671 if test "${ac_cv_header_sys_socket_h}" = "no"; then 672 echo "*** $be backend requires sys/socket.h - $DISABLE_MSG" 673 backend_supported="no" 674 fi 675 ;; 676 677 mustek_usb2|kvs40xx) 678 if test "${have_pthread}" != "yes"; then 679 echo "*** $be backend requires pthread library - $DISABLE_MSG" 680 backend_supported="no" 681 fi 682 ;; 683 esac 684 if test "${backend_supported}" = "no"; then 685 if test "${user_selected_backends}" = "yes"; then 686 exit 1 687 fi 688 else 689 FILTERED_BACKENDS="${FILTERED_BACKENDS} $be" 690 fi 691done 692]) 693 694# 695# Generate prototypes for functions not available on the system 696AC_DEFUN([SANE_PROTOTYPES], 697[ 698AH_BOTTOM([ 699 700#if defined(__MINGW32__) 701#define _BSDTYPES_DEFINED 702#endif 703 704#ifndef HAVE_U_CHAR 705#define u_char unsigned char 706#endif 707#ifndef HAVE_U_SHORT 708#define u_short unsigned short 709#endif 710#ifndef HAVE_U_INT 711#define u_int unsigned int 712#endif 713#ifndef HAVE_U_LONG 714#define u_long unsigned long 715#endif 716 717/* Prototype for getenv */ 718#ifndef HAVE_GETENV 719#define getenv sanei_getenv 720char * getenv(const char *name); 721#endif 722 723/* Prototype for inet_ntop */ 724#ifndef HAVE_INET_NTOP 725#define inet_ntop sanei_inet_ntop 726#include <sys/types.h> 727const char * inet_ntop (int af, const void *src, char *dst, size_t cnt); 728#endif 729 730/* Prototype for inet_pton */ 731#ifndef HAVE_INET_PTON 732#define inet_pton sanei_inet_pton 733int inet_pton (int af, const char *src, void *dst); 734#endif 735 736/* Prototype for sigprocmask */ 737#ifndef HAVE_SIGPROCMASK 738#define sigprocmask sanei_sigprocmask 739int sigprocmask (int how, int *new, int *old); 740#endif 741 742/* Prototype for snprintf */ 743#ifndef HAVE_SNPRINTF 744#define snprintf sanei_snprintf 745#include <sys/types.h> 746int snprintf (char *str,size_t count,const char *fmt,...); 747#endif 748 749/* Prototype for strcasestr */ 750#ifndef HAVE_STRCASESTR 751#define strcasestr sanei_strcasestr 752char * strcasestr (const char *phaystack, const char *pneedle); 753#endif 754 755/* Prototype for strdup */ 756#ifndef HAVE_STRDUP 757#define strdup sanei_strdup 758char *strdup (const char * s); 759#endif 760 761/* Prototype for strndup */ 762#ifndef HAVE_STRNDUP 763#define strndup sanei_strndup 764#include <sys/types.h> 765char *strndup(const char * s, size_t n); 766#endif 767 768/* Prototype for strsep */ 769#ifndef HAVE_STRSEP 770#define strsep sanei_strsep 771char *strsep(char **stringp, const char *delim); 772#endif 773 774/* Prototype for usleep */ 775#ifndef HAVE_USLEEP 776#define usleep sanei_usleep 777unsigned int usleep (unsigned int useconds); 778#endif 779 780/* Prototype for vsyslog */ 781#ifndef HAVE_VSYSLOG 782#include <stdarg.h> 783void vsyslog(int priority, const char *format, va_list args); 784#endif 785]) 786]) 787 788m4_include([m4/byteorder.m4]) 789