summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrant <grant>2004-04-20 12:13:05 +0000
committergrant <grant>2004-04-20 12:13:05 +0000
commiteed3e1721fdc036d48419c18a2a90aea6f2e301d (patch)
treed75cce21ffbb790eb23f9e38ade70d5e7efcdd9b
parent611d138097c24082bc2b753d8ab1a5a57b3ce2de (diff)
downloadpkgsrc-eed3e1721fdc036d48419c18a2a90aea6f2e301d.tar.gz
workaround poll() being a compatibility function on Darwin 7
(MacOSX 10.3) by adding a custom test for _POLL_EMUL_H_ which is defined in poll.h on some MacOSX 10.3 systems. not all 10.3 systems have poll.h, so only do the poll() test if at least one of the header files is found.
-rwxr-xr-xpkgtools/libnbcompat/files/configure361
-rw-r--r--pkgtools/libnbcompat/files/configure.ac43
-rw-r--r--pkgtools/libnbcompat/files/nbcompat.h12
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/config.h.in6
4 files changed, 404 insertions, 18 deletions
diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure
index b0c9212f8fa..a98f923b6e7 100755
--- a/pkgtools/libnbcompat/files/configure
+++ b/pkgtools/libnbcompat/files/configure
@@ -3295,15 +3295,13 @@ done
-
-
for ac_header in arpa/nameser.h assert.h bind/bitypes.h dirent.h err.h \
errno.h fcntl.h fts.h inttypes.h libutil.h limits.h \
machine/endian.h memory.h ndir.h netdb.h netinet/in6_machtypes.h \
- paths.h poll.h pwd.h stdint.h stdlib.h stringlist.h strings.h \
+ paths.h pwd.h stdint.h stdlib.h stringlist.h strings.h \
string.h sys/bitypes.h sys/byteorder.h sys/cdefs.h sys/dir.h \
sys/endian.h sys/file.h sys/mkdev.h sys/ndir.h \
- sys/param.h sys/poll.h sys/queue.h sys/time.h sys/ttycom.h \
+ sys/param.h sys/queue.h sys/time.h sys/ttycom.h \
sys/stat.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/types.h \
sys/vfs.h termcap.h termios.h time.h tzfile.h unistd.h util.h \
utmp.h
@@ -6965,10 +6963,9 @@ done
-
for ac_func in err fgetln fparseln fseeko getenv inet_ntop \
inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \
- poll setprogname snprintf strdup strerror strlcat strlcpy \
+ setprogname snprintf strdup strerror strlcat strlcpy \
strmode strptime strsep strtoll timegm usleep utimes
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -8302,6 +8299,358 @@ esac
fi
+# handle Darwin 7 having a poll() compatibility function. be
+# conservative, if we don't find one of poll.h or sys/poll.h, use our
+# local poll() implementation.
+pkg_use_nbcompat_poll=no
+
+
+for ac_header in poll.h sys/poll.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $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. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 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_objext'
+ { (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
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $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 <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------- ##
+## Report this to grant@NetBSD.org ##
+## ------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+if test $ac_cv_header_poll_h = no && test $ac_cv_header_sys_poll_h = no; then
+ pkg_use_nbcompat_poll=yes
+fi
+
+if test $pkg_use_nbcompat_poll = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_NBCOMPAT_POLL 1
+_ACEOF
+
+
+
+ case $LIBOBJS in
+ "poll.$ac_objext" | \
+ *" poll.$ac_objext" | \
+ "poll.$ac_objext "* | \
+ *" poll.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS poll.$ac_objext" ;;
+esac
+
+else
+ echo "$as_me:$LINENO: checking for poll" >&5
+echo $ECHO_N "checking for poll... $ECHO_C" >&6
+if test "${ac_cv_func_poll+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define poll to an innocuous variant, in case <limits.h> declares poll.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define poll innocuous_poll
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char poll (); 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
+
+#undef poll
+
+/* 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 poll ();
+/* 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_poll) || defined (__stub___poll)
+choke me
+#else
+char (*f) () = poll;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != poll;
+ ;
+ 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
+ ac_cv_func_poll=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_poll=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_poll" >&5
+echo "${ECHO_T}$ac_cv_func_poll" >&6
+if test $ac_cv_func_poll = yes; then
+
+
+ echo "$as_me:$LINENO: checking if poll() is implemented natively" >&5
+echo $ECHO_N "checking if poll() is implemented natively... $ECHO_C" >&6
+if test "${pkg_cv_POLL_COMPAT+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+ #if HAVE_POLL_H
+ #include <poll.h>
+ #endif
+ #if HAVE_SYS_POLL_H
+ #include <sys/poll.h>
+ #endif
+
+int
+main ()
+{
+ #ifdef _POLL_EMUL_H_
+ #error "poll() is emulated"
+ #endif
+ ;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 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_objext'
+ { (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
+ pkg_cv_POLL_COMPAT=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ pkg_cv_POLL_COMPAT=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $pkg_cv_POLL_COMPAT" >&5
+echo "${ECHO_T}$pkg_cv_POLL_COMPAT" >&6
+ if test "x$pkg_cv_POLL_COMPAT" = "xyes"; then
+ :
+ else
+ case $LIBOBJS in
+ "poll.$ac_objext" | \
+ *" poll.$ac_objext" | \
+ "poll.$ac_objext "* | \
+ *" poll.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS poll.$ac_objext" ;;
+esac
+
+ :
+ fi
+
+
+fi
+
+fi
+
diff --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac
index ce59a544049..0b7c3b4b707 100644
--- a/pkgtools/libnbcompat/files/configure.ac
+++ b/pkgtools/libnbcompat/files/configure.ac
@@ -1,4 +1,4 @@
-dnl $NetBSD: configure.ac,v 1.41 2004/04/20 10:45:48 grant Exp $
+dnl $NetBSD: configure.ac,v 1.42 2004/04/20 12:13:05 grant Exp $
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
@@ -35,10 +35,10 @@ AC_HEADER_TIME
AC_CHECK_HEADERS([arpa/nameser.h assert.h bind/bitypes.h dirent.h err.h \
errno.h fcntl.h fts.h inttypes.h libutil.h limits.h \
machine/endian.h memory.h ndir.h netdb.h netinet/in6_machtypes.h \
- paths.h poll.h pwd.h stdint.h stdlib.h stringlist.h strings.h \
+ paths.h pwd.h stdint.h stdlib.h stringlist.h strings.h \
string.h sys/bitypes.h sys/byteorder.h sys/cdefs.h sys/dir.h \
sys/endian.h sys/file.h sys/mkdev.h sys/ndir.h \
- sys/param.h sys/poll.h sys/queue.h sys/time.h sys/ttycom.h \
+ sys/param.h sys/queue.h sys/time.h sys/ttycom.h \
sys/stat.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/types.h \
sys/vfs.h termcap.h termios.h time.h tzfile.h unistd.h util.h \
utmp.h])
@@ -137,7 +137,7 @@ AC_FUNC_VPRINTF
AC_REPLACE_FUNCS([err fgetln fparseln fseeko getenv inet_ntop \
inet_pton isblank lchflags lchmod lchown lutimes mkstemp mkdtemp \
- poll setprogname snprintf strdup strerror strlcat strlcpy \
+ setprogname snprintf strdup strerror strlcat strlcpy \
strmode strptime strsep strtoll timegm usleep utimes])
AC_CHECK_FUNCS([setgroupent setgrent setpassent setpwent])
@@ -183,6 +183,41 @@ AC_CHECK_FUNC(SHA1File, [:], [
AC_LIBOBJ(sha1hl)
])
+# handle Darwin 7 having a poll() compatibility function. be
+# conservative, if we don't find one of poll.h or sys/poll.h, use our
+# local poll() implementation.
+pkg_use_nbcompat_poll=no
+AC_CHECK_HEADERS([poll.h sys/poll.h])
+
+if test $ac_cv_header_poll_h = no && test $ac_cv_header_sys_poll_h = no; then
+ pkg_use_nbcompat_poll=yes
+fi
+
+if test $pkg_use_nbcompat_poll = yes; then
+ AC_DEFINE(HAVE_NBCOMPAT_POLL, 1)
+ AH_TEMPLATE([HAVE_NBCOMPAT_POLL], [
+ Define to 1 if the `poll' function is built into the library.
+ ])
+ AC_LIBOBJ(poll)
+else
+ AC_CHECK_FUNC(poll, [
+ AC_MSG_TRY_COMPILE([if poll() is implemented natively],
+ pkg_cv_POLL_COMPAT,
+ [ #if HAVE_POLL_H
+ #include <poll.h>
+ #endif
+ #if HAVE_SYS_POLL_H
+ #include <sys/poll.h>
+ #endif
+ ],
+ [ #ifdef _POLL_EMUL_H_
+ #error "poll() is emulated"
+ #endif
+ ],
+ [:], [AC_LIBOBJ(poll)])
+])
+fi
+
AC_CHECK_FUNCS([strunvis strvis strsvis])
AC_CHECK_FUNCS([strunvis strvis strsvis],
[pkg_use_nbcompat_vis=no],
diff --git a/pkgtools/libnbcompat/files/nbcompat.h b/pkgtools/libnbcompat/files/nbcompat.h
index ad77c2e4275..213c1368174 100644
--- a/pkgtools/libnbcompat/files/nbcompat.h
+++ b/pkgtools/libnbcompat/files/nbcompat.h
@@ -1,4 +1,4 @@
-/* $NetBSD: nbcompat.h,v 1.32 2004/03/11 13:28:45 grant Exp $ */
+/* $NetBSD: nbcompat.h,v 1.33 2004/04/20 12:13:05 grant Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -66,10 +66,12 @@
#include <termios.h>
#include <unistd.h>
-#if HAVE_POLL_H
-# include <poll.h>
-#elif HAVE_SYS_POLL_H
-# include <sys/poll.h>
+#if HAVE_POLL
+# if HAVE_POLL_H
+# include <poll.h>
+# elif HAVE_SYS_POLL_H
+# include <sys/poll.h>
+# endif
#else
# include <nbcompat/poll.h>
#endif
diff --git a/pkgtools/libnbcompat/files/nbcompat/config.h.in b/pkgtools/libnbcompat/files/nbcompat/config.h.in
index 34599482be9..90888591a6f 100644
--- a/pkgtools/libnbcompat/files/nbcompat/config.h.in
+++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in
@@ -158,6 +158,9 @@
/* Define to 1 if the `MD5Init' function is built into the library. */
#undef HAVE_NBCOMPAT_MD5INIT
+/* Define to 1 if the `poll' function is built into the library. */
+#undef HAVE_NBCOMPAT_POLL
+
/* Define to 1 if the `statfs' function is built into the library. */
#undef HAVE_NBCOMPAT_STATFS
@@ -182,9 +185,6 @@
/* Define to 1 if you have the <paths.h> header file. */
#undef HAVE_PATHS_H
-/* Define to 1 if you have the `poll' function. */
-#undef HAVE_POLL
-
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H