ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:45388] [ruby-trunk - Feature #3333] mkmf (have|find)_cxx_header
       [not found] <redmine.issue-3333.20100524062610@ruby-lang.org>
@ 2012-03-18  6:56 ` nahi
  2012-03-18  7:06 ` [ruby-dev:45389] " nahi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: nahi @ 2012-03-18  6:56 UTC (permalink / raw
  To: ruby developers list


Issue #3333 has been updated by nahi.

Description updated

Imported from #3330

うっかりruby-listに投げてしまったきしもとです

[ruby-list:47092] で振ってみた話題に関係して、なのですが(ツリーになりませんでしたが)、
mkmf に C++ のヘッダをチェックする機能を追加するパッチです。

Index: configure.in
===================================================================
--- configure.in	(revision 27940)
+++ configure.in	(working copy)
@@ -243,6 +243,7 @@
 fi
 AC_PROG_CC
 AC_PROG_CXX
+AC_PROG_CXXCPP
 AC_PROG_GCC_TRADITIONAL
 AC_SUBST(GCC)
 if test "$GCC" = yes; then
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 27940)
+++ lib/mkmf.rb	(working copy)
@@ -408,6 +408,14 @@
 		   conf)
 end

+def cxxcpp_command(outfile, opt="")
+  conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
+                                'arch_hdrdir' => "#$arch_hdrdir",
+                                'top_srcdir' => $top_srcdir.quote)
+  RbConfig::expand("$(CXXCPP) #$INCFLAGS #$CPPFLAGS #$CXXFLAGS #{opt} #{CONFTEST_C} #{outfile}",
+		   conf)
+end
+
 def libpathflag(libpath=$DEFLIBPATH|$LIBPATH)
   libpath.map{|x|
     case x
@@ -454,8 +462,15 @@
   rm_f "conftest*"
 end

+def try_cxxcpp(src, opt="", &b)
+  try_do(src, cxxcpp_command(CPPOUTFILE, opt), &b)
+ensure
+  rm_f "conftest*"
+end
+
 class Object
   alias_method :try_header, (config_string('try_header') || :try_cpp)
+  alias_method :try_cxx_header, (config_string('try_cxx_header') || :try_cxxcpp)
 end

 def cpp_include(header)
@@ -840,6 +855,24 @@
   end
 end

+# Returns whether or not the given C plus plus +header+ file can be found on
+# your system. If found, a macro is passed as a preprocessor constant to the
+# compiler using the header file name, in uppercase, prepended with 'HAVE_'.
+#
+# For example, if have_header('foo.h') returned true, then the HAVE_FOO_H
+# preprocessor macro would be passed to the compiler.
+#
+def have_cxx_header(header, preheaders = nil, &b)
+  checking_for header do
+    if try_cxx_header(cpp_include(preheaders)+cpp_include(header), &b)
+      $defs.push(format("-DHAVE_%s", header.tr_cpp))
+      true
+    else
+      false
+    end
+  end
+end
+
 # Instructs mkmf to search for the given +header+ in any of the +paths+
 # provided, and returns whether or not it was found in those paths.
 #
@@ -867,6 +900,33 @@
   end
 end

+# Instructs mkmf to search for the given C plus plus +header+ in any of the
+# +paths+ provided, and returns whether or not it was found in those paths.
+#
+# If the header is found then the path it was found on is added to the list
+# of included directories that are sent to the compiler (via the -I switch).
+#
+def find_cxx_header(header, *paths)
+  message = checking_message(header, paths)
+  header = cpp_include(header)
+  checking_for message do
+    if try_cxx_header(header)
+      true
+    else
+      found = false
+      paths.each do |dir|
+        opt = "-I#{dir}".quote
+        if try_cxx_header(header, opt)
+          $INCFLAGS << " " << opt
+          found = true
+          break
+        end
+      end
+      found
+    end
+  end
+end
+
 # Returns whether or not the struct of type +type+ contains +member+.  If
 # it does not, or the struct type can't be found, then false is returned.  You
 # may optionally specify additional +headers+ in which to look for the struct
----------------------------------------
Feature #3333: mkmf (have|find)_cxx_header
https://bugs.ruby-lang.org/issues/3333#change-24715

Author: nobu
Status: Open
Priority: Low
Assignee: 
Category: 
Target version: 


=begin
 なかだです。
 
 ruby-devに移動します。
 
 At Fri, 21 May 2010 17:30:06 +0900,
 KISHIMOTO, Makoto wrote in [ruby-list:47096]:
 > [ruby-list:47092] で振ってみた話題に関係して、なのですが(ツリーになりませんでしたが)、
 
 redmine.ruby-lang.orgに登録されるのはruby-devかruby-coreだけです。
 
 > mkmf に C++ のヘッダをチェックする機能を追加するパッチです。
 
 チェックするのはヘッダだけでいいんでしょうか。have_libraryや
 find_library、have_func、have_typeなども全部have_cxx_…を追加す
 るんでしょうか。また、mkmf.rbではObjective-Cのソースも探すように
 なっていますが、こちらにも対応しようと思うとhave_objc_…などとど
 んどん数が増えてしまうので、どちらかというと、lang: "C++"のよう
 なオプション引数を追加するほうがいいのではないかという気がしてい
 ます。
 
 -- 
 --- 僕の前にBugはない。
 --- 僕の後ろにBugはできる。
     中田 伸悦
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-dev:45389] [ruby-trunk - Feature #3333] mkmf (have|find)_cxx_header
       [not found] <redmine.issue-3333.20100524062610@ruby-lang.org>
  2012-03-18  6:56 ` [ruby-dev:45388] [ruby-trunk - Feature #3333] mkmf (have|find)_cxx_header nahi
@ 2012-03-18  7:06 ` nahi
  2012-11-20 12:17 ` [ruby-dev:46556] " mame (Yusuke Endoh)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: nahi @ 2012-03-18  7:06 UTC (permalink / raw
  To: ruby developers list


Issue #3333 has been updated by nahi.

Assignee set to nobu


----------------------------------------
Feature #3333: mkmf (have|find)_cxx_header
https://bugs.ruby-lang.org/issues/3333#change-24716

Author: nobu
Status: Open
Priority: Low
Assignee: nobu
Category: 
Target version: 


=begin
 なかだです。
 
 ruby-devに移動します。
 
 At Fri, 21 May 2010 17:30:06 +0900,
 KISHIMOTO, Makoto wrote in [ruby-list:47096]:
 > [ruby-list:47092] で振ってみた話題に関係して、なのですが(ツリーになりませんでしたが)、
 
 redmine.ruby-lang.orgに登録されるのはruby-devかruby-coreだけです。
 
 > mkmf に C++ のヘッダをチェックする機能を追加するパッチです。
 
 チェックするのはヘッダだけでいいんでしょうか。have_libraryや
 find_library、have_func、have_typeなども全部have_cxx_…を追加す
 るんでしょうか。また、mkmf.rbではObjective-Cのソースも探すように
 なっていますが、こちらにも対応しようと思うとhave_objc_…などとど
 んどん数が増えてしまうので、どちらかというと、lang: "C++"のよう
 なオプション引数を追加するほうがいいのではないかという気がしてい
 ます。
 
 -- 
 --- 僕の前にBugはない。
 --- 僕の後ろにBugはできる。
     中田 伸悦
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-dev:46556] [ruby-trunk - Feature #3333] mkmf (have|find)_cxx_header
       [not found] <redmine.issue-3333.20100524062610@ruby-lang.org>
  2012-03-18  6:56 ` [ruby-dev:45388] [ruby-trunk - Feature #3333] mkmf (have|find)_cxx_header nahi
  2012-03-18  7:06 ` [ruby-dev:45389] " nahi
@ 2012-11-20 12:17 ` mame (Yusuke Endoh)
  2014-01-27 22:35 ` [ruby-dev:47916] " rogerpack2005
  2017-11-27 11:04 ` [ruby-dev:50322] [Ruby trunk Feature#3333][Rejected] " mame
  4 siblings, 0 replies; 5+ messages in thread
From: mame (Yusuke Endoh) @ 2012-11-20 12:17 UTC (permalink / raw
  To: ruby developers list


Issue #3333 has been updated by mame (Yusuke Endoh).

Target version set to next minor


----------------------------------------
Feature #3333: mkmf (have|find)_cxx_header
https://bugs.ruby-lang.org/issues/3333#change-33218

Author: nobu (Nobuyoshi Nakada)
Status: Assigned
Priority: Low
Assignee: nobu (Nobuyoshi Nakada)
Category: 
Target version: next minor


=begin
 なかだです。
 
 ruby-devに移動します。
 
 At Fri, 21 May 2010 17:30:06 +0900,
 KISHIMOTO, Makoto wrote in [ruby-list:47096]:
 > [ruby-list:47092] で振ってみた話題に関係して、なのですが(ツリーになりませんでしたが)、
 
 redmine.ruby-lang.orgに登録されるのはruby-devかruby-coreだけです。
 
 > mkmf に C++ のヘッダをチェックする機能を追加するパッチです。
 
 チェックするのはヘッダだけでいいんでしょうか。have_libraryや
 find_library、have_func、have_typeなども全部have_cxx_…を追加す
 るんでしょうか。また、mkmf.rbではObjective-Cのソースも探すように
 なっていますが、こちらにも対応しようと思うとhave_objc_…などとど
 んどん数が増えてしまうので、どちらかというと、lang: "C++"のよう
 なオプション引数を追加するほうがいいのではないかという気がしてい
 ます。
 
 -- 
 --- 僕の前にBugはない。
 --- 僕の後ろにBugはできる。
     中田 伸悦
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-dev:47916] [ruby-trunk - Feature #3333] mkmf (have|find)_cxx_header
       [not found] <redmine.issue-3333.20100524062610@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2012-11-20 12:17 ` [ruby-dev:46556] " mame (Yusuke Endoh)
@ 2014-01-27 22:35 ` rogerpack2005
  2017-11-27 11:04 ` [ruby-dev:50322] [Ruby trunk Feature#3333][Rejected] " mame
  4 siblings, 0 replies; 5+ messages in thread
From: rogerpack2005 @ 2014-01-27 22:35 UTC (permalink / raw
  To: ruby-dev

Issue #3333 has been updated by Roger Pack.


could I request an update on this please?

----------------------------------------
Feature #3333: mkmf (have|find)_cxx_header
https://bugs.ruby-lang.org/issues/3333#change-44637

* Author: Nobuyoshi Nakada
* Status: Assigned
* Priority: Low
* Assignee: Nobuyoshi Nakada
* Category: 
* Target version: next minor
----------------------------------------
=begin
 なかだです。
 
 ruby-devに移動します。
 
 At Fri, 21 May 2010 17:30:06 +0900,
 KISHIMOTO, Makoto wrote in [ruby-list:47096]:
 > [ruby-list:47092] で振ってみた話題に関係して、なのですが(ツリーになりませんでしたが)、
 
 redmine.ruby-lang.orgに登録されるのはruby-devかruby-coreだけです。
 
 > mkmf に C++ のヘッダをチェックする機能を追加するパッチです。
 
 チェックするのはヘッダだけでいいんでしょうか。have_libraryや
 find_library、have_func、have_typeなども全部have_cxx_…を追加す
 るんでしょうか。また、mkmf.rbではObjective-Cのソースも探すように
 なっていますが、こちらにも対応しようと思うとhave_objc_…などとど
 んどん数が増えてしまうので、どちらかというと、lang: "C++"のよう
 なオプション引数を追加するほうがいいのではないかという気がしてい
 ます。
 
 -- 
 --- 僕の前にBugはない。
 --- 僕の後ろにBugはできる。
     中田 伸悦
=end




-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-dev:50322] [Ruby trunk Feature#3333][Rejected] mkmf (have|find)_cxx_header
       [not found] <redmine.issue-3333.20100524062610@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2014-01-27 22:35 ` [ruby-dev:47916] " rogerpack2005
@ 2017-11-27 11:04 ` mame
  4 siblings, 0 replies; 5+ messages in thread
From: mame @ 2017-11-27 11:04 UTC (permalink / raw
  To: ruby-dev

Issue #3333 has been updated by mame (Yusuke Endoh).

Status changed from Assigned to Rejected

望み薄なので一旦閉じます。
今でも必要とお思いでしたら、議論を進める材料(`lang: "C++"` の方針でのパッチとか)を用意すると良いかも知れません。

----------------------------------------
Feature #3333: mkmf (have|find)_cxx_header
https://bugs.ruby-lang.org/issues/3333#change-67931

* Author: nobu (Nobuyoshi Nakada)
* Status: Rejected
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: next minor
----------------------------------------
=begin
 なかだです。
 
 ruby-devに移動します。
 
 At Fri, 21 May 2010 17:30:06 +0900,
 KISHIMOTO, Makoto wrote in [ruby-list:47096]:
 > [ruby-list:47092] で振ってみた話題に関係して、なのですが(ツリーになりませんでしたが)、
 
 redmine.ruby-lang.orgに登録されるのはruby-devかruby-coreだけです。
 
 > mkmf に C++ のヘッダをチェックする機能を追加するパッチです。
 
 チェックするのはヘッダだけでいいんでしょうか。have_libraryや
 find_library、have_func、have_typeなども全部have_cxx_…を追加す
 るんでしょうか。また、mkmf.rbではObjective-Cのソースも探すように
 なっていますが、こちらにも対応しようと思うとhave_objc_…などとど
 んどん数が増えてしまうので、どちらかというと、lang: "C++"のよう
 なオプション引数を追加するほうがいいのではないかという気がしてい
 ます。
 
 -- 
 --- 僕の前にBugはない。
 --- 僕の後ろにBugはできる。
     中田 伸悦
=end




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-27 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-3333.20100524062610@ruby-lang.org>
2012-03-18  6:56 ` [ruby-dev:45388] [ruby-trunk - Feature #3333] mkmf (have|find)_cxx_header nahi
2012-03-18  7:06 ` [ruby-dev:45389] " nahi
2012-11-20 12:17 ` [ruby-dev:46556] " mame (Yusuke Endoh)
2014-01-27 22:35 ` [ruby-dev:47916] " rogerpack2005
2017-11-27 11:04 ` [ruby-dev:50322] [Ruby trunk Feature#3333][Rejected] " mame

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).