tech-pkg archive

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

Re: So I found "struct options"



HAVE_NBCOMPAT_GETOPT_LONG needs to be defined before "struct options ..." becomes available in a header file. The recent changes to libnbcompat removed any way for this symbol to be defined.

With regard to failing to link getopt_long properly, I changed line 71 of getopt_long.h from

#elif HAVE_NBTOOL_CONFIG_H && !HAVE_DECL_OPTRESET

to

#elif (HAVE_NBTOOL_CONFIG_H || HAVE_NBCOMPAT_H) && !HAVE_DECL_OPTRESET

I have no idea if any of this is actually correct, but it works for me (don't you hate it when people say that). pax builds, so I assume everything else will as well.

I don't know what the various preprocessor symbols mean and I don't know what the various getopt compatibility problems are that libnbcompat needs to fix, and it doesn't seem to be documented in configure.ac.

I've attached my diffs just in case they are useful to anyone.

Cheers,
Lloyd
diff -ur orig/pkgsrc-2009Q1/pkgtools/libnbcompat/files/configure.ac 
pkgsrc-2009Q1/pkgtools/libnbcompat/files/configure.ac
--- orig/pkgsrc-2009Q1/pkgtools/libnbcompat/files/configure.ac  Mon Mar 23 
11:33:13 2009
+++ pkgsrc-2009Q1/pkgtools/libnbcompat/files/configure.ac       Thu Apr 16 
10:53:52 2009
@@ -148,12 +148,14 @@
 ])
 
 
-AC_CHECK_HEADERS([getopt.h], [
-       AC_MSG_TRY_COMPILE([for struct option], pkg_cv_have_struct_option,
-               [ #include <getopt.h> ], [ struct option X; ],
-               [:],
-               [AC_LIBOBJ(getopt_long)])
-])
+AC_CHECK_HEADERS([getopt.h],
+       [ AC_CHECK_TYPES([struct option],
+           [:],
+           [ AC_LIBOBJ(getopt_long)],
+           [#include <getopt.h>])],
+       [ AC_LIBOBJ(getopt_long)
+         pkg_use_nbcompat_getopt_long=yes]
+)
 
 if test "$enable_bsd_getopt" = yes; then
        if test "$ac_cv_have_decl_optreset" = no; then
@@ -161,6 +163,15 @@
        fi
 fi
 
+if test $pkg_use_nbcompat_getopt_long = yes; then
+       AC_DEFINE(HAVE_NBCOMPAT_GETOPT_LONG)
+       AH_TEMPLATE([HAVE_NBCOMPAT_GETOPT_LONG], [
+               Define to 1 if the `getopt_long' function is
+               built into the library.
+       ])
+fi
+
+
 dnl Check that this vis.h has *vis()-related functions because Solaris'
 dnl vis.h doesn't.  Also, only consider the header found if it defines
 dnl all of the functions that we need.
Common subdirectories: orig/pkgsrc-2009Q1/pkgtools/libnbcompat/files/db and 
pkgsrc-2009Q1/pkgtools/libnbcompat/files/db
diff -ur orig/pkgsrc-2009Q1/pkgtools/libnbcompat/files/getopt_long.c 
pkgsrc-2009Q1/pkgtools/libnbcompat/files/getopt_long.c
--- orig/pkgsrc-2009Q1/pkgtools/libnbcompat/files/getopt_long.c Mon Mar 23 
11:33:13 2009
+++ pkgsrc-2009Q1/pkgtools/libnbcompat/files/getopt_long.c      Thu Apr 16 
11:12:30 2009
@@ -68,7 +68,7 @@
 int    optopt = '?';           /* character checked for validity */
 int    optreset;               /* reset getopt */
 char    *optarg;               /* argument associated with option */
-#elif HAVE_NBTOOL_CONFIG_H && !HAVE_DECL_OPTRESET
+#elif (HAVE_NBTOOL_CONFIG_H || HAVE_NBCOMPAT_H) && !HAVE_DECL_OPTRESET
 int optreset;
 #endif
 


Home | Main Index | Thread Index | Old Index