Index: configure =================================================================== RCS file: /home/joerg/repo/netbsd/pkgsrc/pkgtools/libnbcompat/files/configure,v retrieving revision 1.71 diff -u -p -r1.71 configure --- configure 22 Mar 2009 22:33:13 -0000 1.71 +++ configure 12 Apr 2009 12:58:21 -0000 @@ -6056,25 +6056,60 @@ as_val=`eval 'as_val=${'$as_ac_Header'} cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - - - { $as_echo "$as_me:$LINENO: checking for struct option" >&5 + { $as_echo "$as_me:$LINENO: checking for struct option" >&5 $as_echo_n "checking for struct option... " >&6; } -if test "${pkg_cv_have_struct_option+set}" = set; then +if test "${ac_cv_type_struct_option+set}" = set; then $as_echo_n "(cached) " >&6 else + ac_cv_type_struct_option=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include - cat >conftest.$ac_ext <<_ACEOF +int +main () +{ +if (sizeof (struct option)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include +#include + int main () { - struct option X; ; +if (sizeof ((struct option))) + return 0; ; return 0; } @@ -6097,30 +6132,48 @@ $as_echo "$ac_try_echo") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - pkg_cv_have_struct_option=yes + : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - pkg_cv_have_struct_option=no + ac_cv_type_struct_option=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -{ $as_echo "$as_me:$LINENO: result: $pkg_cv_have_struct_option" >&5 -$as_echo "$pkg_cv_have_struct_option" >&6; } - if test "x$pkg_cv_have_struct_option" = "xyes"; then - : - else - case " $LIBOBJS " in + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_struct_option" >&5 +$as_echo "$ac_cv_type_struct_option" >&6; } +if test "x$ac_cv_type_struct_option" = x""yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_OPTION 1 +_ACEOF + +: +else + case " $LIBOBJS " in *" getopt_long.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getopt_long.$ac_objext" ;; esac - : - fi +fi + +else + case " $LIBOBJS " in + *" getopt_long.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt_long.$ac_objext" + ;; +esac fi Index: configure.ac =================================================================== RCS file: /home/joerg/repo/netbsd/pkgsrc/pkgtools/libnbcompat/files/configure.ac,v retrieving revision 1.72 diff -u -p -r1.72 configure.ac --- configure.ac 22 Mar 2009 22:33:13 -0000 1.72 +++ configure.ac 12 Apr 2009 12:58:03 -0000 @@ -148,12 +148,13 @@ AC_CHECK_DECLS([optind, optreset], [:], ]) -AC_CHECK_HEADERS([getopt.h], [ - AC_MSG_TRY_COMPILE([for struct option], pkg_cv_have_struct_option, - [ #include ], [ struct option X; ], - [:], - [AC_LIBOBJ(getopt_long)]) -]) +AC_CHECK_HEADERS([getopt.h], + [ AC_CHECK_TYPES([struct option], + [:], + [ AC_LIBOBJ(getopt_long)], + [#include ])], + [ AC_LIBOBJ(getopt_long)] +) if test "$enable_bsd_getopt" = yes; then if test "$ac_cv_have_decl_optreset" = no; then Index: nbcompat.h =================================================================== RCS file: /home/joerg/repo/netbsd/pkgsrc/pkgtools/libnbcompat/files/nbcompat.h,v retrieving revision 1.42 diff -u -p -r1.42 nbcompat.h --- nbcompat.h 19 Oct 2008 21:02:07 -0000 1.42 +++ nbcompat.h 12 Apr 2009 13:00:54 -0000 @@ -128,9 +128,7 @@ # include #endif -#if HAVE_NBCOMPAT_GETOPT_LONG -# if HAVE_GETOPT_H -# undef HAVE_GETOPT_H -# endif +#if !HAVE_GETOPT_H || !HAVE_STRUCT_OPTION +# undef HAVE_GETOPT_H # include #endif Index: nbcompat/config.h.in =================================================================== RCS file: /home/joerg/repo/netbsd/pkgsrc/pkgtools/libnbcompat/files/nbcompat/config.h.in,v retrieving revision 1.25 diff -u -p -r1.25 config.h.in --- nbcompat/config.h.in 9 Feb 2009 20:35:22 -0000 1.25 +++ nbcompat/config.h.in 12 Apr 2009 12:58:19 -0000 @@ -206,9 +206,6 @@ /* Define to 1 if the `fts_*' functions are built into the library. */ #undef HAVE_NBCOMPAT_FTS -/* Define to 1 if the `getopt_long' function is built into the library. */ -#undef HAVE_NBCOMPAT_GETOPT_LONG - /* Define to 1 if the `glob' function is built into the library. */ #undef HAVE_NBCOMPAT_GLOB @@ -369,6 +366,9 @@ /* Define to 1 if the system has the type `struct in6_addr'. */ #undef HAVE_STRUCT_IN6_ADDR +/* Define to 1 if the system has the type `struct option'. */ +#undef HAVE_STRUCT_OPTION + /* Define to 1 if the system has the type `struct sockaddr_in6'. */ #undef HAVE_STRUCT_SOCKADDR_IN6