summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorerh <erh@pkgsrc.org>2003-12-05 15:43:10 +0000
committererh <erh@pkgsrc.org>2003-12-05 15:43:10 +0000
commitd5b08e455bd1175bb3fc63faaf2cdeba5c9ef714 (patch)
tree378b515dfd2d231079d5c5f3a09f480976d8db31 /pkgtools
parent059ec43e2d3fbb4283390c386fcbe2be3a2b0e44 (diff)
downloadpkgsrc-d5b08e455bd1175bb3fc63faaf2cdeba5c9ef714.tar.gz
Check for setenv and unsetenv independantly since setenv presence doesn't
always imply unsetenv.
Diffstat (limited to 'pkgtools')
-rwxr-xr-xpkgtools/libnbcompat/files/configure94
-rw-r--r--pkgtools/libnbcompat/files/configure.ac10
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/config.h.in3
-rw-r--r--pkgtools/libnbcompat/files/setenv.c8
4 files changed, 109 insertions, 6 deletions
diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure
index 8b344366f38..edd151d7408 100755
--- a/pkgtools/libnbcompat/files/configure
+++ b/pkgtools/libnbcompat/files/configure
@@ -6322,10 +6322,9 @@ done
-
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 @@ else
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 --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac
index f0d45d50482..a323e80e0f5 100644
--- a/pkgtools/libnbcompat/files/configure.ac
+++ b/pkgtools/libnbcompat/files/configure.ac
@@ -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_FUNC_VPRINTF
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])
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 --git a/pkgtools/libnbcompat/files/nbcompat/config.h.in b/pkgtools/libnbcompat/files/nbcompat/config.h.in
index 7751f12cb39..f629586ca04 100644
--- a/pkgtools/libnbcompat/files/nbcompat/config.h.in
+++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in
@@ -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 --git a/pkgtools/libnbcompat/files/setenv.c b/pkgtools/libnbcompat/files/setenv.c
index 2e74462b989..84598ab6314 100644
--- a/pkgtools/libnbcompat/files/setenv.c
+++ b/pkgtools/libnbcompat/files/setenv.c
@@ -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 @@ __findenv(name, offset)
return(NULL);
}
+#if !HAVE_SETENV
/*
* setenv --
* Set the value of the environmental variable "name" to be
@@ -134,7 +135,9 @@ setenv(name, value, rewrite)
;
return (0);
}
+#endif /* !HAVE_SETENV */
+#if !HAVE_UNSETENV
/*
* unsetenv(name) --
* Delete environmental variable "name".
@@ -153,3 +156,4 @@ unsetenv(name)
if (!(*P = *(P + 1)))
break;
}
+#endif /* !HAVE_UNSETENV */