From: Roy Marples Date: Wed, 7 Nov 2007 17:06:05 +0000 (+0000) Subject: make HAVE_FORK=yes|no should be used if cross compiling. X-Git-Tag: v3.2.3~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29a184f3e23d28af84c81e5db6be348cf16fe9ce;p=thirdparty%2Fdhcpcd.git make HAVE_FORK=yes|no should be used if cross compiling. --- diff --git a/ChangeLog b/ChangeLog index c1ed1cfb..0d5109d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +make HAVE_FORK=yes|no should be used if cross compiling. Implement an exponential NAK backoff. Clear the signal_pipe fd from the fdset when all signals have been read. diff --git a/Makefile b/Makefile index 35c0f576..1003a48c 100644 --- a/Makefile +++ b/Makefile @@ -45,16 +45,22 @@ _LIBRT != $(_LIBRT_SH) LIBRT = $(_LIBRT)$(shell $(_LIBRT_SH)) # Work out if our fork() works or not -_HAVE_FORK_SH = printf '\#include \n\#include \nint main (void) { pid_t pid = fork(); if (pid == -1) exit (-1); exit (0); }\n' > .fork.c; \ - $(CC) .fork.c -o .fork >/dev/null 2>&1; \ - if ./.fork; then \ +_HAVE_FORK_SH = if [ "$(HAVE_FORK)" = "yes" ]; then \ echo ""; \ - else \ + elif [ -n "$(HAVE_FORK)" ]; then \ echo "-DTHERE_IS_NO_FORK"; \ - fi; \ - rm -f .fork.c .fork + else \ + printf '\#include \n\#include \nint main (void) { pid_t pid = fork(); if (pid == -1) exit (-1); exit (0); }\n' > .fork.c; \ + $(CC) .fork.c -o .fork >/dev/null 2>&1; \ + if ./.fork; then \ + echo ""; \ + else \ + echo "-DTHERE_IS_NO_FORK"; \ + fi; \ + rm -f .fork.c .fork; \ + fi; _HAVE_FORK != $(_HAVE_FORK_SH) -HAVE_FORK = $(_HAVE_FORK)$(shell $(_HAVE_FORK_SH)) +FORK = $(_HAVE_FORK)$(shell $(_HAVE_FORK_SH)) # pmake check for extra cflags WEXTRA != for x in -Wdeclaration-after-statement -Wsequence-point -Wextra; do \ @@ -89,7 +95,7 @@ dhcpcd_OBJS = arp.o client.o common.o configure.o dhcp.o dhcpcd.o duid.o \ info.o interface.o ipv4ll.o logger.o signals.o socket.o $(dhcpcd_OBJS): - $(CC) $(HAVE_FORK) $(CFLAGS) -c $*.c + $(CC) $(FORK) $(CFLAGS) -c $*.c dhcpcd: $(dhcpcd_H) .depend $(dhcpcd_OBJS) $(CC) $(LDFLAGS) $(dhcpcd_OBJS) $(LIBRESOLV) $(LIBRT) -o dhcpcd diff --git a/README b/README index 89a27182..f5a60849 100644 --- a/README +++ b/README @@ -18,3 +18,9 @@ volatile, like say a LiveCD. Then just make; make install man dhcpcd for command line options + + +Notes +----- +If you're cross compiling you may need to send HAVE_FORK=yes or HAVE_FORK=no +to the make command to avoid to automatic test.