Author: rfm
Date: Sat May 14 16:47:43 2016
New Revision: 39763

URL: http://svn.gna.org/viewcvs/gnustep?rev=39763&view=rev
Log:
Simplify bfd code

Modified:
    libs/base/trunk/ChangeLog
    libs/base/trunk/Headers/GNUstepBase/config.h.in
    libs/base/trunk/Source/NSException.m
    libs/base/trunk/configure
    libs/base/trunk/configure.ac

Modified: libs/base/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=39763&r1=39762&r2=39763&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog   (original)
+++ libs/base/trunk/ChangeLog   Sat May 14 16:47:43 2016
@@ -1,3 +1,12 @@
+2016-05-14  Richard Frith-Macdonald <r...@gnu.org>
+
+        * Headers/GNUstepBase/config.h.in:
+        * Source/NSException.m:
+        * configure.ac:
+        * configure:
+       Make USE_BFD control usage of libbfd and replace runtime warning with
+       a configure time warning about the license issue.
+
 2016-05-14  Richard Frith-Macdonald <r...@gnu.org>
 
        * Headers/Foundation/NSNotification.h:

Modified: libs/base/trunk/Headers/GNUstepBase/config.h.in
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Headers/GNUstepBase/config.h.in?rev=39763&r1=39762&r2=39763&view=diff
==============================================================================
--- libs/base/trunk/Headers/GNUstepBase/config.h.in     (original)
+++ libs/base/trunk/Headers/GNUstepBase/config.h.in     Sat May 14 16:47:43 2016
@@ -841,6 +841,9 @@
 
 /* Define if the compiler provides builtins for atomic operations */
 #undef USE_ATOMIC_BUILTINS
+
+/* Define to use bfd library for stack traces */
+#undef USE_BFD
 
 /* Define if using the ffcall library for invocations */
 #undef USE_FFCALL

Modified: libs/base/trunk/Source/NSException.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSException.m?rev=39763&r1=39762&r2=39763&view=diff
==============================================================================
--- libs/base/trunk/Source/NSException.m        (original)
+++ libs/base/trunk/Source/NSException.m        Sat May 14 16:47:43 2016
@@ -62,25 +62,18 @@
 
 #ifdef HAVE_BACKTRACE
 #include <execinfo.h>
-#ifdef USE_BINUTILS
-#undef USE_BINUTILS
-#endif
-#else
-#ifndef USE_BINUTILS
-#define        USE_BINUTILS    1
-#endif
 #endif
 
 /*
- * Turn off USE_BINUTILS if we don't have bfd support for it.
+ * Turn off USE_BFD if we don't have bfd support for it.
  */
 #if !(defined(HAVE_BFD_H) && defined(HAVE_LIBBFD) && defined(HAVE_LIBIBERTY))
-#if    defined(USE_BINUTILS)
-#undef USE_BINUTILS
-#endif
-#endif
-
-#if    defined(_WIN32) && !defined(USE_BINUTILS)
+# if defined(USE_BFD)
+#   undef USE_BFD
+# endif
+#endif
+
+#if    defined(_WIN32) && !defined(USE_BFD)
 #include <windows.h>
 #if    defined(HAVE_DBGHELP_H)
 #include <dbghelp.h>
@@ -132,7 +125,7 @@
 
 
 #if    defined(_WIN32)
-#if    defined(USE_BINUTILS)
+#if    defined(USE_BFD)
 static NSString *
 GSPrivateBaseAddress(void *addr, void **base)
 {
@@ -158,12 +151,12 @@
     }
   return nil;
 }
-#endif  /* USE_BINUTILS */
+#endif  /* USE_BFD */
 #else  /* _WIN32 */
 
 #include <dlfcn.h>
 
-#if    defined(USE_BINUTILS)
+#if    defined(USE_BFD)
 static NSString *
 GSPrivateBaseAddress(void *addr, void **base)
 {
@@ -180,10 +173,10 @@
   return nil;
 #endif
 }
-#endif  /* USE_BINUTILS */
+#endif  /* USE_BFD */
 #endif /* _WIN32 */
 
-#if    defined(USE_BINUTILS)
+#if    defined(USE_BFD)
 
 // GSStackTrace inspired by  FYStackTrace.m
 // created by Wim Oudshoorn on Mon 11-Apr-2006
