[sane-devel] [PATCH v2 03/14] bldchn, use our new macro SANE_CHECK_NETDB_FUNC
On Tue, Jan 24, 2012 at 1:49 PM, Ruediger Meier sweet_f_a at gmx.de wrote: On Tuesday 24 January 2012, Chris Bagwell wrote: On Mon, Jan 23, 2012 at 5:05 PM, Ruediger Meier sweet_f_a at gmx.de wrote: From: Ruediger Meier ruediger.meier at ga-group.nl Now we will find getaddrinfo and getnameinfo on win32 systems. Note it should be even safe to use that macro for all systems instead of trying AC_CHECK_FUNCS first. For now I don't want to do such risky things things and leave it as is. I would prefer if we went ahead and did your suggestion of doing check with new macro on all systems instead of this. ?I will be glad to test on a sampling of Unix systems to make sure there are no issues. So I'm saying I'd prefer this patch to change to delete old check for get* functions and do macro unconditionally. Ok, then I will polish SANE_CHECK_NETDB_FUNC a little for this: 1. maybe allowing multiple args 2. respecting cached results One thing I notice must be a bug. ?Right before the old call to AC_CHECK_FUNCS(), there is a check for BeOS and forces the variables to be no. ?Those need to be after the AC_CHECK_FUNCS to be meaningful. On first view I've also wondered about this but note that all ac_cv_* vars are cached variables and having them set to no before doing the check will result it this: checking for getaddrinfo... (cached) no checking for getnameinfo... (cached) no Oh yeah. Thanks for that info. I not so sure if the logic was written to work that way but its nice to know we were working. Chris
[sane-devel] [PATCH v2 03/14] bldchn, use our new macro SANE_CHECK_NETDB_FUNC
From: Ruediger Meier ruediger.me...@ga-group.nl Now we will find getaddrinfo and getnameinfo on win32 systems. Note it should be even safe to use that macro for all systems instead of trying AC_CHECK_FUNCS first. For now I don't want to do such risky things things and leave it as is. --- configure| 169 ++ configure.in |8 ++ include/sane/config.h.in |3 + 3 files changed, 180 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 4c9dfcd..5da8db8 100755 --- a/configure +++ b/configure @@ -9508,6 +9508,175 @@ fi +if test $ac_cv_func_getaddrinfo != yes \ + || test $ac_cv_func_getnameinfo != yes; then + + + sane_netdb_includes=$ac_includes_default + #ifdef HAVE_SYS_SOCKET_H + # include sys/socket.h + #endif + #ifdef HAVE_NETDB_H + # include netdb.h + #endif + #ifdef HAVE_WINSOCK2_H + # include winsock2.h + #endif + #ifdef HAVE_WS2TCPIP_H + # include ws2tcpip.h + #endif + + ac_cv_func_getaddrinfo=no + need_winver_xp=no + + { $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getaddrinfo 5 +$as_echo_n checking for win32 getaddrinfo... 6; } + cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. */ +$sane_netdb_includes +int +main () +{ +int testme(){ getaddrinfo; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } +ac_cv_func_getaddrinfo=yes +else + { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_func_getaddrinfo != yes; then +{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getaddrinfo if WINVER is 0x0501 5 +$as_echo_n checking for win32 getaddrinfo if WINVER is 0x0501... 6; } +cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. */ +#define WINVER 0x0501 + $sane_netdb_includes +int +main () +{ +int testme(){ getaddrinfo; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } + ac_cv_func_getaddrinfo=yes + need_winver_xp=yes +else + { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + if test $ac_cv_func_getaddrinfo = yes; then + +$as_echo #define HAVE_GETADDRINFO 1 confdefs.h + + +if test $need_winver_xp = yes; then + +$as_echo #define NEED_WINVER_XP 1 confdefs.h + +fi + fi + + unset sane_netdb_includes + + + sane_netdb_includes=$ac_includes_default + #ifdef HAVE_SYS_SOCKET_H + # include sys/socket.h + #endif + #ifdef HAVE_NETDB_H + # include netdb.h + #endif + #ifdef HAVE_WINSOCK2_H + # include winsock2.h + #endif + #ifdef HAVE_WS2TCPIP_H + # include ws2tcpip.h + #endif + + ac_cv_func_getnameinfo=no + need_winver_xp=no + + { $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getnameinfo 5 +$as_echo_n checking for win32 getnameinfo... 6; } + cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. */ +$sane_netdb_includes +int +main () +{ +int testme(){ getnameinfo; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } +ac_cv_func_getnameinfo=yes +else + { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_func_getnameinfo != yes; then +{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getnameinfo if WINVER is 0x0501 5 +$as_echo_n checking for win32 getnameinfo if WINVER is 0x0501... 6; } +cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. */ +#define WINVER 0x0501 + $sane_netdb_includes +int +main () +{ +int testme(){ getnameinfo; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } + ac_cv_func_getnameinfo=yes + need_winver_xp=yes +else + { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + if test $ac_cv_func_getnameinfo = yes; then + +$as_echo #define HAVE_GETNAMEINFO 1 confdefs.h + + +if test $need_winver_xp = yes; then + +$as_echo #define NEED_WINVER_XP 1 confdefs.h + +fi + fi + + unset sane_netdb_includes + +fi + diff --git a/configure.in b/configure.in index 6eb3355..060b8b6 100644 --- a/configure.in +++ b/configure.in @@ -308,6 +308,14 @@ AC_CHECK_FUNCS(atexit ioperm i386_set_ioperm \ AC_REPLACE_FUNCS(getenv isfdtype sigprocmask snprintf \ strcasestr strdup strndup strsep usleep sleep syslog vsyslog) +dnl Some systems need better ckecks for get*info +if test $ac_cv_func_getaddrinfo != yes \ + || test $ac_cv_func_getnameinfo != yes;
[sane-devel] [PATCH v2 03/14] bldchn, use our new macro SANE_CHECK_NETDB_FUNC
On Mon, Jan 23, 2012 at 5:05 PM, Ruediger Meier sweet_f_a at gmx.de wrote: From: Ruediger Meier ruediger.meier at ga-group.nl Now we will find getaddrinfo and getnameinfo on win32 systems. Note it should be even safe to use that macro for all systems instead of trying AC_CHECK_FUNCS first. For now I don't want to do such risky things things and leave it as is. I would prefer if we went ahead and did your suggestion of doing check with new macro on all systems instead of this. I will be glad to test on a sampling of Unix systems to make sure there are no issues. So I'm saying I'd prefer this patch to change to delete old check for get* functions and do macro unconditionally. One thing I notice must be a bug. Right before the old call to AC_CHECK_FUNCS(), there is a check for BeOS and forces the variables to be no. Those need to be after the AC_CHECK_FUNCS to be meaningful. I'm pretty sure BeOS support is broke in other ways. Anyways, I'll probably submit a patch to fix BeOS bug along with your patches. Chris --- ?configure ? ? ? ? ? ? ? ?| ?169 ++ ?configure.in ? ? ? ? ? ? | ? ?8 ++ ?include/sane/config.h.in | ? ?3 + ?3 files changed, 180 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 4c9dfcd..5da8db8 100755 --- a/configure +++ b/configure @@ -9508,6 +9508,175 @@ fi +if test $ac_cv_func_getaddrinfo != yes \ + ?|| test $ac_cv_func_getnameinfo != yes; then + + + ?sane_netdb_includes=$ac_includes_default + ?#ifdef HAVE_SYS_SOCKET_H + ?# include sys/socket.h + ?#endif + ?#ifdef HAVE_NETDB_H + ?# include netdb.h + ?#endif + ?#ifdef HAVE_WINSOCK2_H + ?# include winsock2.h + ?#endif + ?#ifdef HAVE_WS2TCPIP_H + ?# include ws2tcpip.h + ?#endif + + ?ac_cv_func_getaddrinfo=no + ?need_winver_xp=no + + ?{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getaddrinfo 5 +$as_echo_n checking for win32 getaddrinfo... 6; } + ?cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. ?*/ +$sane_netdb_includes +int +main () +{ +int testme(){ getaddrinfo; } + ?; + ?return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + ?{ $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } + ? ?ac_cv_func_getaddrinfo=yes +else + ?{ $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + ? ?if test $ac_cv_func_getaddrinfo != yes; then + ? ?{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getaddrinfo if WINVER is 0x0501 5 +$as_echo_n checking for win32 getaddrinfo if WINVER is 0x0501... 6; } + ? ?cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. ?*/ +#define WINVER 0x0501 + ? ? ?$sane_netdb_includes +int +main () +{ +int testme(){ getaddrinfo; } + ?; + ?return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + ?{ $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } + ? ? ?ac_cv_func_getaddrinfo=yes + ? ? ?need_winver_xp=yes +else + ?{ $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ?fi + + ?if test $ac_cv_func_getaddrinfo = yes; then + +$as_echo #define HAVE_GETADDRINFO 1 confdefs.h + + + ? ?if test $need_winver_xp = yes; then + +$as_echo #define NEED_WINVER_XP 1 confdefs.h + + ? ?fi + ?fi + + ?unset sane_netdb_includes + + + ?sane_netdb_includes=$ac_includes_default + ?#ifdef HAVE_SYS_SOCKET_H + ?# include sys/socket.h + ?#endif + ?#ifdef HAVE_NETDB_H + ?# include netdb.h + ?#endif + ?#ifdef HAVE_WINSOCK2_H + ?# include winsock2.h + ?#endif + ?#ifdef HAVE_WS2TCPIP_H + ?# include ws2tcpip.h + ?#endif + + ?ac_cv_func_getnameinfo=no + ?need_winver_xp=no + + ?{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getnameinfo 5 +$as_echo_n checking for win32 getnameinfo... 6; } + ?cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. ?*/ +$sane_netdb_includes +int +main () +{ +int testme(){ getnameinfo; } + ?; + ?return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + ?{ $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } + ? ?ac_cv_func_getnameinfo=yes +else + ?{ $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + ? ?if test $ac_cv_func_getnameinfo != yes; then + ? ?{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getnameinfo if WINVER is 0x0501 5 +$as_echo_n checking for win32 getnameinfo if WINVER is 0x0501... 6; } + ? ?cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. ?*/ +#define WINVER 0x0501 + ? ? ?$sane_netdb_includes +int +main () +{ +int testme(){ getnameinfo; } + ?; + ?return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + ?{ $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo
[sane-devel] [PATCH v2 03/14] bldchn, use our new macro SANE_CHECK_NETDB_FUNC
On Tuesday 24 January 2012, Chris Bagwell wrote: On Mon, Jan 23, 2012 at 5:05 PM, Ruediger Meier sweet_f_a at gmx.de wrote: From: Ruediger Meier ruediger.meier at ga-group.nl Now we will find getaddrinfo and getnameinfo on win32 systems. Note it should be even safe to use that macro for all systems instead of trying AC_CHECK_FUNCS first. For now I don't want to do such risky things things and leave it as is. I would prefer if we went ahead and did your suggestion of doing check with new macro on all systems instead of this. I will be glad to test on a sampling of Unix systems to make sure there are no issues. So I'm saying I'd prefer this patch to change to delete old check for get* functions and do macro unconditionally. Ok, then I will polish SANE_CHECK_NETDB_FUNC a little for this: 1. maybe allowing multiple args 2. respecting cached results One thing I notice must be a bug. Right before the old call to AC_CHECK_FUNCS(), there is a check for BeOS and forces the variables to be no. Those need to be after the AC_CHECK_FUNCS to be meaningful. On first view I've also wondered about this but note that all ac_cv_* vars are cached variables and having them set to no before doing the check will result it this: checking for getaddrinfo... (cached) no checking for getnameinfo... (cached) no I'm pretty sure BeOS support is broke in other ways. Anyways, I'll probably submit a patch to fix BeOS bug along with your patches. Chris --- configure| 169 ++ configure.in |8 ++ include/sane/config.h.in |3 + 3 files changed, 180 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 4c9dfcd..5da8db8 100755 --- a/configure +++ b/configure @@ -9508,6 +9508,175 @@ fi +if test $ac_cv_func_getaddrinfo != yes \ + || test $ac_cv_func_getnameinfo != yes; then + + + sane_netdb_includes=$ac_includes_default + #ifdef HAVE_SYS_SOCKET_H + # include sys/socket.h + #endif + #ifdef HAVE_NETDB_H + # include netdb.h + #endif + #ifdef HAVE_WINSOCK2_H + # include winsock2.h + #endif + #ifdef HAVE_WS2TCPIP_H + # include ws2tcpip.h + #endif + + ac_cv_func_getaddrinfo=no + need_winver_xp=no + + { $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getaddrinfo 5 +$as_echo_n checking for win32 getaddrinfo... 6; } + cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. */ +$sane_netdb_includes +int +main () +{ +int testme(){ getaddrinfo; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } +ac_cv_func_getaddrinfo=yes +else + { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_func_getaddrinfo != yes; then +{ $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getaddrinfo if WINVER is 0x0501 5 +$as_echo_n checking for win32 getaddrinfo if WINVER is 0x0501... 6; } +cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. */ +#define WINVER 0x0501 + $sane_netdb_includes +int +main () +{ +int testme(){ getaddrinfo; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } + ac_cv_func_getaddrinfo=yes + need_winver_xp=yes +else + { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + if test $ac_cv_func_getaddrinfo = yes; then + +$as_echo #define HAVE_GETADDRINFO 1 confdefs.h + + +if test $need_winver_xp = yes; then + +$as_echo #define NEED_WINVER_XP 1 confdefs.h + +fi + fi + + unset sane_netdb_includes + + + sane_netdb_includes=$ac_includes_default + #ifdef HAVE_SYS_SOCKET_H + # include sys/socket.h + #endif + #ifdef HAVE_NETDB_H + # include netdb.h + #endif + #ifdef HAVE_WINSOCK2_H + # include winsock2.h + #endif + #ifdef HAVE_WS2TCPIP_H + # include ws2tcpip.h + #endif + + ac_cv_func_getnameinfo=no + need_winver_xp=no + + { $as_echo $as_me:${as_lineno-$LINENO}: checking for win32 getnameinfo 5 +$as_echo_n checking for win32 getnameinfo... 6; } + cat confdefs.h - _ACEOF conftest.$ac_ext +/* end confdefs.h. */ +$sane_netdb_includes +int +main () +{ +int testme(){ getnameinfo; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile $LINENO; then : + { $as_echo $as_me:${as_lineno-$LINENO}: result: yes 5 +$as_echo yes 6; } +ac_cv_func_getnameinfo=yes +else + { $as_echo $as_me:${as_lineno-$LINENO}: result: no 5 +$as_echo no 6; } +fi +rm -f core