Patchwork [v3] libstdc++/51368

login
register
mail settings
Submitter Benjamin Kosnik
Date Feb. 15, 2012, 8 p.m.
Message ID <20120215120000.1e35960e@shotwell>
Download mbox | patch
Permalink /patch/141401/
State New
Headers show

Comments

Benjamin Kosnik - Feb. 15, 2012, 8 p.m.
As per request, syncs libstdc++ with libjava for installation of python
modules using top-level --with-python-dir configure argument.

I think we are going to need GLIBCXX_ENABLE_PYTHON anyway for the other
python bug report.

-benjamin

tested x86/linux
tested x86/linux --with-python-dir=/share/python

Patch

commit 7087fa3c623191a70de5959ce23dbe004be61caf
Author: bkoz <bkoz@gnu.org>
Date:   Wed Feb 15 11:33:24 2012 -0800

    2012-02-15  Benjamin Kosnik  <bkoz@redhat.com>
    
    	PR libstdc++/51368
    	* acinclude.m4 (GLIBCXX_ENABLE_PYTHON): New.
    	* configure.ac: Use it.
    	* python/Makefile.am: Same.
    	* configure: Regenerate.
    	* python/Makefile.in: Regenerate.
    	* Makefile.in: Same.
    	* doc/Makefile.in: Same.
    	* include/Makefile.in: Same.
    	* po/Makefile.in: Same.
    	* src/Makefile.in: Same.
    	* src/c++11/Makefile.in: Same.
    	* src/c++98/Makefile.in: Same.
    	* testsuite/Makefile.in: Same.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index e089b20..61fdb42 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1737,26 +1737,26 @@  AC_DEFUN([GLIBCXX_CHECK_MATH_PROTO], [
 	     {  return __builtin_fabsf(__x); }
 	   }
 	])],
-        [glibcxx_cv_abs_float=no],
-        [glibcxx_cv_abs_float=yes]
+	[glibcxx_cv_abs_float=no],
+	[glibcxx_cv_abs_float=yes]
       )])
 
       # autoheader cannot handle indented templates.
       AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO1],
-        [/* Define if all C++ overloads are available in <math.h>.  */
+	[/* Define if all C++ overloads are available in <math.h>.  */
 #if __cplusplus >= 199711L
 #undef __CORRECT_ISO_CPP_MATH_H_PROTO1
 #endif])
       AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO2],
-        [/* Define if only double std::abs(double) is available in <math.h>.  */
+	[/* Define if only double std::abs(double) is available in <math.h>.  */
 #if __cplusplus >= 199711L
 #undef __CORRECT_ISO_CPP_MATH_H_PROTO2
 #endif])
 
       if test $glibcxx_cv_abs_float = yes; then
-        AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO1)
+	AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO1)
       else
-        AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO2)
+	AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO2)
       fi
       AC_MSG_RESULT($glibcxx_cv_abs_float)
       ;;
@@ -1787,19 +1787,19 @@  AC_DEFUN([GLIBCXX_CHECK_STDLIB_PROTO], [
 	     inline long
 	     abs(long __i) { return labs(__i); }
 	   }
-        ])],
-        [glibcxx_cv_abs_long=no],
-        [glibcxx_cv_abs_long=yes]
+	])],
+	[glibcxx_cv_abs_long=no],
+	[glibcxx_cv_abs_long=yes]
       )])
 
       # autoheader cannot handle indented templates.
       AH_VERBATIM([__CORRECT_ISO_CPP_STDLIB_H_PROTO],
-        [/* Define if all C++ overloads are available in <stdlib.h>.  */
+	[/* Define if all C++ overloads are available in <stdlib.h>.  */
 #if __cplusplus >= 199711L
 #undef __CORRECT_ISO_CPP_STDLIB_H_PROTO
 #endif])
       if test $glibcxx_cv_abs_long = yes; then
-        AC_DEFINE(__CORRECT_ISO_CPP_STDLIB_H_PROTO, 1)
+	AC_DEFINE(__CORRECT_ISO_CPP_STDLIB_H_PROTO, 1)
       fi
       AC_MSG_RESULT($glibcxx_cv_abs_long)
       ;;
@@ -2495,7 +2495,7 @@  template<typename T>
 
 int main()
 {
-  typename same<double, __float128>::type      f1;	
+  typename same<double, __float128>::type      f1;
   typename same<long double, __float128>::type f2;
 }
 EOF
@@ -2729,7 +2729,7 @@  AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
        atomic_type c3(0);
        __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
        __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
-                                   __ATOMIC_RELAXED);
+				   __ATOMIC_RELAXED);
        __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
        __atomic_load_n(&c1, __ATOMIC_RELAXED);
       ],
@@ -2748,7 +2748,7 @@  AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
        atomic_type c3(0);
        __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
        __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
-                                   __ATOMIC_RELAXED);
+				   __ATOMIC_RELAXED);
        __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
        __atomic_load_n(&c1, __ATOMIC_RELAXED);
       ],
@@ -2767,7 +2767,7 @@  AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
        atomic_type c3(0);
        __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
        __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
-                                   __ATOMIC_RELAXED);
+				   __ATOMIC_RELAXED);
        __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
        __atomic_load_n(&c1, __ATOMIC_RELAXED);
       ],
@@ -2786,7 +2786,7 @@  AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
        atomic_type c3(0);
        __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
        __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
-                                   __ATOMIC_RELAXED);
+				   __ATOMIC_RELAXED);
        __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
        __atomic_load_n(&c1, __ATOMIC_RELAXED);
       ],
@@ -2814,10 +2814,10 @@  int main()
   atomic_type c3(0);
   __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
   __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
-                              __ATOMIC_RELAXED);
+			      __ATOMIC_RELAXED);
   __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
   __atomic_load_n(&c1, __ATOMIC_RELAXED);
- 
+
   return 0;
 }
 EOF
@@ -2843,7 +2843,7 @@  int main()
   atomic_type c3(0);
   __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
   __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
-                              __ATOMIC_RELAXED);
+			      __ATOMIC_RELAXED);
   __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
   __atomic_load_n(&c1, __ATOMIC_RELAXED);
 
@@ -2873,7 +2873,7 @@  int main()
   atomic_type c3(0);
   __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
   __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
-                              __ATOMIC_RELAXED);
+			      __ATOMIC_RELAXED);
   __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
   __atomic_load_n(&c1, __ATOMIC_RELAXED);
 
@@ -2902,7 +2902,7 @@  int main()
   atomic_type c3(0);
   __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
   __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
-                              __ATOMIC_RELAXED);
+			      __ATOMIC_RELAXED);
   __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
   __atomic_load_n(&c1, __ATOMIC_RELAXED);
 
@@ -3348,13 +3348,13 @@  AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
     [
       // In case of POSIX threads check _POSIX_TIMEOUTS.
       #if (defined(_PTHREADS) \
-          && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
+	  && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
       #error
       #endif
     ], [ac_gthread_use_mutex_timedlock=1], [ac_gthread_use_mutex_timedlock=0])
 
   AC_DEFINE_UNQUOTED(_GTHREAD_USE_MUTEX_TIMEDLOCK, $ac_gthread_use_mutex_timedlock,
-                     [Define to 1 if mutex_timedlock is available.])
+		     [Define to 1 if mutex_timedlock is available.])
 
   if test $ac_gthread_use_mutex_timedlock = 1 ; then res_mutex_timedlock=yes ;
   else res_mutex_timedlock=no ; fi
@@ -3543,6 +3543,27 @@  AC_DEFUN([GLIBCXX_CHECK_SYSCTL_HW_NCPU], [
   AC_LANG_RESTORE
 ])
 
+dnl
+dnl Check to see if python pretty printing can be activated.
+dnl
+dnl --with-python-dir=dir
+dnl installs directory into $prefix/dir
+AC_DEFUN([GLIBCXX_ENABLE_PYTHON], [
+
+AC_MSG_CHECKING([for custom python install directory])
+AC_ARG_WITH([python-dir],
+	    AS_HELP_STRING([--with-python-dir],
+			   [the location to install Python modules. This path is relative starting from the prefix.]),
+	    [with_python_dir=$withval], [with_python_dir="no"])
+AC_MSG_RESULT(${with_python_dir})
+
+# Needed for installing Python modules during make install.
+python_mod_dir="${with_python_dir}"
+AC_SUBST(python_mod_dir)
+GLIBCXX_CONDITIONAL(ENABLE_PYTHONDIR, test $python_mod_dir != no)
+])
+
+
 # Macros from the top-level gcc directory.
 m4_include([../config/gc++filt.m4])
 m4_include([../config/tls.m4])
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 7607e5b..de5fe95 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -130,6 +130,7 @@  GLIBCXX_ENABLE_PARALLEL([yes])
 GLIBCXX_ENABLE_CXX_FLAGS
 GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
 GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes])
+GLIBCXX_ENABLE_PYTHON
 
 # Checks for operating systems support that doesn't require linking.
 GLIBCXX_CHECK_MATH_PROTO
diff --git a/libstdc++-v3/python/Makefile.am b/libstdc++-v3/python/Makefile.am
index 457e45b..49d8f86 100644
--- a/libstdc++-v3/python/Makefile.am
+++ b/libstdc++-v3/python/Makefile.am
@@ -1,6 +1,6 @@ 
 ## Makefile for the python subdirectory of the GNU C++ Standard library.
 ##
-## Copyright (C) 2009 Free Software Foundation, Inc.
+## Copyright (C) 2009, 2012 Free Software Foundation, Inc.
 ##
 ## This file is part of the libstdc++ version 3 distribution.
 ## Process this file with automake to produce Makefile.in.
@@ -24,7 +24,11 @@ 
 include $(top_srcdir)/fragment.am
 
 ## Where to install the module code.
+if ENABLE_PYTHONDIR
+pythondir = $(prefix)/$(python_mod_dir)
+else
 pythondir = $(datadir)/gcc-$(gcc_version)/python
+endif
 
 all-local: gdb.py
 

commit f06b90735bae23bedcc6e6c183bceeba88b2982a
Author: bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Feb 10 18:20:43 2012 +0000

    2012-02-10  Benjamin Kosnik  <bkoz@redhat.com>
                Jonathan Wakely  <jwakely.gcc@gmail.com>
    
    	PR libstdc++/51798 continued.
    	* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Use __atomic_*
    	builtins instead of __sync_* builtins for atomic functionality.
    	* include/bits/shared_ptr_base.h: Same.
    	* include/parallel/compatibility.h: Same.
    	* include/profile/impl/profiler_state.h: Same.
    	* include/tr1/shared_ptr.h: Same.
    	* libsupc++/eh_ptr.cc: Same.
    	* libsupc++/eh_throw.cc: Same.
    	* libsupc++/eh_tm.cc: Same.
    	* libsupc++/guard.cc: Same.
    	* configure: Regenerated.
    	* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184110 138bc75d-0d04-0410-961f-82ee72b054a4