Re: [HACKERS] Need help with autoconf

2007-07-12 Thread Magnus Hagander
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 krb5.h
+ 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) 2conftest.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) 25
+   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) 25
+   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 krb5.h])],
 [#include krb5.h])
+ 
+ # 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.h],
+   [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
retrieving revision 1.124
diff -c -r1.124 fe-auth.c
*** src/interfaces/libpq/fe-auth.c  10 Jul 2007 13:14:21 

Re: [HACKERS] Need help with autoconf

2007-07-12 Thread Tom Lane
Magnus Hagander [EMAIL PROTECTED] writes:
 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.

Looks reasonable to me.

regards, tom lane

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [HACKERS] Need help with autoconf

2007-07-12 Thread Magnus Hagander
On Thu, Jul 12, 2007 at 09:54:28AM -0400, Tom Lane wrote:
 Magnus Hagander [EMAIL PROTECTED] writes:
  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.
 
 Looks reasonable to me.

Thanks, applied and backpatched to 8.2.

I didn't backpatch past 8.2, since I've only seen the bug affecting Windows
systems. Though it's actually incorrect code in 8.1 and earlier as well, I
figured we'd better leave it alone for now.

//Magnus

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [HACKERS] Need help with autoconf

2007-07-11 Thread Tom Lane
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?

regards, tom lane

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [HACKERS] Need help with autoconf

2007-07-11 Thread Magnus Hagander
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.
Also, if it just checks for a function with zero arguments, decorated
and non-decorated look the same.

//magnus

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [HACKERS] Need help with autoconf

2007-07-11 Thread Tom Lane
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.

regards, tom lane

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly