summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m4122
1 files changed, 78 insertions, 44 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 476d536..1bc3b74 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -26,23 +26,25 @@ dnl
AC_DEFUN([SANE_SET_AM_CFLAGS],
[
if test "${ac_cv_c_compiler_gnu}" = "yes"; then
- DEFAULT_CFLAGS="\
+ DEFAULT_WARNINGS="\
-Wall"
EXTRA_WARNINGS="\
-Wextra \
-pedantic"
- for flag in $DEFAULT_CFLAGS; do
+ for flag in $DEFAULT_WARNINGS; do
JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ])
+ JAPHAR_GREP_AM_CXXFLAGS($flag, [ AM_CXXFLAGS="$AM_CXXFLAGS $flag" ])
done
AC_ARG_ENABLE(warnings,
AS_HELP_STRING([--enable-warnings],
[turn on tons of compiler warnings (GCC only)]),
[
- if eval "test x$enable_warnings = xyes"; then
+ if eval "test x$enable_warnings = xyes"; then
for flag in $EXTRA_WARNINGS; do
JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ])
+ JAPHAR_GREP_AM_CXXFLAGS($flag, [ AM_CXXFLAGS="$AM_CXXFLAGS $flag" ])
done
fi
],
@@ -50,6 +52,7 @@ if test "${ac_cv_c_compiler_gnu}" = "yes"; then
# Warnings enabled by default (development)
for flag in $EXTRA_WARNINGS; do
JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ])
+ JAPHAR_GREP_AM_CXXFLAGS($flag, [ AM_CXXFLAGS="$AM_CXXFLAGS $flag" ])
done
fi])
fi # ac_cv_c_compiler_gnu
@@ -97,7 +100,7 @@ AC_DEFUN([SANE_SET_AM_LDFLAGS],
esac
fi
AC_SUBST(STRICT_LDFLAGS)
- case "${host_os}" in
+ case "${host_os}" in
aix*) #enable .so libraries, disable archives
AM_LDFLAGS="$AM_LDFLAGS -Wl,-brtl"
;;
@@ -180,7 +183,7 @@ AC_DEFUN([SANE_CHECK_IEEE1284],
AC_CHECK_HEADER(ieee1284.h, [
AC_CACHE_CHECK([for libieee1284 >= 0.1.5], sane_cv_use_libieee1284, [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ieee1284.h>]], [[
- struct parport p; char *buf;
+ struct parport p; char *buf;
ieee1284_nibble_read(&p, 0, buf, 1);
]])],
[sane_cv_use_libieee1284="yes"; IEEE1284_LIBS="-lieee1284"
@@ -234,7 +237,25 @@ AC_DEFUN([SANE_CHECK_PTHREAD],
LIBS="$save_LIBS"
],[ have_pthread=no; use_pthread=no ])
fi
-
+
+ # Based on a similar test for pthread_key_t from the Python project.
+ # See https://bugs.python.org/review/25658/patch/19209/75870
+ AC_MSG_CHECKING(whether pthread_t is integer)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t k; k * 1;]])],
+ [ac_pthread_t_is_integer=yes],
+ [ac_pthread_t_is_integer=no]
+ )
+ AC_MSG_RESULT($ac_pthread_t_is_integer)
+ if test "$ac_pthread_t_is_integer" = yes ; then
+ AC_DEFINE(PTHREAD_T_IS_INTEGER, 1,
+ [Define if pthread_t is integer.])
+ else
+ # Until the sanei_thread implementation is fixed.
+ have_pthread=no
+ use_pthread=no
+ fi
+
if test $use_pthread = yes ; then
AC_DEFINE_UNQUOTED(USE_PTHREAD, "$use_pthread",
[Define if pthreads should be used instead of forked processes.])
@@ -257,9 +278,9 @@ AC_DEFUN([SANE_CHECK_PTHREAD],
# GPHOTO2 and dell1600n_net backends.
AC_DEFUN([SANE_CHECK_JPEG],
[
- AC_CHECK_LIB(jpeg,jpeg_start_decompress,
+ AC_CHECK_LIB(jpeg,jpeg_start_decompress,
[
- AC_CHECK_HEADER(jconfig.h,
+ AC_CHECK_HEADER(jconfig.h,
[
AC_MSG_CHECKING([for jpeglib - version >= 61 (6a)])
AC_EGREP_CPP(sane_correct_jpeg_lib_version_found,
@@ -268,7 +289,7 @@ AC_DEFUN([SANE_CHECK_JPEG],
#if JPEG_LIB_VERSION >= 61
sane_correct_jpeg_lib_version_found
#endif
- ], [sane_cv_use_libjpeg="yes"; JPEG_LIBS="-ljpeg";
+ ], [sane_cv_use_libjpeg="yes"; JPEG_LIBS="-ljpeg";
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
],)
],)
@@ -281,9 +302,9 @@ AC_DEFUN([SANE_CHECK_JPEG],
# Checks for tiff library dell1600n_net backend.
AC_DEFUN([SANE_CHECK_TIFF],
[
- AC_CHECK_LIB(tiff,TIFFFdOpen,
+ AC_CHECK_LIB(tiff,TIFFFdOpen,
[
- AC_CHECK_HEADER(tiffio.h,
+ AC_CHECK_HEADER(tiffio.h,
[sane_cv_use_libtiff="yes"; TIFF_LIBS="-ltiff"],)
],)
AC_SUBST(TIFF_LIBS)
@@ -345,7 +366,7 @@ AC_DEFUN([SANE_CHECK_LOCKING],
fi
if test $use_locking = yes ; then
INSTALL_LOCKPATH=install-lockpath
- AC_DEFINE([ENABLE_LOCKING], 1,
+ AC_DEFINE([ENABLE_LOCKING], 1,
[Define to 1 if device locking should be enabled.])
else
INSTALL_LOCKPATH=
@@ -376,6 +397,20 @@ esac
])
dnl
+dnl JAPHAR_GREP_AM_CXXFLAGS(flag, cmd_if_missing, cmd_if_present)
+dnl
+AC_DEFUN([JAPHAR_GREP_AM_CXXFLAGS],
+[case "$AM_CXXFLAGS" in
+"$1" | "$1 "* | *" $1" | *" $1 "* )
+ ifelse($#, 3, [$3], [:])
+ ;;
+*)
+ $2
+ ;;
+esac
+])
+
+dnl
dnl SANE_CHECK_U_TYPES
dnl
AC_DEFUN([SANE_CHECK_U_TYPES],
@@ -397,13 +432,13 @@ AC_DEFUN([SANE_CHECK_GPHOTO2],
[# If --with-gphoto2=no or --without-gphoto2, disable backend
# as "$with_gphoto2" will be set to "no"])
- # If --with-gphoto2=yes (or not supplied), first check if
+ # If --with-gphoto2=yes (or not supplied), first check if
# pkg-config exists, then use it to check if libgphoto2 is
# present. If all that works, then see if we can actually link
- # a program. And, if that works, then add the -l flags to
- # GPHOTO2_LIBS and any other flags to GPHOTO2_LDFLAGS to pass to
+ # a program. And, if that works, then add the -l flags to
+ # GPHOTO2_LIBS and any other flags to GPHOTO2_LDFLAGS to pass to
# sane-config.
- if test "$with_gphoto2" != "no" ; then
+ if test "$with_gphoto2" != "no" ; then
AC_CHECK_TOOL(HAVE_GPHOTO2, pkg-config, false)
if test ${HAVE_GPHOTO2} != "false" ; then
@@ -427,8 +462,8 @@ AC_DEFUN([SANE_CHECK_GPHOTO2],
HAVE_GPHOTO2=false
fi
if test "${HAVE_GPHOTO2}" = "false"; then
- GPHOTO2_CPPFLAGS=""
- GPHOTO2_LIBS=""
+ GPHOTO2_CPPFLAGS=""
+ GPHOTO2_LIBS=""
else
SANE_EXTRACT_LDFLAGS(GPHOTO2_LIBS, GPHOTO2_LDFLAGS)
if pkg-config --atleast-version=2.5.0 libgphoto2; then
@@ -448,31 +483,31 @@ AC_DEFUN([SANE_CHECK_GPHOTO2],
# Check for ss_family member in struct sockaddr_storage
AC_DEFUN([SANE_CHECK_IPV6],
[
- AC_MSG_CHECKING([whether to enable IPv6])
- AC_ARG_ENABLE(ipv6,
+ AC_MSG_CHECKING([whether to enable IPv6])
+ AC_ARG_ENABLE(ipv6,
AS_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
[ if test "$enableval" = "no" ; then
- AC_MSG_RESULT([no, manually disabled])
- ipv6=no
+ AC_MSG_RESULT([no, manually disabled])
+ ipv6=no
fi
])
if test "$ipv6" != "no" ; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #define INET6
- #include <sys/types.h>
+ #define INET6
+ #include <sys/types.h>
#include <sys/socket.h> ]], [[
- /* AF_INET6 available check */
- if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
- exit(1);
- else
- exit(0);
+ /* AF_INET6 available check */
+ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+ exit(1);
+ else
+ exit(0);
]])],[
- AC_MSG_RESULT(yes)
- AC_DEFINE([ENABLE_IPV6], 1, [Define to 1 if the system supports IPv6])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([ENABLE_IPV6], 1, [Define to 1 if the system supports IPv6])
ipv6=yes
],[
- AC_MSG_RESULT([no (couldn't compile test program)])
+ AC_MSG_RESULT([no (couldn't compile test program)])
ipv6=no
])
fi
@@ -507,7 +542,7 @@ AC_DEFUN([SANE_CHECK_IPV6],
ipv6=no
])
])
- fi
+ fi
])
#
@@ -527,14 +562,14 @@ for be in ${BACKENDS}; do
case $be in
plustek_pp)
case "$host_os" in
- gnu*)
+ gnu*)
echo "*** $be backend not supported on GNU/Hurd - $DISABLE_MSG"
backend_supported="no"
;;
esac
;;
- dc210|dc240)
+ dc210|dc240|pixma)
if test "${sane_cv_use_libjpeg}" != "yes"; then
echo "*** $be backend requires JPEG library - $DISABLE_MSG"
backend_supported="no"
@@ -548,6 +583,13 @@ for be in ${BACKENDS}; do
fi
;;
+ genesys)
+ if test "${HAVE_CXX11}" != "1"; then
+ echo "*** $be backend requires C++11 support - $DISABLE_MSG"
+ backend_supported="no"
+ fi
+ ;;
+
mustek_pp)
if test "${sane_cv_use_libieee1284}" != "yes" && test "${enable_parport_directio}" != "yes"; then
echo "*** $be backend requires libieee1284 or parport-directio libraries - $DISABLE_MSG"
@@ -555,7 +597,7 @@ for be in ${BACKENDS}; do
fi
;;
- dell1600n_net)
+ dell1600n_net)
if test "${sane_cv_use_libjpeg}" != "yes" || test "${sane_cv_use_libtiff}" != "yes"; then
echo "*** $be backend requires JPEG and TIFF library - $DISABLE_MSG"
backend_supported="no"
@@ -666,12 +708,6 @@ const char * inet_ntop (int af, const void *src, char *dst, size_t cnt);
int inet_pton (int af, const char *src, void *dst);
#endif
-/* Prototype for isfdtype */
-#ifndef HAVE_ISFDTYPE
-#define isfdtype sanei_isfdtype
-int isfdtype(int fd, int fdtype);
-#endif
-
/* Prototype for sigprocmask */
#ifndef HAVE_SIGPROCMASK
#define sigprocmask sanei_sigprocmask
@@ -724,6 +760,4 @@ void vsyslog(int priority, const char *format, va_list args);
])
])
-m4_include([m4/libtool.m4])
m4_include([m4/byteorder.m4])
-m4_include([m4/stdint.m4])