sane-project-backends/configure.in

403 wiersze
12 KiB
Bash

dnl Process this file with autoconf to produce a configure script. -*-sh-*-
AC_INIT(include/sane/sane.h)
AC_CONFIG_HEADER(include/sane/config.h)
AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required.
AC_ARG_PROGRAM
# version code:
V_MAJOR=1
V_MINOR=0
V_REV=7
V_EXTRA=-cvs
PACKAGE=sane-backends
VERSION=${V_MAJOR}.${V_MINOR}.${V_REV}${V_EXTRA}
NUMBER_VERSION=${V_MAJOR}.${V_MINOR}.${V_REV}
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(NUMBER_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
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
NORMAL_CFLAGS="\
-W \
-Wall"
WARN_CFLAGS="\
-W \
-Wall \
-Wcast-align \
-Wcast-qual \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wpointer-arith \
-Wreturn-type \
-Wstrict-prototypes \
-pedantic"
# 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* | hpux*)
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 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/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
AC_C_INLINE
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_CHECK_TYPE(ssize_t, 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
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))
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(scsi, scsireq_enter) # FreeBSD needs this
AC_CHECK_LIB(cam, cam_open_device) # FreeBSD 3+ 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!
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
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.
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)
SANE_LINKER_RPATH
dnl initialize libtool
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_SUBST(INCLUDES)
CPPFLAGS="${CPPFLAGS} -DPATH_SANE_CONFIG_DIR=\$(configdir) \
-DPATH_SANE_DATA_DIR=\$(datadir) \
-DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR}"
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 "${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 "${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
if test "${enable_dynamic}" != yes || test "${enable_preload}" = "yes"; then
echo "preloading backends into DLL"
DLL_PRELOAD="\$(PRELOADABLE_BACKENDS)"
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(scsi-directio,
[ --enable-scsi-directio enable SCSI direct IO (Linux only; can lead to crashes
with backends using shared memory). [default=no]
This option is in no way related to
--enable-parport-directio. See README.linux for more
information.],
[
if eval "test x$enable_scsi_directio = xyes"; then
CFLAGS="$CFLAGS -DENABLE_SCSI_DIRECTIO"
fi
])
AC_ARG_ENABLE(parport-directio,
[ --enable-parport-directio enable parallel port direct IO, the backend will
do direct hardware access to use parallel port, so
frontends will require special permission level.
[default=no] This option is in no way related to
--enable-scsi-directio],
[
if eval "test x$enable_parport_directio = xyes"; then
CFLAGS="$CFLAGS -DENABLE_PARPORT_DIRECTIO"
fi
])
AC_ARG_ENABLE(translations,
[ --enable-translations install translations of backend options [default=no]],
INSTALL_TRANSLATIONS=install-translations,
INSTALL_TRANSLATIONS=
)
AC_SUBST(INSTALL_TRANSLATIONS)
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)
AC_SUBST(DLL_PRELOAD)
DISTCLEAN_FILES="*~ .*~ *.log *.bak *.old *.orig *.out *.rej \#* .\#*"
AC_SUBST(DISTCLEAN_FILES)
AC_OUTPUT([Makefile lib/Makefile sanei/Makefile frontend/Makefile
japi/Makefile backend/Makefile include/Makefile doc/Makefile
po/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 *"
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 "****************************************************************"