@@ -10379,6 +10379,67 @@ _ACEOF
1037910379fi
1038010380
1038110381
10382+ echo "$as_me:$LINENO: checking for struct option" >&5
10383+ echo $ECHO_N "checking for struct option... $ECHO_C" >&6
10384+ if test "${ac_cv_type_struct_option+set}" = set; then
10385+ echo $ECHO_N "(cached) $ECHO_C" >&6
10386+ else
10387+ cat >conftest.$ac_ext <<_ACEOF
10388+ #line $LINENO "configure"
10389+ #include "confdefs.h"
10390+ #ifdef HAVE_GETOPT_H
10391+ include <getopt.h>
10392+ #endif
10393+
10394+ #ifdef F77_DUMMY_MAIN
10395+ # ifdef __cplusplus
10396+ extern "C"
10397+ # endif
10398+ int F77_DUMMY_MAIN() { return 1; }
10399+ #endif
10400+ int
10401+ main ()
10402+ {
10403+ if ((struct option *) 0)
10404+ return 0;
10405+ if (sizeof (struct option))
10406+ return 0;
10407+ ;
10408+ return 0;
10409+ }
10410+ _ACEOF
10411+ rm -f conftest.$ac_objext
10412+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10413+ (eval $ac_compile) 2>&5
10414+ ac_status=$?
10415+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
10416+ (exit $ac_status); } &&
10417+ { ac_try='test -s conftest.$ac_objext'
10418+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10419+ (eval $ac_try) 2>&5
10420+ ac_status=$?
10421+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
10422+ (exit $ac_status); }; }; then
10423+ ac_cv_type_struct_option=yes
10424+ else
10425+ echo "$as_me: failed program was:" >&5
10426+ cat conftest.$ac_ext >&5
10427+ ac_cv_type_struct_option=no
10428+ fi
10429+ rm -f conftest.$ac_objext conftest.$ac_ext
10430+ fi
10431+ echo "$as_me:$LINENO: result: $ac_cv_type_struct_option" >&5
10432+ echo "${ECHO_T}$ac_cv_type_struct_option" >&6
10433+ if test $ac_cv_type_struct_option = yes; then
10434+
10435+ cat >>confdefs.h <<_ACEOF
10436+ #define HAVE_STRUCT_OPTION 1
10437+ _ACEOF
10438+
10439+
10440+ fi
10441+
10442+
1038210443if test "$with_zlib" = yes; then
1038310444 # Check that <zlib.h> defines z_streamp (versions before about 1.0.4
1038410445 # did not). While we could work around the lack of z_streamp, it
@@ -11760,8 +11821,7 @@ fi
1176011821
1176111822
1176211823
11763-
11764- for ac_func in crypt fseeko getopt getopt_long getrusage inet_aton random rint srandom strcasecmp strdup strerror strtol strtoul
11824+ for ac_func in crypt fseeko getopt getrusage inet_aton random rint srandom strcasecmp strdup strerror strtol strtoul
1176511825do
1176611826as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
1176711827echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -11926,6 +11986,91 @@ else
1192611986 LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext"
1192711987fi
1192811988
11989+ # similarly, use system's getopt_long() only if system provides struct option.
11990+ if test x"$ac_cv_type_struct_option" = xyes ; then
11991+
11992+ for ac_func in getopt_long
11993+ do
11994+ as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
11995+ echo "$as_me:$LINENO: checking for $ac_func" >&5
11996+ echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
11997+ if eval "test \"\${$as_ac_var+set}\" = set"; then
11998+ echo $ECHO_N "(cached) $ECHO_C" >&6
11999+ else
12000+ cat >conftest.$ac_ext <<_ACEOF
12001+ #line $LINENO "configure"
12002+ #include "confdefs.h"
12003+ /* System header to define __stub macros and hopefully few prototypes,
12004+ which can conflict with char $ac_func (); below. */
12005+ #include <assert.h>
12006+ /* Override any gcc2 internal prototype to avoid an error. */
12007+ #ifdef __cplusplus
12008+ extern "C"
12009+ #endif
12010+ /* We use char because int might match the return type of a gcc2
12011+ builtin and then its argument prototype would still apply. */
12012+ char $ac_func ();
12013+ char (*f) ();
12014+
12015+ #ifdef F77_DUMMY_MAIN
12016+ # ifdef __cplusplus
12017+ extern "C"
12018+ # endif
12019+ int F77_DUMMY_MAIN() { return 1; }
12020+ #endif
12021+ int
12022+ main ()
12023+ {
12024+ /* The GNU C library defines this for functions which it implements
12025+ to always fail with ENOSYS. Some functions are actually named
12026+ something starting with __ and the normal name is an alias. */
12027+ #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
12028+ choke me
12029+ #else
12030+ f = $ac_func;
12031+ #endif
12032+
12033+ ;
12034+ return 0;
12035+ }
12036+ _ACEOF
12037+ rm -f conftest.$ac_objext conftest$ac_exeext
12038+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
12039+ (eval $ac_link) 2>&5
12040+ ac_status=$?
12041+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
12042+ (exit $ac_status); } &&
12043+ { ac_try='test -s conftest$ac_exeext'
12044+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
12045+ (eval $ac_try) 2>&5
12046+ ac_status=$?
12047+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
12048+ (exit $ac_status); }; }; then
12049+ eval "$as_ac_var=yes"
12050+ else
12051+ echo "$as_me: failed program was:" >&5
12052+ cat conftest.$ac_ext >&5
12053+ eval "$as_ac_var=no"
12054+ fi
12055+ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
12056+ fi
12057+ echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
12058+ echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
12059+ if test `eval echo '${'$as_ac_var'}'` = yes; then
12060+ cat >>confdefs.h <<_ACEOF
12061+ #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12062+ _ACEOF
12063+
12064+ else
12065+ LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
12066+ fi
12067+ done
12068+
12069+
12070+ else
12071+ LIBOBJS="$LIBOBJS getopt_long.$ac_objext"
12072+ fi
12073+
1192912074# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
1193012075# We override the previous test that said fseeko/ftello didn't exist
1193112076# OS tests are also done in include/c.h and port/fseeko.c