[freetds] HP/UX 11 and configure problem

Frediano Ziglio freddyz77 at tin.it
Sat Apr 5 02:16:26 EST 2003


Il ven, 2003-04-04 alle 18:00, Lowden, James K ha scritto:
> > From: Frediano Ziglio [mailto:freddyz77 at tin.it]
> > Sent: April 4, 2003 9:51 AM
> > 
> > I'm trying to fix mis-detect of getpwuid_r function under HP/UX 11 (as
> > state in previous mail).
> > 
> > I written a small patch (just change AC_CHECK_COMPILE to AC_CHECK_RUN
> > and reorganized). However autogen.sh raise a strage 
> > warning... I'm not a
> > autoconf guru, so if anyone want to revise my patch and/or try it...
> 
> It must be very small indeed, for it is to me invisible....
> 

IMHO ML cut my attachment.
It must be a very clever type of ML that check and delete bad patch
automatically :)

Index: acinclude.m4
===================================================================
RCS file: /cvsroot/freetds/freetds/acinclude.m4,v
retrieving revision 1.16
diff -u -u -1 -0 -b -r1.16 acinclude.m4
--- acinclude.m4        19 Feb 2003 11:38:06 -0000      1.16
+++ acinclude.m4        4 Apr 2003 14:46:13 -0000
@@ -317,62 +317,69 @@
 extern char *malloc_options;
 malloc_options = "AJR";
       ],
      ac_cv_have_malloc_options=yes,
      ac_cv_have_malloc_options=no)])
   if test $ac_cv_have_malloc_options = yes; then
    AC_DEFINE(HAVE_MALLOC_OPTIONS, 1, [Define to 1 if your system
provides the malloc_options variable.])
   fi])
 
 dnl Check getpwuid_r parameters
+dnl There are three version of this function
+dnl   int  getpwuid_r(uid_t uid, struct passwd *result, char *buffer,
int buflen);
+dnl   (hp/ux 10.20, digital unix 4)
+dnl   struct passwd *getpwuid_r(uid_t uid, struct passwd * pwd, char
*buffer, int buflen);
+dnl   (SunOS 5.5, many other)
+dnl   int  getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
size_t buflen, struct passwd **result);
+dnl   (hp/ux 11, many other, posix compliant)
 
 AC_DEFUN(AC_tds_FUNC_WHICH_GETPWUID_R,
 [AC_CACHE_CHECK(for which type of getpwuid_r,
ac_cv_func_which_getpwuid_r, [
-       AC_TRY_COMPILE([
+AC_TRY_COMPILE([
 #include <unistd.h>
 #include <pwd.h>
        ],      [
-struct passwd *pw, bpw;
+struct passwd bpw;
 char buf[1024];
-pw = getpwuid_r(getuid(), &bpw, buf, sizeof(buf));
-
+char *dir = getpwuid_r(getuid(), &bpw, buf, sizeof(buf))->pw_dir;
+],[ac_cv_func_which_getpwuid_r=four
+AC_DEFINE(HAVE_FUNC_GETPWUID_R_4_PW, 1, [Define to 1 if your system
getpwuid_r() have 4 parameters and return struct passwd*.])],
+[AC_TRY_RUN([
+#include <unistd.h>
+#include <pwd.h>
+int main() {
+struct passwd bpw;
+char buf[1024];
+getpwuid_r(getuid(), &bpw, buf, sizeof(buf));
+return 0;
+}
 ],ac_cv_func_which_getpwuid_r=four, 
-  [
-  AC_TRY_COMPILE([
+  [AC_TRY_RUN([
 #include <unistd.h>
 #include <pwd.h>
-  ], [
+int main() {
 struct passwd *pw, bpw;
 char buf[1024];
 getpwuid_r(getuid(), &bpw, buf, sizeof(buf), &pw);
+return 0;
+}
 ],ac_cv_func_which_getpwuid_r=five,
-ac_cv_func_which_getpwuid_r=no)
-
-]
+ac_cv_func_which_getpwuid_r=no)]
+)]
 ) 
-])
 
 if test $ac_cv_func_which_getpwuid_r = four; then
   AC_DEFINE(HAVE_FUNC_GETPWUID_R_4, 1, [Define to 1 if your system
provides the 4-parameter version of getpwuid_r().])
-  AC_TRY_COMPILE([
-#include <unistd.h>
-#include <pwd.h>
-  ], [
-struct passwd bpw;
-char buf[1024];
-char *dir = getpwuid_r(getuid(), &bpw, buf, sizeof(buf))->pw_dir;
-],AC_DEFINE(HAVE_FUNC_GETPWUID_R_4_PW, 1, [Define to 1 if your system
getpwuid_r() have 4 parameters and return struct passwd*.]),
-[])
 elif test $ac_cv_func_which_getpwuid_r = five; then
   AC_DEFINE(HAVE_FUNC_GETPWUID_R_5, 1, [Define to 1 if your system
provides the 5-parameter version of getpwuid_r().])
 fi
-])
+])])
 
 AC_DEFUN(AC_tds_FUNC_WHICH_LOCALTIME_R,
 [AC_CACHE_CHECK(for which type of localtime_r,
ac_cv_func_which_localtime_r, [
        AC_TRY_COMPILE([
 #include <unistd.h>
 #include <time.h>
        ],      [
 struct tm mytm;
 time_t t;
 int y = localtime_r(&t, &mytm)->tm_year;

freddy77




More information about the FreeTDS mailing list