@@ -578,14 +571,14 @@
   return result;
 }
 
-#endif /* USE_BINUTILS */
+#endif /* USE_BFD */
 
 
 @implementation GSStackTrace : NSObject
 
 static NSRecursiveLock *traceLock = nil;
 
-#if    defined(_WIN32) && !defined(USE_BINUTILS)
+#if    defined(_WIN32) && !defined(USE_BFD)
 typedef USHORT (WINAPI *CaptureStackBackTraceType)(ULONG,ULONG,PVOID*,PULONG);
 typedef BOOL (WINAPI *SymInitializeType)(HANDLE,char*,BOOL);
 typedef DWORD (WINAPI *SymSetOptionsType)(DWORD);
@@ -642,7 +635,7 @@
 // grab the current stack 
 - (id) init
 {
-#if    defined(USE_BINUTILS)
+#if    defined(USE_BFD)
   addresses = [GSPrivateStackAddresses() copy];
 #elif  defined(_WIN32)
   uint16_t     frames;
@@ -770,7 +763,7 @@
 
       if (count > 0)
        {
-#if    defined(USE_BINUTILS)
+#if    defined(USE_BFD)
          NSMutableArray        *a;
          NSUInteger            i;
 
@@ -988,13 +981,12 @@
 
 + (void) initialize
 {
-#if    defined(USE_BINUTILS)
+#if    defined(USE_BFD)
   if (modLock == nil)
     {
       modLock = [NSRecursiveLock new];
     }
-  NSLog(@"WARNING this copy of gnustep-base has been built with libbfd to 
provide symbolic stacktrace support. This means that the license of this copy 
of gnustep-base is GPL rather than the normal LGPL license (since libbfd is 
released under the GPL license).  If this is not what you want, please obtain a 
copy of gnustep-base which was not configured with the --enable-bfd option");
-#endif /* USE_BINUTILS */
+#endif /* USE_BFD */
 #if defined(_NATIVE_OBJC_EXCEPTIONS)
 #  ifdef HAVE_SET_UNCAUGHT_EXCEPTION_HANDLER
   objc_setUncaughtExceptionHandler(callUncaughtHandler);

Modified: libs/base/trunk/configure
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/configure?rev=39763&r1=39762&r2=39763&view=diff
==============================================================================
--- libs/base/trunk/configure   (original)
+++ libs/base/trunk/configure   Sat May 14 16:47:43 2016
@@ -5418,7 +5418,7 @@
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -5464,7 +5464,7 @@
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -5488,7 +5488,7 @@
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -5533,7 +5533,7 @@
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -5557,7 +5557,7 @@
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -8673,17 +8673,22 @@
 #--------------------------------------------------------------------
 # These headers/functions needed for stacktrace in NSException.m
 #--------------------------------------------------------------------
-PASS_ARG=no
 # Check whether --enable-bfd was given.
 if test "${enable_bfd+set}" = set; then :
   enableval=$enable_bfd;
 else
-  enable_bfd=$PASS_ARG
-fi
-
-
-if test $enable_bfd = yes; then
-  for ac_header in bfd.h
+  enable_bfd=no
+fi
+
+if test $enable_bfd = yes ; then
+
+$as_echo "#define USE_BFD 1" >>confdefs.h
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You enabled bfd, which 
causes gnustep-base to link with libbfd. This makes the license GPL rather than 
the normal LGPL." >&5
+$as_echo "$as_me: WARNING: You enabled bfd, which causes gnustep-base to link 
with libbfd. This makes the license GPL rather than the normal LGPL." >&2;}
+fi
+
+for ac_header in bfd.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" 
"$ac_includes_default"
 if test "x$ac_cv_header_bfd_h" = xyes; then :
@@ -8695,7 +8700,7 @@
 
 done
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libintl_fprintf in 
-lintl" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libintl_fprintf in 
-lintl" >&5
 $as_echo_n "checking for libintl_fprintf in -lintl... " >&6; }
 if ${ac_cv_lib_intl_libintl_fprintf+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8740,7 +8745,7 @@
 
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dyn_string_append in 
-liberty" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dyn_string_append in 
-liberty" >&5
 $as_echo_n "checking for dyn_string_append in -liberty... " >&6; }
 if ${ac_cv_lib_iberty_dyn_string_append+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8785,7 +8790,7 @@
 
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
 $as_echo_n "checking for bfd_openr in -lbfd... " >&6; }
 if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -8830,9 +8835,8 @@
 
 fi
 
-else
-  if test $ismingw = yes ; then
-    for ac_header in dbghelp.h
+if test $ismingw = yes ; then
+  for ac_header in dbghelp.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "dbghelp.h" "ac_cv_header_dbghelp_h" 
"$ac_includes_default"
 if test "x$ac_cv_header_dbghelp_h" = xyes; then :
@@ -8844,8 +8848,8 @@
 
 done
 
-  else
-    for ac_header in execinfo.h
+else
+  for ac_header in execinfo.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" 
"ac_cv_header_execinfo_h" "$ac_includes_default"
 if test "x$ac_cv_header_execinfo_h" = xyes; then :
@@ -8857,7 +8861,7 @@
 
 done
 
-    for ac_func in backtrace
+  for ac_func in backtrace
 do :
   ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace"
 if test "x$ac_cv_func_backtrace" = xyes; then :
@@ -8868,8 +8872,8 @@
 fi
 done
 
-  fi
-fi
+fi
+
 for ac_func in __builtin_extract_return_address
 do :
   ac_fn_c_check_func "$LINENO" "__builtin_extract_return_address" 
"ac_cv_func___builtin_extract_return_address"
@@ -12345,7 +12349,8 @@
 
 
 if test $HAVE_LIBDISPATCH = 1; then
-  # We check whether we
+  # We check whether we have a variant of libdispatch that allows runloop
+  # integration
   for ac_func in dispatch_main_queue_drain_np dispatch_get_main_queue_handle_np
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`

Modified: libs/base/trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/configure.ac?rev=39763&r1=39762&r2=39763&view=diff
==============================================================================
--- libs/base/trunk/configure.ac        (original)
+++ libs/base/trunk/configure.ac        Sat May 14 16:47:43 2016
@@ -2242,7 +2242,6 @@
 #--------------------------------------------------------------------
 # These headers/functions needed for stacktrace in NSException.m
 #--------------------------------------------------------------------
-PASS_ARG=no
 AC_ARG_ENABLE(bfd,
   [  --enable-bfd
        Enables the use of libbfd to provide symbolic stack traces.
@@ -2251,21 +2250,23 @@
        available or does not work properly.
        Enabling this option also has the effect of changing the license
        of gnustep-base from LGPL to GPL since libbfd uses the GPL license],,
-  enable_bfd=$PASS_ARG)
-
-if test $enable_bfd = yes; then
-  AC_CHECK_HEADERS(bfd.h)
-  AC_CHECK_LIB(intl, libintl_fprintf)
-  AC_CHECK_LIB(iberty, dyn_string_append)
-  AC_CHECK_LIB(bfd, bfd_openr)
-else
-  if test $ismingw = yes ; then
-    AC_CHECK_HEADERS(dbghelp.h)
-  else
-    AC_CHECK_HEADERS(execinfo.h)
-    AC_CHECK_FUNCS(backtrace)
-  fi
-fi
+  enable_bfd=no)
+if test $enable_bfd = yes ; then
+  AC_DEFINE(USE_BFD,1, [Define to use bfd library for stack traces])
+  AC_MSG_WARN([You enabled bfd, which causes gnustep-base to link with libbfd. 
This makes the license GPL rather than the normal LGPL.])
+fi
+
+AC_CHECK_HEADERS(bfd.h)
+AC_CHECK_LIB(intl, libintl_fprintf)
+AC_CHECK_LIB(iberty, dyn_string_append)
+AC_CHECK_LIB(bfd, bfd_openr)
+if test $ismingw = yes ; then
+  AC_CHECK_HEADERS(dbghelp.h)
+else
+  AC_CHECK_HEADERS(execinfo.h)
+  AC_CHECK_FUNCS(backtrace)
+fi
+
 AC_CHECK_FUNCS(__builtin_extract_return_address)
 
 #--------------------------------------------------------------------


_______________________________________________
Gnustep-cvs mailing list
Gnustep-cvs@gna.org
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to