Ruby / C / Makefile,-lpcap / #include <pcap.h> </pcap.h>中使用的默认pcap.h文件是什么

时间:2010-11-30 05:58:58

标签: c ruby makefile pcap libpcap

如何确定哪个pcap.h文件包含在通过Makefile编译/安装的C源中?

具体来说,它是一个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")

1 个答案:

答案 0 :(得分: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 ...! .