And here's a backport for 1.10 branch.

2007-04-01  Robert Millan  <[EMAIL PROTECTED]>

        * Makefile.in: Add @MINGW32_WS2@ to LIBS.
        * configure.in:
        - Detect mingw32 and set appropiate variables.
        * src/Makefile.in: Adjust OBJ and LIBS for mingw32.
        * src/main.c: Check for each signal before using it (backport from
        trunk).

-- 
Robert Millan

My spam trap is [EMAIL PROTECTED]  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.
2007-04-01  Robert Millan  <[EMAIL PROTECTED]>

	* Makefile.in: Add @MINGW32_WS2@ to LIBS.
	* configure.in:
	- Detect mingw32 and set appropiate variables.
	- Use AC_CHECK_FUNCS for all functions, including ones that can be
	assumed on Unix-like systems.
	* src/Makefile.in: Adjust OBJ and LIBS for mingw32.
	* src/main.c: Check for each signal before using it (backport from
	trunk).

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 2207)
+++ Makefile.in	(working copy)
@@ -57,7 +57,7 @@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
-LIBS = @LIBS@ @LIBSSL@
+LIBS = @LIBS@ @LIBSSL@ @MINGW32_WS2@
 LDFLAGS = @LDFLAGS@
 
 #
Index: configure.in
===================================================================
--- configure.in	(revision 2207)
+++ configure.in	(working copy)
@@ -141,9 +141,17 @@
 dnl
 case "$host_os" in
   *win32) exeext='.exe';;
+  mingw32*)
+    exeext='.exe'
+    CFLAGS="$CFLAGS -DWINDOWS"
+    WIN32_OBJ="mswindows.o"
+    MINGW32_WS2="-lws2_32"
+  ;;
   *) exeext='';;
 esac
 AC_SUBST(exeext)
+AC_SUBST(WIN32_OBJ)
+AC_SUBST(MINGW32_WS2)
 
 dnl
 dnl Checks for basic compiler characteristics.
Index: src/Makefile.in
===================================================================
--- src/Makefile.in	(revision 2207)
+++ src/Makefile.in	(working copy)
@@ -53,7 +53,7 @@
 DEFS     = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
 CFLAGS   = @CFLAGS@
 LDFLAGS  = @LDFLAGS@
-LIBS     = @LIBS@ @LIBSSL@
+LIBS     = @LIBS@ @LIBSSL@ @MINGW32_WS2@
 exeext   = @exeext@
 
 INCLUDES = -I. -I$(srcdir)
@@ -72,13 +72,14 @@
 NTLM_OBJ   = @NTLM_OBJ@
 SSL_OBJ    = @SSL_OBJ@
 GETOPT_OBJ = @GETOPT_OBJ@
+WIN32_OBJ  = @WIN32_OBJ@
 
 OBJ = $(ALLOCA) cmpt$o connect$o convert$o cookies$o              \
       ftp$o ftp-basic$o ftp-ls$o $(OPIE_OBJ) $(GETOPT_OBJ) hash$o \
       host$o html-parse$o html-url$o http$o $(NTLM_OBJ) init$o    \
       log$o main$o $(MD5_OBJ) netrc$o progress$o ptimer$o recur$o \
       res$o retr$o safe-ctype$o snprintf$o $(SSL_OBJ) url$o       \
-      utils$o version$o xmalloc$o 
+      utils$o version$o xmalloc$o $(WIN32_OBJ)
 
 .SUFFIXES:
 .SUFFIXES: .c .o ._c ._o
Index: src/main.c
===================================================================
--- src/main.c	(revision 2207)
+++ src/main.c	(working copy)
@@ -79,7 +79,9 @@
 
 extern struct cookie_jar *wget_cookie_jar;
 
+#if defined(SIGHUP) || defined(SIGUSR1)
 static RETSIGTYPE redirect_output_signal PARAMS ((int));
+#endif
 
 const char *exec_name;
 
@@ -916,14 +918,20 @@
   /* Setup the signal handler to redirect output when hangup is
      received.  */
 #ifdef HAVE_SIGNAL
+#ifdef SIGHUP
   if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
     signal(SIGHUP, redirect_output_signal);
+#endif
+#ifdef SIGUSR1
   /* ...and do the same for SIGUSR1.  */
   signal (SIGUSR1, redirect_output_signal);
+#endif
+#ifdef SIGPIPE
   /* Writing to a closed socket normally signals SIGPIPE, and the
      process exits.  What we want is to ignore SIGPIPE and just check
      for the return value of write().  */
   signal (SIGPIPE, SIG_IGN);
+#endif
 #ifdef SIGWINCH
   signal (SIGWINCH, progress_handle_sigwinch);
 #endif
@@ -1000,7 +1008,16 @@
     return 1;
 }
 
-#ifdef HAVE_SIGNAL
+#if defined(SIGHUP) || defined(SIGUSR1)
+
+/* So the signal_name check doesn't blow when only one is available. */
+#ifndef SIGHUP
+# define SIGHUP -1
+#endif
+#ifndef SIGUSR1
+# define SIGUSR1 -1
+#endif
+
 /* Hangup signal handler.  When wget receives SIGHUP or SIGUSR1, it
    will proceed operation as usual, trying to write into a log file.
    If that is impossible, the output will be turned off.

Reply via email to