On Wed, Jul 11, 2007 at 01:41:56PM -0400, Tom Lane wrote:
> Magnus Hagander <[EMAIL PROTECTED]> writes:
> > Tom Lane wrote:
> >> Magnus Hagander <[EMAIL PROTECTED]> writes:
> >>> I'm simply using
> >>> AC_CHECK_FUNC([krb5_free_unparsed_name])
> >>> which works fine on unix, but breaks on win32. Because autoconf tries the
> >>> function with no parameters, which doesn't work due to win32 decorations.
> >>
> >> Doesn't work why? We have dozens of other functions we check for
> >> without needing any special windoze hacks. Is it a macro?
>
> > No, it actually depends on how the library is compiled. Functions can
> > either be exported decorated or not. This one is exported decorated.
>
> It's still not apparent to me how this function is different from every
> other one we check for; but I'd suggest you write a check that looks
> like the ones we use for functions that might be macros, eg sigsetjmp.
Thanks for the pointer. Attached is what I came up with. If someone
autoconfy can sign off on that it seems correct, I'll apply that.
(It passes my tests on both linux and win32 now..)
//Magnus
Index: configure
===
RCS file: /cvsroot/pgsql/configure,v
retrieving revision 1.551
diff -c -r1.551 configure
*** configure 10 Jul 2007 16:41:01 - 1.551
--- configure 12 Jul 2007 12:18:08 -
***
*** 14398,14403
--- 14398,14461
fi
+
+ # Win32 requires headers to be loaded for __stdcall, so can't use
+ # AC_CHECK_FUNCS here.
+ echo "$as_me:$LINENO: checking for krb5_free_unparsed_name" >&5
+ echo $ECHO_N "checking for krb5_free_unparsed_name... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+ _ACEOF
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+ #include
+ int
+ main ()
+ {
+ krb5_free_unparsed_name(NULL,NULL);
+ ;
+ return 0;
+ }
+ _ACEOF
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+{ ac_try='test -z "$ac_c_werror_flag"
+|| test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+{ ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\_ACEOF
+ #define HAVE_KRB5_FREE_UNPARSED_NAME 1
+ _ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+ echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+
+ echo "$as_me:$LINENO: result: no" >&5
+ echo "${ECHO_T}no" >&6
+ fi
+ rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
fi
Index: configure.in
===
RCS file: /cvsroot/pgsql/configure.in,v
retrieving revision 1.518
diff -c -r1.518 configure.in
*** configure.in10 Jul 2007 16:41:01 - 1.518
--- configure.in12 Jul 2007 12:18:12 -
***
*** 965,970
--- 965,979
[AC_MSG_ERROR([could not determine how
to extract Kerberos 5 error messages])],
[#include ])],
[#include ])
+
+ # Win32 requires headers to be loaded for __stdcall, so can't use
+ # AC_CHECK_FUNCS here.
+ AC_MSG_CHECKING(for krb5_free_unparsed_name)
+ AC_TRY_LINK([#include ],
+ [krb5_free_unparsed_name(NULL,NULL);],
+ [AC_DEFINE(HAVE_KRB5_FREE_UNPARSED_NAME, 1, [Define to 1 if you
have krb5_free_unparsed_name])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)])
fi
Index: src/include/pg_config.h.in
===
RCS file: /cvsroot/pgsql/src/include/pg_config.h.in,v
retrieving revision 1.119
diff -c -r1.119 pg_config.h.in
*** src/include/pg_config.h.in 10 Jul 2007 16:41:01 - 1.119
--- src/include/pg_config.h.in 12 Jul 2007 12:19:14 -
***
*** 214,219
--- 214,222
/* Define to 1 if `text.data' is member of `krb5_error'. */
#undef HAVE_KRB5_ERROR_TEXT_DATA
+ /* Define to 1 if you have krb5_free_unparsed_name */
+ #undef HAVE_KRB5_FREE_UNPARSED_NAME
+
/* Define to 1 if `client' is member of `krb5_ticket'. */
#undef HAVE_KRB5_TICKET_CLIENT
Index: src/interfaces/libpq/fe-auth.c
===
RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v
retrievin