Joan Lledó, le dim. 12 oct. 2025 18:00:15 +0200, a ecrit:
> From: Joan Lledó <[email protected]>
>
> It tests for dependencies and defines the proper variables for config.h
> ---
> configure | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 70 insertions(+)
>
> diff --git a/configure b/configure
> index 07d68349..668db8b6 100755
> --- a/configure
> +++ b/configure
> @@ -508,6 +508,11 @@ solaris*|sunos*)
> echo "DHCPCD_SRCS+= if-sun.c" >>$CONFIG_MK
> echo "LDADD+= -ldlpi -lkstat" >>$CONFIG_MK
> ;;
> +hurd*)
> + echo "CSTD=gnu99" >>$CONFIG_MK
> + echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK
> + echo "DHCPCD_SRCS+= if-pcap.c if-hurd.c" >>$CONFIG_MK
You'd probably want to sort this last in the series, after adding those
files.
> +;;
> *)
> echo "DHCPCD_SRCS+= if-bsd.c" >>$CONFIG_MK
> ;;
> @@ -606,6 +611,7 @@ if [ "$PRIVSEP" = yes ]; then
> fi
> ;;
> solaris*|sunos*) echo "PRIVSEP_SRCS+= privsep-sun.c" >>$CONFIG_MK;;
> + hurd*) ;;
> *) echo "PRIVSEP_SRCS+= privsep-bsd.c" >>$CONFIG_MK;;
> esac
> else
> @@ -1850,6 +1856,70 @@ EOF
> $abort && exit 1
> fi
>
> +# Check for Hurd dependencies if OS is hurd
> +abort=false
> +if [ "$OS" = "hurd" ]; then
> + # Check for libpcap
> + printf "Testing for libpcap ... "
> + if $PKG_CONFIG --exists libpcap 2>/dev/null; then
> + PCAP_CFLAGS=$($PKG_CONFIG --cflags libpcap 2>/dev/null)
> + PCAP_LIBS=$($PKG_CONFIG --libs libpcap 2>/dev/null)
> + echo "yes"
> + echo "CFLAGS+= $PCAP_CFLAGS" >>$CONFIG_MK
> + echo "LDADD+= $PCAP_LIBS" >>$CONFIG_MK
> + else
> + # Check with -lpcap if pkg-config fails
> + cat >_pcap.c <<EOF
> +#include <pcap/pcap.h>
> +int main(void) { return pcap_lib_version() != NULL; }
> +EOF
> + if $XCC _pcap.c -o _pcap -lpcap 2>&3; then
> + echo "yes"
> + echo "LDADD+= -lpcap" >>$CONFIG_MK
> + else
> + echo "no"
> + echo "libpcap is required for Hurd support" >&2
> + abort=true
> + fi
> + rm -f _pcap.c _pcap
> + $abort && exit 1
> + fi
> +
> + # Check for lwIP headers using pkg-config first
> + printf "Testing for lwIP headers ... "
> + if $PKG_CONFIG --exists lwip 2>/dev/null; then
> + LWIP_CFLAGS=$($PKG_CONFIG --cflags lwip 2>/dev/null)
> + echo "yes"
> + echo "CFLAGS+= $LWIP_CFLAGS" >>$CONFIG_MK
> + echo "#include <lwip/arch/cc.h>">>$CONFIG_H
> + echo "#include <lwip/lwipopts.h>">>$CONFIG_H
> + echo "#include <lwip/posix/inet.h>">>$CONFIG_H
> + echo "#define PATH_MAX 4096" >>$CONFIG_H
> + else
> + # Check directly for lwIP headers
> + cat >_lwip.c <<EOF
> +#include <lwip/arch/cc.h>
> +#include <lwip/lwipopts.h>
> +#include <lwip/posix/inet.h>
> +int main(void) { return 0; }
> +EOF
> + if $XCC $CFLAGS -I/usr/include/lwip _lwip.c -o _lwip 2>&3; then
> + echo "yes"
> + echo "CFLAGS+= -I/usr/include/lwip" >>$CONFIG_MK
> + echo "#include <lwip/arch/cc.h>">>$CONFIG_H
> + echo "#include <lwip/lwipopts.h>">>$CONFIG_H
> + echo "#include <lwip/posix/inet.h>">>$CONFIG_H
> + echo "#define PATH_MAX 4096" >>$CONFIG_H
> + else
> + echo "no"
> + echo "lwIP headers are required for Hurd support" >&2
> + abort=true
> + fi
> + rm -f _lwip.c _lwip
> + $abort && exit 1
> + fi
> +fi
> +
> # Transform for a make file
> SERVICEEXISTS=$(echo "$SERVICEEXISTS" | $SED \
> -e 's:\\:\\\\:g' \
> --
> 2.50.1
>
>
--
Samuel
bien sûr que ça convient mieux à tout le monde
enfin, dans la mesure où tout le monde c'est comme moi
-+- le consensus, c'est facile -+-