Skip to content

building using Autotools + Clang causes PF_PACKET support detection to fail #109

@robertkirkman

Description

@robertkirkman

Hello, after 99f24b1, there is now an instance of code like this being used to check for PF_PACKET support,

libdnet/configure

Lines 15565 to 15571 in 06ecd5d

int
main (void)
{
int foo() { return ETH_P_ALL; }
;
return 0;
}

Attempting to compile code like this using Clang results in this error, because of a function definition being inside another function definition:

test.c:7:11: error: function definition is not allowed here
    7 | int foo() { return ETH_P_ALL; }
      |           ^
1 error generated.

After getting the code this way,

git clone -b devel https://github.com/ofalk/libdnet.git
cd libdnet/

This results in these two commands producing different outputs on a regular Gentoo GNU/Linux amd64 computer:

./configure CC=gcc
./configure CC=clang

Here is the relevant, problematic difference between the outputs they produce:

@@ -144,7 +144,7 @@
 checking for strsep... yes
 checking for Berkeley Packet Filter... no
 checking for Linux proc filesystem... yes
-checking for Linux PF_PACKET sockets... yes
+checking for Linux PF_PACKET sockets... no
 checking for SNMP MIB2 STREAMS... no
 checking for route(7) STREAMS... no
 checking for arp(7) ioctls... yes

Unfortunately, using autoreconf -fi before ./configure does not seem to make any difference here when I tried it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions