pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/libnbcompat/files Check for setenv and unsete...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d6f4a3100f67
branches:  trunk
changeset: 464265:d6f4a3100f67
user:      erh <erh%pkgsrc.org@localhost>
date:      Fri Dec 05 15:43:10 2003 +0000

description:
Check for setenv and unsetenv independantly since setenv presence doesn't
always imply unsetenv.

diffstat:

 pkgtools/libnbcompat/files/configure            |  94 ++++++++++++++++++++++++-
 pkgtools/libnbcompat/files/configure.ac         |  10 ++-
 pkgtools/libnbcompat/files/nbcompat/config.h.in |   3 +
 pkgtools/libnbcompat/files/setenv.c             |   8 +-
 4 files changed, 109 insertions(+), 6 deletions(-)

diffs (206 lines):

diff -r 3dcfee7df85c -r d6f4a3100f67 pkgtools/libnbcompat/files/configure
--- a/pkgtools/libnbcompat/files/configure      Fri Dec 05 15:42:13 2003 +0000
+++ b/pkgtools/libnbcompat/files/configure      Fri Dec 05 15:43:10 2003 +0000
@@ -6322,10 +6322,9 @@
 
 
 
-
 for ac_func in err fgetln fparseln fseeko getenv glob inet_ntop \
        inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \
-       poll setenv setprogname snprintf strdup strerror strlcat strlcpy \
+       poll setprogname snprintf strdup strerror strlcat strlcpy \
        strmode strptime strsep strtoll timegm usleep
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -6760,10 +6759,101 @@
 fi
 done
 
+pkg_use_nbcompat_setenv=no
+
+
+for ac_func in setenv unsetenv
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 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
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  pkg_use_nbcompat_setenv=yes
+fi
+done
+
 
 if test $pkg_use_nbcompat_setmode = yes; then
        LIBOBJS="$LIBOBJS setmode.$ac_objext"
 fi
+if test $pkg_use_nbcompat_setenv = yes; then
+       LIBOBJS="$LIBOBJS setenv.$ac_objext"
+fi
 
 
 
diff -r 3dcfee7df85c -r d6f4a3100f67 pkgtools/libnbcompat/files/configure.ac
--- a/pkgtools/libnbcompat/files/configure.ac   Fri Dec 05 15:42:13 2003 +0000
+++ b/pkgtools/libnbcompat/files/configure.ac   Fri Dec 05 15:43:10 2003 +0000
@@ -1,4 +1,4 @@
-dnl $NetBSD: configure.ac,v 1.30 2003/09/16 16:48:25 grant Exp $
+dnl $NetBSD: configure.ac,v 1.31 2003/12/05 15:43:10 erh Exp $
 
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.52)
@@ -119,7 +119,7 @@
 
 AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv glob inet_ntop \
        inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \
-       poll setenv setprogname snprintf strdup strerror strlcat strlcpy \
+       poll setprogname snprintf strdup strerror strlcat strlcpy \
        strmode strptime strsep strtoll timegm usleep])
 
 AC_CHECK_FUNCS([setgroupent setgrent setpassent setpwent])
@@ -128,10 +128,16 @@
 AC_CHECK_FUNCS([getmode setmode],
        [pkg_use_nbcompat_setmode=no],
        [pkg_use_nbcompat_setmode=yes; break])
+pkg_use_nbcompat_setenv=no
+AC_CHECK_FUNCS([setenv unsetenv], ,
+       [pkg_use_nbcompat_setenv=yes])
 
 if test $pkg_use_nbcompat_setmode = yes; then
        AC_LIBOBJ(setmode)
 fi
+if test $pkg_use_nbcompat_setenv = yes; then
+       AC_LIBOBJ(setenv)
+fi
 
 AC_CHECK_FUNCS([gid_from_group group_from_gid pwcache_groupdb pwcache_userdb \
                uid_from_user user_from_uid])
diff -r 3dcfee7df85c -r d6f4a3100f67 pkgtools/libnbcompat/files/nbcompat/config.h.in
--- a/pkgtools/libnbcompat/files/nbcompat/config.h.in   Fri Dec 05 15:42:13 2003 +0000
+++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in   Fri Dec 05 15:43:10 2003 +0000
@@ -384,6 +384,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the `unsetenv' function. */
+#undef HAVE_UNSETENV
+
 /* Define to 1 if you have the `user_from_uid' function. */
 #undef HAVE_USER_FROM_UID
 
diff -r 3dcfee7df85c -r d6f4a3100f67 pkgtools/libnbcompat/files/setenv.c
--- a/pkgtools/libnbcompat/files/setenv.c       Fri Dec 05 15:42:13 2003 +0000
+++ b/pkgtools/libnbcompat/files/setenv.c       Fri Dec 05 15:43:10 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setenv.c,v 1.7 2003/09/06 23:03:04 grant Exp $ */
+/*     $NetBSD: setenv.c,v 1.8 2003/12/05 15:43:10 erh Exp $   */
 
 /*
  * Copyright (c) 1987 Regents of the University of California.
@@ -31,7 +31,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 /*static char *sccsid = "from: @(#)setenv.c    5.6 (Berkeley) 6/4/91";*/
-static char *rcsid = "$Id: setenv.c,v 1.7 2003/09/06 23:03:04 grant Exp $";
+static char *rcsid = "$Id: setenv.c,v 1.8 2003/12/05 15:43:10 erh Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #if HAVE_CONFIG_H
@@ -74,6 +74,7 @@
        return(NULL);
 }
 
+#if !HAVE_SETENV
 /*
  * setenv --
  *     Set the value of the environmental variable "name" to be
@@ -134,7 +135,9 @@
                ;
        return (0);
 }
+#endif /* !HAVE_SETENV */
 
+#if !HAVE_UNSETENV
 /*
  * unsetenv(name) --
  *     Delete environmental variable "name".
@@ -153,3 +156,4 @@
                        if (!(*P = *(P + 1)))
                                break;
 }
+#endif /* !HAVE_UNSETENV */



Home | Main Index | Thread Index | Old Index