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 endian.h and use it...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e8aa91587676
branches:  trunk
changeset: 570049:e8aa91587676
user:      obache <obache%pkgsrc.org@localhost>
date:      Sun Jan 24 12:41:21 2010 +0000

description:
* 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:

 pkgtools/libnbcompat/files/configure            |  141 +++++++++++++++++++----
 pkgtools/libnbcompat/files/configure.ac         |   10 +-
 pkgtools/libnbcompat/files/nbcompat/config.h.in |   10 +-
 pkgtools/libnbcompat/files/nbcompat/endian.h    |   10 +-
 4 files changed, 132 insertions(+), 39 deletions(-)

diffs (286 lines):

diff -r f00b4b7b0f1a -r e8aa91587676 pkgtools/libnbcompat/files/configure
--- a/pkgtools/libnbcompat/files/configure      Sun Jan 24 12:29:48 2010 +0000
+++ b/pkgtools/libnbcompat/files/configure      Sun Jan 24 12:41:21 2010 +0000
@@ -4230,8 +4230,9 @@
 
 
 
-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 @@
 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 @@
 
 
 
-
-{ $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_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket  $LIBS"
+{ $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_func_search_save_LIBS=$LIBS
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10785,7 +10856,14 @@
   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 @@
         test "$cross_compiling" = yes ||
         $as_test_x conftest$ac_exeext
        }; then
-  ac_cv_lib_socket_socket=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_socket_socket=no
+  ac_cv_search_socket=$ac_res
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
 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
-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"
+      conftest$ac_exeext
+  if test "${ac_cv_search_socket+set}" = set; then
+  break
+fi
+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 -r f00b4b7b0f1a -r e8aa91587676 pkgtools/libnbcompat/files/configure.ac
--- a/pkgtools/libnbcompat/files/configure.ac   Sun Jan 24 12:29:48 2010 +0000
+++ b/pkgtools/libnbcompat/files/configure.ac   Sun Jan 24 12:41:21 2010 +0000
@@ -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_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 @@
        [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 @@
        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 -r f00b4b7b0f1a -r e8aa91587676 pkgtools/libnbcompat/files/nbcompat/config.h.in
--- a/pkgtools/libnbcompat/files/nbcompat/config.h.in   Sun Jan 24 12:29:48 2010 +0000
+++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in   Sun Jan 24 12:41:21 2010 +0000
@@ -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 -r f00b4b7b0f1a -r e8aa91587676 pkgtools/libnbcompat/files/nbcompat/endian.h
--- a/pkgtools/libnbcompat/files/nbcompat/endian.h      Sun Jan 24 12:29:48 2010 +0000
+++ b/pkgtools/libnbcompat/files/nbcompat/endian.h      Sun Jan 24 12:41:21 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index