sane-project-backends/configure.in

463 wiersze
15 KiB
Plaintext

dnl Process this file with autoconf to produce a configure script. -*-m4-*-
dnl ***********************************************************************
dnl When preparing a release, increase the numeric and string version numbers,
dnl remove the "-cvs" suffix, and set is_release=yes
AC_INIT([sane-backends],[1.0.9-cvs],[sane-devel@mostang.com])
V_MAJOR=1
V_MINOR=0
V_REV=9
is_release=no
dnl ***********************************************************************
AC_CONFIG_HEADERS([include/sane/config.h])
AC_PREREQ(2.50)dnl dnl Minimum Autoconf version required.
AC_ARG_PROGRAM
PACKAGE=AC_PACKAGE_NAME
VERSION=AC_PACKAGE_VERSION
NUMBER_VERSION=${V_MAJOR}.${V_MINOR}.${V_REV}
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(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(V_MAJOR)
AC_SUBST(V_MINOR)
AC_SUBST(V_REV)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(NUMBER_VERSION)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl ***********************************************************************
dnl Checks for programs.
dnl ***********************************************************************
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PATH_PROG(SANE_CONFIG_PATH, sane-config, no)
AC_PATH_PROG(MSGFMT, msgfmt$EXEEXT, no)
AC_PATH_PROG(XGETTEXT, xgettext$EXEEXT, no)
AC_PATH_PROG(MSGMERGE, msgmerge$EXEEXT, no)
AC_SUBST(MSGFMT)
AC_SUBST(XGETTEXT)
AC_SUBST(MSGMERGE)
dnl ***********************************************************************
dnl set compiler/linker flags
dnl ***********************************************************************
INCLUDES="${INCLUDES} -I/usr/local/include"
AC_SUBST(INCLUDES)
SANE_SET_CFLAGS([$is_release])
SANE_SET_LDFLAGS
SANE_LINKER_RPATH
CPPFLAGS="${CPPFLAGS} -DPATH_SANE_CONFIG_DIR=\$(configdir) \
-DPATH_SANE_DATA_DIR=\$(datadir) \
-DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR}"
dnl ***********************************************************************
dnl Checks for unix variants
dnl ***********************************************************************
AC_GNU_SOURCE
AC_AIX
AC_MINIX
AC_ISC_POSIX
dnl ***********************************************************************
dnl Checks for libraries
dnl ***********************************************************************
SANE_CHECK_DLL_LIB
dnl Checks for Backend libraries.
AC_CHECK_LIB(m,sqrt)
AC_CHECK_LIB(scsi, scsireq_enter) # FreeBSD needs this
AC_CHECK_LIB(cam, cam_open_device) # FreeBSD 3+ needs this
dnl IRIX sometimes has SYSVR3/4 network DSOs, but we do not need or want
dnl to use them!
if test "`uname`" != "IRIX" -a "`uname`" != "IRIX64"; then
AC_CHECK_LIB(nsl, gethostbyaddr)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(syslog, syslog) # OS/2 needs this
fi
SANE_CHECK_JPEG
SANE_CHECK_IEEE1284
SANE_CHECK_GPHOTO2
dnl check sane to make sure we don't have two installations
AC_CHECK_LIB(sane, sane_init, LIBSANE_EXISTS="yes")
dnl ***********************************************************************
dnl Checks for header files.
dnl ***********************************************************************
AC_HEADER_STDC
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 gscdds.h sys/hw.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)
AC_CHECK_HEADERS([asm/io.h],,,[#include <sys/types.h>])
SANE_CHECK_MISSING_HEADERS
SANE_V4L_VERSION
dnl ***********************************************************************
dnl Checks for types and structures
dnl ***********************************************************************
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_CHECK_TYPE(ssize_t, long)
SANE_CHECK_U_TYPES
# from Python, check for "long long" type
AC_MSG_CHECKING(for long long support)
have_long_long=no
AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the long long type is available.]) have_long_long=yes)
AC_MSG_RESULT($have_long_long)
if test "$ac_cv_header_sys_scsiio_h" = "yes" \
-a "$ac_cv_header_scsi_h" = "yes";
then
AC_TRY_COMPILE([
#include <sys/scsiio.h>
#include <scsi.h>
],[scsireq_t req],,
AC_DEFINE(scsireq_t, struct scsireq_t,
[Define scsireq_t as \`struct scsireq\' if necessary.]))
fi
AC_MSG_CHECKING([for socklen_t in <sys/socket.h>])
AC_TRY_COMPILE([
#include <sys/socket.h>
],[socklen_t len],AC_MSG_RESULT(yes),
[AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int,
[Define socklen_t as \`int\' if necessary.])])
AC_MSG_CHECKING([for union semun in <sys/sem.h>])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
],[union semun test_semun],[AC_MSG_RESULT(yes);
AC_DEFINE(HAVE_UNION_SEMUN,1,[Define if union semun is available.])],
AC_MSG_RESULT(no))
AC_MSG_CHECKING([for sg_header.target_status in <scsi/sg.h>])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <scsi/sg.h>
],[
struct sg_header hdr;
hdr.target_status = 1;
return 0;
],[AC_MSG_RESULT(yes);
AC_DEFINE(HAVE_SG_TARGET_STATUS,1,[Define if sg_header.target_status is
available.])],
AC_MSG_RESULT(no))
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))
dnl ***********************************************************************
dnl Checks for compiler characteristics
dnl ***********************************************************************
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
dnl ***********************************************************************
dnl Checks for library functions
dnl ***********************************************************************
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_CHECK_FUNCS(atexit inet_addr inet_aton inet_ntoa ioperm mkdir \
scsireq_enter strftime strstr strtod \
cfmakeraw tcsendbreak strcasecmp strncasecmp _portaccess)
AC_REPLACE_FUNCS(getenv inet_ntop inet_pton isfdtype sigprocmask snprintf \
strdup strndup strsep usleep vsyslog)
if test "$ac_cv_header_os2_h" = "yes" ; then
AC_DEFINE(strncasecmp, strnicmp, [Define for OS/2 only])
AC_DEFINE(strcasecmp, stricmp, [Define for OS/2 only])
fi
dnl ***********************************************************************
dnl checks for system services
dnl ***********************************************************************
if test -c /dev/urandom ; then
AC_DEFINE(HAVE_DEV_URANDOM, 1, [Is /dev/urandom available?])
fi
dnl we need both libusb header and a libusb providing usb_get_busses
if test "${ac_cv_header_usb_h}" = "yes" ; then
AC_CHECK_LIB(usb, usb_get_busses)
if test "${ac_cv_lib_usb_usb_get_busses}" = "yes" ; then
HAVE_LIBUSB="yes"
fi
fi
dnl ***********************************************************************
dnl initialize libtool
dnl ***********************************************************************
AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
dnl ***********************************************************************
dnl enable/disable backends and features based on previous tests and user's
dnl choice
dnl ***********************************************************************
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/DC240 backends"
DC210=dc210
DC240=dc240
DJPEG=djpeg
fi
AC_SUBST(DC210)
AC_SUBST(DC240)
AC_SUBST(DJPEG)
if test "${sane_cv_use_libieee1284}" != "yes"
then
echo "disabling CANON_PP backend (failed to find required libieee1284 version)"
CANON_PP=
else
echo "enabling CANON_PP backend"
CANON_PP=canon_pp
fi
AC_SUBST(CANON_PP)
if test "${sane_cv_use_libieee1284}" != "yes"
then
echo "disabling HPSJ5S backend (failed to find required libieee1284 version)"
HPSJ5S=
else
echo "enabling HPSJ5S backend"
HPSJ5S=hpsj5s
fi
AC_SUBST(HPSJ5S)
if test "${HAVE_GPHOTO2}" != "gphoto2-config" \
-o "${sane_cv_use_libjpeg}" != "yes"; then
echo "disabling GPHOTO2 backend (not requested, or failed to find gphoto2-config 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=
else
echo "enabling PINT backend"
PINT=pint
fi
AC_SUBST(PINT)
if test "${ac_cv_func_ioperm}" = "no" \
&& test "${ac_cv_func__portaccess}" = "no"
then
echo "disabling QuickCam backend"
QCAM=
else
echo "enabling QuickCam backend"
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=
SANED=
else
echo "enabling NET backend"
NET=net
SANED=saned
fi
AC_SUBST(NET)
AC_SUBST(SANED)
if test "${HAVE_LIBUSB}" = "yes" ; then
echo "enabling SM3600 backend"
SM3600=sm3600
else
echo "disabling SM3600 backend"
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
if test "${enable_dynamic}" != yes || test "${enable_preload}" = "yes"; then
echo "preloading backends into DLL"
DLL_PRELOAD="\$(PRELOADABLE_BACKENDS)"
else
DLL_PRELOAD=""
fi
AC_SUBST(DLL_PRELOAD)
AC_ARG_ENABLE(pnm-backend,
AC_HELP_STRING([--enable-pnm-backend],
[enable the pnm backend for testing frontends (possible
security risk, see PROBLEMS file)]),
[PNM="pnm"], [PNM=""])
AC_SUBST(PNM)
AC_ARG_ENABLE(scsibuffersize,
AC_HELP_STRING([--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(scsi-directio,
AC_HELP_STRING([--enable-scsi-directio],
[enable SCSI direct IO (Linux only, dangerous, see
README.linux)]),
[
if eval "test x$enable_scsi_directio = xyes"; then
CFLAGS="$CFLAGS -DENABLE_SCSI_DIRECTIO"
fi
])
AC_ARG_ENABLE(parport-directio,
AC_HELP_STRING([--enable-parport-directio],
[enable direct hardware access to the parallel port, so
frontends will require special permission level]),
[
if eval "test x$enable_parport_directio = xyes"; then
CFLAGS="$CFLAGS -DENABLE_PARPORT_DIRECTIO"
fi
])
AC_ARG_ENABLE(translations,
AC_HELP_STRING([--disable-translations],
[don't install translations of backend options]),
[
if eval "test x$enable_translations = xno"; then
INSTALL_TRANSLATIONS=
else
INSTALL_TRANSLATIONS=install-translations
fi
],
INSTALL_TRANSLATIONS=install-translations
)
if eval "test x$INSTALL_TRANSLATIONS = xinstall-translations" ; then
if test x$MSGFMT = xno || test x$XGETTEXT = xno || test $MSGMERGE = no ; then
INSTALL_TRANSLATIONS=
echo "disabling translations (missing msgfmt, xgettext or msgmerge)"
else
echo "enabling translations"
fi
else
echo "disabling translations"
fi
AC_SUBST(INSTALL_TRANSLATIONS)
AC_ARG_ENABLE(local-backends,
AC_HELP_STRING([--disable-local-backends],
[turn off compilation of all backends but net]),
[
if eval "test x$enable_local_backends = xno"; then
SELECTED_BACKENDS="net"
fi
],
,
)
AC_SUBST(SELECTED_BACKENDS)
dnl ***********************************************************************
dnl Write output files
dnl ***********************************************************************
DISTCLEAN_FILES="*~ .*~ *.log *.bak *.old *.orig *.out *.rej \"\#\"* \".\\#\"*"
AC_SUBST(DISTCLEAN_FILES)
AC_CONFIG_FILES([Makefile lib/Makefile sanei/Makefile frontend/Makefile
japi/Makefile backend/Makefile include/Makefile doc/Makefile
po/Makefile testsuite/Makefile tools/Makefile])
AC_CONFIG_FILES([tools/sane-desc.el])
AC_CONFIG_FILES([tools/sane-config], [chmod a+x tools/sane-config])
AC_OUTPUT
dnl ***********************************************************************
dnl print configuration information
dnl ***********************************************************************
echo "Variables used for compilation/linking:"
echo using CPPFLAGS=\"${CPPFLAGS}\"
echo using CFLAGS=\"${CFLAGS}\"
echo using LDFLAGS=\"${LDFLAGS}\"
echo using LIBS=\"${LIBS}\"
echo "Installation directories:"
echo "Configuration: `eval eval echo ${sysconfdir}`"
echo "Libraries: `eval eval echo ${libdir}`"
echo "Binaries: `eval eval echo ${bindir}` and `eval eval echo ${sbindir}`"
echo "Manpages: `eval eval echo ${mandir}`"
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
if eval "test x${sysconfdir} = x/usr/etc" ; then
echo "*** WARNING: Configuration files are stored in /usr/etc. If this is not"
echo "*** intended, use --sysconfdir to set another path (e.g. "/etc")."
fi
if test "$SELECTED_BACKENDS" != "" ; then
echo "*** Warning: Local backends have been disabled. This means that scanners"
echo "*** connected to your local computer won't be supported. Only a network"
echo "*** connection to a remote host is possible."
fi
echo "****************************************************************"
echo "* Please be sure to read file PROBLEMS in this directory *"
echo "* BEFORE running any of the SANE applications. Some devices *"
echo "* may be damaged by inproper operation, so please do heed this *"
echo "* advice. *"
echo "****************************************************************"