开发者

Ruby/C/Makefile, what is the default pcap.h file that is used in -lpcap/#include <pcap.h>

开发者 https://www.devze.com 2023-01-28 02:10 出处:网络
How can I determine what pcap.h file is being included in a C source that is being compiled/installed via a Makefile?

How can I determine what pcap.h file is being included in a C source that is being compiled/installed via a Makefile?

Specifically, it is a Ruby library (pcaprub) that is being installed via:

ruby extconf.rb && make && make install

and the extconf.rb is:

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#{p开发者_StackOverflow社区cap_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")


Can you look at the generated Makefile to see what -I options are being passed to gcc? You can also pass -H to gcc to display the header file that it ends up using:

   -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 ...! .
0

精彩评论

暂无评论...
验证码 换一张
取 消