1

Makefile を介してコンパイル/インストールされている C ソースに含まれている pcap.h ファイルを特定するにはどうすればよいですか?

具体的には、次の方法でインストールされる Ruby ライブラリ (pcaprub) です。

ruby extconf.rb && make && make install

extconf.rb は次のとおりです。

require 'mkmf'

if /i386-mswin32/ =~ RUBY_PLATFORM
    pcap_dir        = with_config("pcap-dir", "C:\WpdPack")
    pcap_includedir = with_config("pcap-includedir", pcap_dir + "\\include")
    pcap_libdir     = with_config("pcap-libdir", pcap_dir + "\\lib")

    $CFLAGS  = "-DWIN32 -I#{pcap_includedir}"
    $LDFLAGS = "/link /LIBPATH:#{pcap_libdir}"
    have_library("wpcap", "pcap_open_live")
    have_library("wpcap", "pcap_setnonblock")
else
    have_library("pcap", "pcap_open_live")
    have_library("pcap", "pcap_setnonblock")
end

if ( RUBY_VERSION =~ /^1\.9/ )
    $CFLAGS += " -DRUBY_19"
end

create_makefile("pcaprub")
4

1 に答える 1

0

生成されたMakefileを見て、どの-Iオプションが渡されているかを確認できますgccか? -Hに渡してgcc、最終的に使用するヘッダー ファイルを表示することもできます。

   -H  Print the name of each header file used, in addition to other
       normal activities.  Each name is indented to show how deep in the
       #include stack it is.  Precompiled header files are also printed,
       even if they are found to be invalid; an invalid precompiled header
       file is printed with ...x and a valid one with ...! .
于 2010-12-14T16:52:16.323 に答える