kopia lustrzana https://gitlab.com/sane-project/backends
Added wrapper for inet_pton(). If this function is not available, try first
inet_aton() and then inet_addr(). Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
9834cad6a9
commit
b6b3496b00
|
@ -3559,7 +3559,7 @@ EOF
|
|||
|
||||
fi
|
||||
|
||||
for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
|
||||
for ac_hdr in unistd.h
|
||||
do
|
||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||
|
@ -3691,24 +3691,11 @@ else
|
|||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* This mess was copied from the GNU getpagesize.h. */
|
||||
#ifndef HAVE_GETPAGESIZE
|
||||
# ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
|
||||
/* Assume that all systems that can run configure have sys/param.h. */
|
||||
# ifndef HAVE_SYS_PARAM_H
|
||||
|
@ -3816,7 +3803,7 @@ main()
|
|||
}
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:3820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:3807: \"$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
|
||||
|
@ -3838,17 +3825,17 @@ EOF
|
|||
|
||||
fi
|
||||
|
||||
for ac_func in atexit ioperm mkdir scsireq_enter \
|
||||
strftime strstr strtod \
|
||||
for ac_func in atexit inet_addr inet_aton inet_ntoa ioperm mkdir \
|
||||
scsireq_enter strftime strstr strtod \
|
||||
cfmakeraw tcsendbreak strcasecmp strncasecmp _portaccess
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:3847: checking for $ac_func" >&5
|
||||
echo "configure:3834: 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 <<EOF
|
||||
#line 3852 "configure"
|
||||
#line 3839 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
@ -3871,7 +3858,7 @@ $ac_func();
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3862: \"$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
|
||||
|
@ -3896,16 +3883,16 @@ fi
|
|||
done
|
||||
|
||||
|
||||
for ac_func in getenv inet_ntop isfdtype sigprocmask snprintf \
|
||||
for ac_func in getenv inet_ntop inet_pton isfdtype sigprocmask snprintf \
|
||||
strdup strndup strsep usleep vsyslog
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:3904: checking for $ac_func" >&5
|
||||
echo "configure:3891: 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 <<EOF
|
||||
#line 3909 "configure"
|
||||
#line 3896 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
@ -3928,7 +3915,7 @@ $ac_func();
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:3919: \"$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
|
||||
|
@ -3956,7 +3943,7 @@ done
|
|||
|
||||
|
||||
echo $ac_n "checking linker parameter to set runtime link path""... $ac_c" 1>&6
|
||||
echo "configure:3960: checking linker parameter to set runtime link path" >&5
|
||||
echo "configure:3947: 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
|
||||
|
@ -4049,7 +4036,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:4053: checking for $ac_word" >&5
|
||||
echo "configure:4040: 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
|
||||
|
@ -4077,7 +4064,7 @@ else
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
|
||||
echo "configure:4081: checking for BSD-compatible nm" >&5
|
||||
echo "configure:4068: 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
|
||||
|
@ -4113,7 +4100,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:4117: checking whether ln -s works" >&5
|
||||
echo "configure:4104: 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
|
||||
|
@ -4167,8 +4154,8 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
|||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 4171 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo configure:4172: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
echo '#line 4158 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo configure:4159: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
|
@ -4189,19 +4176,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:4193: checking whether the C compiler needs -belf" >&5
|
||||
echo "configure:4180: 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 <<EOF
|
||||
#line 4198 "configure"
|
||||
#line 4185 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
int main() {
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4192: \"$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
|
||||
|
@ -4224,7 +4211,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:4228: checking for $ac_word" >&5
|
||||
echo "configure:4215: 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
|
||||
|
@ -4256,7 +4243,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:4260: checking for $ac_word" >&5
|
||||
echo "configure:4247: 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
|
||||
|
@ -4291,7 +4278,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:4295: checking for $ac_word" >&5
|
||||
echo "configure:4282: 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
|
||||
|
@ -4323,7 +4310,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:4327: checking for $ac_word" >&5
|
||||
echo "configure:4314: 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
|
||||
|
@ -4358,7 +4345,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:4362: checking for $ac_word" >&5
|
||||
echo "configure:4349: 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
|
||||
|
@ -4390,7 +4377,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:4394: checking for $ac_word" >&5
|
||||
echo "configure:4381: 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
|
||||
|
@ -4664,7 +4651,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:4668: checking for $ac_word" >&5
|
||||
echo "configure:4655: 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
|
||||
|
@ -4698,7 +4685,7 @@ else
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for sane_init in -lsane""... $ac_c" 1>&6
|
||||
echo "configure:4702: checking for sane_init in -lsane" >&5
|
||||
echo "configure:4689: 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
|
||||
|
@ -4706,7 +4693,7 @@ else
|
|||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lsane $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 4710 "configure"
|
||||
#line 4697 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
|
@ -4717,7 +4704,7 @@ int main() {
|
|||
sane_init()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:4721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:4708: \"$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
|
||||
|
|
|
@ -203,11 +203,11 @@ fi
|
|||
dnl Checks for library functions.
|
||||
AC_FUNC_ALLOCA
|
||||
AC_FUNC_MMAP
|
||||
AC_CHECK_FUNCS(atexit ioperm mkdir scsireq_enter \
|
||||
strftime strstr strtod \
|
||||
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 isfdtype sigprocmask snprintf \
|
||||
AC_REPLACE_FUNCS(getenv inet_ntop inet_pton isfdtype sigprocmask snprintf \
|
||||
strdup strndup strsep usleep vsyslog)
|
||||
|
||||
SANE_LINKER_RPATH
|
||||
|
|
|
@ -223,9 +223,21 @@
|
|||
/* Define if you have the vsyslog function. */
|
||||
#undef HAVE_VSYSLOG
|
||||
|
||||
/* Define if you have the inet_aton function. */
|
||||
#undef HAVE_INET_ATON
|
||||
|
||||
/* Define if you have the inet_ntoa function. */
|
||||
#undef HAVE_INET_NTOA
|
||||
|
||||
/* Define if you have the inet_addr function. */
|
||||
#undef HAVE_INET_ADDR
|
||||
|
||||
/* Define if you have the inet_ntop function. */
|
||||
#undef HAVE_INET_NTOP
|
||||
|
||||
/* Define if you have the inet_pton function. */
|
||||
#undef HAVE_INET_PTON
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ TARGETS = $(LIBLIB_OBJS)
|
|||
TARGETS = liblib.a
|
||||
|
||||
DISTFILES = Makefile.in alloca.c getenv.c getopt.c getopt1.c \
|
||||
inet_ntop.c isfdtype.c md5.c sigprocmask.c snprintf.c strdup.c \
|
||||
inet_ntop.c inet_pton.c isfdtype.c md5.c sigprocmask.c snprintf.c strdup.c \
|
||||
strndup.c strsep.c usleep.c vsyslog.c
|
||||
|
||||
.PHONY: all check clean depend dist distclean install uninstall
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#include "../include/sane/config.h"
|
||||
|
||||
#ifndef HAVE_INET_PTON
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
int
|
||||
inet_pton (int af, const char *src, void *dst)
|
||||
{
|
||||
|
||||
if (af == AF_INET)
|
||||
{
|
||||
|
||||
#if defined(HAVE_INET_ATON)
|
||||
int result;
|
||||
struct in_addr in;
|
||||
|
||||
result = inet_aton (src, &in);
|
||||
if (result)
|
||||
{
|
||||
memcpy (dst, &in.s_addr, sizeof (in.s_addr));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
#elif defined(HAVE_INET_ADDR)
|
||||
|
||||
# if !defined(INADDR_NONE)
|
||||
# define INADDR_NONE -1
|
||||
# endif /* !defined(INADDR_NONE) */
|
||||
in_addr_t in;
|
||||
|
||||
in = inet_addr (src);
|
||||
if (in != INADDR_NONE)
|
||||
{
|
||||
memcpy (dst, &in, sizeof (in));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
#endif /* defined(HAVE_INET_ATON) */
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* !HAVE_INET_PTON */
|
Ładowanie…
Reference in New Issue