summaryrefslogtreecommitdiff
path: root/pkgtools/libnbcompat
diff options
context:
space:
mode:
authorobache <obache@pkgsrc.org>2010-01-24 12:41:21 +0000
committerobache <obache@pkgsrc.org>2010-01-24 12:41:21 +0000
commit628ebd9b67d578dd32d9e570227602ef9e40fab2 (patch)
tree3e1501df049a9a046988b56e9b38699790b3f24b /pkgtools/libnbcompat
parent2f1abdecebf8ebdd7b61af8a58de1da971631b8a (diff)
downloadpkgsrc-628ebd9b67d578dd32d9e570227602ef9e40fab2.tar.gz
* check endian.h and use it if available, for Haiku.
* check optarg, it is used in nbcompat/unistd.h, but not checked. * check socket() in -lnetwork in addition to -lsocket, for Haiku.
Diffstat (limited to 'pkgtools/libnbcompat')
-rwxr-xr-xpkgtools/libnbcompat/files/configure127
-rw-r--r--pkgtools/libnbcompat/files/configure.ac10
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/config.h.in10
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/endian.h10
4 files changed, 125 insertions, 32 deletions
diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure
index 93b56a4220d..4f236df5532 100755
--- a/pkgtools/libnbcompat/files/configure
+++ b/pkgtools/libnbcompat/files/configure
@@ -4230,8 +4230,9 @@ fi
-for ac_header in alloca.h assert.h ctype.h dirent.h err.h errno.h fcntl.h \
- fnmatch.h fts.h grp.h inttypes.h libutil.h limits.h \
+
+for ac_header in alloca.h assert.h ctype.h dirent.h endian.h err.h errno.h \
+ fcntl.h fnmatch.h fts.h grp.h inttypes.h libutil.h limits.h \
machine/endian.h ndir.h netdb.h paths.h pwd.h signal.h \
stdarg.h stddef.h stdint.h stdio.h \
stdlib.h string.h sys/byteorder.h sys/cdefs.h sys/dir.h sys/endian.h \
@@ -5992,6 +5993,78 @@ if test "${enable_bsd_getopt+set}" = set; then
fi
+{ $as_echo "$as_me:$LINENO: checking whether optarg is declared" >&5
+$as_echo_n "checking whether optarg is declared... " >&6; }
+if test "${ac_cv_have_decl_optarg+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+
+
+int
+main ()
+{
+#ifndef optarg
+ (void) optarg;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_optarg=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_optarg=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_optarg" >&5
+$as_echo "$ac_cv_have_decl_optarg" >&6; }
+if test "x$ac_cv_have_decl_optarg" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_OPTARG 1
+_ACEOF
+
+:
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_OPTARG 0
+_ACEOF
+
+:
+fi
{ $as_echo "$as_me:$LINENO: checking whether optind is declared" >&5
$as_echo_n "checking whether optind is declared... " >&6; }
if test "${ac_cv_have_decl_optind+set}" = set; then
@@ -10755,14 +10828,12 @@ done
-
-{ $as_echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
-$as_echo_n "checking for socket in -lsocket... " >&6; }
-if test "${ac_cv_lib_socket_socket+set}" = set; then
+{ $as_echo "$as_me:$LINENO: checking for library containing socket" >&5
+$as_echo_n "checking for library containing socket... " >&6; }
+if test "${ac_cv_search_socket+set}" = set; then
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10785,7 +10856,14 @@ return socket ();
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
+for ac_lib in '' socket network; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
@@ -10806,27 +10884,34 @@ $as_echo "$ac_try_echo") >&5
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
- ac_cv_lib_socket_socket=yes
+ ac_cv_search_socket=$ac_res
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_socket_socket=no
+
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if test "${ac_cv_search_socket+set}" = set; then
+ break
fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
-$as_echo "$ac_cv_lib_socket_socket" >&6; }
-if test "x$ac_cv_lib_socket_socket" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSOCKET 1
-_ACEOF
-
- LIBS="-lsocket $LIBS"
+done
+if test "${ac_cv_search_socket+set}" = set; then
+ :
+else
+ ac_cv_search_socket=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_socket" >&5
+$as_echo "$ac_cv_search_socket" >&6; }
+ac_res=$ac_cv_search_socket
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
diff --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac
index bc71e0a0d5b..0d517c92bca 100644
--- a/pkgtools/libnbcompat/files/configure.ac
+++ b/pkgtools/libnbcompat/files/configure.ac
@@ -1,4 +1,4 @@
-dnl $NetBSD: configure.ac,v 1.74 2009/06/05 19:58:04 joerg Exp $
+dnl $NetBSD: configure.ac,v 1.75 2010/01/24 12:41:21 obache Exp $
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
@@ -33,8 +33,8 @@ AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_STDBOOL
-AC_CHECK_HEADERS([alloca.h assert.h ctype.h dirent.h err.h errno.h fcntl.h \
- fnmatch.h fts.h grp.h inttypes.h libutil.h limits.h \
+AC_CHECK_HEADERS([alloca.h assert.h ctype.h dirent.h endian.h err.h errno.h \
+ fcntl.h fnmatch.h fts.h grp.h inttypes.h libutil.h limits.h \
machine/endian.h ndir.h netdb.h paths.h pwd.h signal.h \
stdarg.h stddef.h stdint.h stdio.h \
stdlib.h string.h sys/byteorder.h sys/cdefs.h sys/dir.h sys/endian.h \
@@ -142,7 +142,7 @@ AC_ARG_ENABLE([bsd-getopt],
[AS_HELP_STRING([--enable-bsd-getopt],
[force use of BSDish getopt implementation])])
-AC_CHECK_DECLS([optind, optreset], [:], [:], [
+AC_CHECK_DECLS([optarg, optind, optreset], [:], [:], [
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -245,7 +245,7 @@ AC_REPLACE_FUNCS([asprintf err fgetln fnmatch fparseln getenv isblank \
strlcat strlcpy strmode strsep strtoll unsetenv usleep utimes warn
])
-AC_CHECK_LIB(socket, socket)
+AC_SEARCH_LIBS(socket, [socket network])
AC_CHECK_LIB(nsl, gethostbyname)
need_getaddrinfo=no
diff --git a/pkgtools/libnbcompat/files/nbcompat/config.h.in b/pkgtools/libnbcompat/files/nbcompat/config.h.in
index 97efe1fcdfc..7412c3bb595 100644
--- a/pkgtools/libnbcompat/files/nbcompat/config.h.in
+++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in
@@ -32,6 +32,10 @@
don't. */
#undef HAVE_DECL_ENDPWENT
+/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
+ */
+#undef HAVE_DECL_OPTARG
+
/* Define to 1 if you have the declaration of `optind', and to 0 if you don't.
*/
#undef HAVE_DECL_OPTIND
@@ -64,6 +68,9 @@
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
+/* Define to 1 if you have the <endian.h> header file. */
+#undef HAVE_ENDIAN_H
+
/* Define to 1 if you have the `err' function. */
#undef HAVE_ERR
@@ -154,9 +161,6 @@
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
-/* Define to 1 if you have the `socket' library (-lsocket). */
-#undef HAVE_LIBSOCKET
-
/* Define to 1 if you have the `util' library (-lutil). */
#undef HAVE_LIBUTIL
diff --git a/pkgtools/libnbcompat/files/nbcompat/endian.h b/pkgtools/libnbcompat/files/nbcompat/endian.h
index 47553ed7ddc..8869de216e7 100644
--- a/pkgtools/libnbcompat/files/nbcompat/endian.h
+++ b/pkgtools/libnbcompat/files/nbcompat/endian.h
@@ -1,4 +1,4 @@
-/* $NetBSD: endian.h,v 1.2 2008/04/29 05:46:08 martin Exp $ */
+/* $NetBSD: endian.h,v 1.3 2010/01/24 12:41:21 obache Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -32,6 +32,10 @@
#ifndef _NBCOMPAT_ENDIAN_H_
#define _NBCOMPAT_ENDIAN_H_
+#if HAVE_ENDIAN_H
+# include <endian.h>
+#endif
+
#if HAVE_SYS_ENDIAN_H
# include <sys/endian.h>
#endif
@@ -45,8 +49,8 @@
#endif
/*
- * Declare macros that may be missing in <sys/endian.h>, <machine/endian.h>,
- * and <sys/byteorder.h>
+ * Declare macros that may be missing in <endian.h>, <sys/endian.h>,
+ * <machine/endian.h> and <sys/byteorder.h>
*/
#ifndef LITTLE_ENDIAN