I cleanup up configure.ac slightly.

It's not complete, but this is in my opinion a step up from what we had already. If everyone is fine with it, I'll push this version of the patch.

The first patch adds the -Wextra CFLAG by default on systems where a CFLAG variable is not already defined.

--
Thanking You,
Darshit Shah
From bc69e92dc041e8fa5a0d9968ae9fcf0b281c6673 Mon Sep 17 00:00:00 2001
From: Darshit Shah <[email protected]>
Date: Sat, 1 Nov 2014 15:25:01 +0530
Subject: [PATCH 1/2] Add the -Wextra flag by default

After the Spring Cleaning on warnings in early 2014, GCC and Clang emit
only about two warnings when compiling Wget with -Wall -Wextra.

Enable both these flags by default so that new warnings in these areas
are more prominent.
---
 ChangeLog    | 4 ++++
 configure.ac | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 767221d..26679ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-11-16  Darshit Shah  <[email protected]>
 
+	* configure.ac: Add the -Wextra flag when no CFLAGS are set
+
+2014-11-16  Darshit Shah  <[email protected]>
+
 	* po/stamp-po: Remove autogenerated file from checked  out sources
 
 2014-11-16  Darshit Shah  <[email protected]>
diff --git a/configure.ac b/configure.ac
index 298aede..fea3fa3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,9 +165,11 @@ dnl   if compiler is gcc, then
 dnl     use -O2 and some warning flags
 dnl   else
 dnl     use os-specific flags or -O
+dnl
+dnl For these tests, the system considers clang to be gcc
 if test -n "$auto_cflags"; then
   if test -n "$GCC"; then
-    CFLAGS="$CFLAGS -O2 -Wall"
+    CFLAGS="$CFLAGS -O2 -Wall -Wextra"
   else
     case "$host_os" in
       *hpux*)  CFLAGS="$CFLAGS +O3"                      ;;
-- 
2.1.3

From 48702954897b051d0b455375a3b732cf15e9806a Mon Sep 17 00:00:00 2001
From: Darshit Shah <[email protected]>
Date: Sun, 16 Nov 2014 16:14:09 +0530
Subject: [PATCH 2/2] configure: Clean up some stuff

Use correct autotools syntax for AC_ARG_WITH and AC_ARG_ENABLE sections
---
 ChangeLog    |   1 +
 configure.ac | 119 ++++++++++++++++++++++++++++++++++-------------------------
 2 files changed, 69 insertions(+), 51 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 26679ae..3b82809 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2014-11-16  Darshit Shah  <[email protected]>
 
 	* configure.ac: Add the -Wextra flag when no CFLAGS are set
+	* configure.ac: Autotoolize various AC_ARG_WITH and AC_ARG_ENABLE sections
 
 2014-11-16  Darshit Shah  <[email protected]>
 
diff --git a/configure.ac b/configure.ac
index fea3fa3..8d41926 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,68 +65,89 @@ dnl maintainers to compile without assertions.
 AC_HEADER_ASSERT
 
 dnl
-dnl Process features.
+dnl Process External Libraries
 dnl
 
-AC_ARG_WITH(libpsl,
-    AS_HELP_STRING([--without-libpsl],
-                   [disable support for libpsl cookie checking.]),
+dnl Libpsl: Public Suffix List checking
+AC_ARG_WITH([libpsl],
+    [AS_HELP_STRING([--without-libpsl],
+                   [disable support for libpsl cookie checking.])],
     [],
-    [with_libpsl=yes])
+    [with_libpsl=yes]
+)
 
 AS_IF([test "x$with_libpsl" = xyes],
     [AC_SEARCH_LIBS(psl_builtin, psl,
-                    [ENABLE_PSL=yes; AC_DEFINE([HAVE_LIBPSL], [1], [PSL Support Enabled])],
-                    [ENABLE_PSL=no; AC_MSG_WARN(*** libpsl not found. Falling back to Wget builtin cookie checking.)])],
-    [ENABLE_PSL=no])
-
-AC_ARG_WITH(ssl,
-[[  --without-ssl           disable SSL autodetection
-  --with-ssl={gnutls,openssl} specify the SSL backend.  GNU TLS is the default.]])
+        [ENABLE_PSL=yes; AC_DEFINE([HAVE_LIBPSL], [1], [PSL Support Enabled])],
+        [ENABLE_PSL=no; AC_MSG_WARN(*** libpsl not found. Falling back to Wget builtin cookie checking.)])],
+    [ENABLE_PSL=no]
+)
 
-AC_ARG_WITH(zlib,
-[[  --without-zlib          disable zlib ]])
 
-AC_ARG_ENABLE(opie,
-[  --disable-opie          disable support for opie or s/key FTP login],
-ENABLE_OPIE=$enableval, ENABLE_OPIE=yes)
-test x"${ENABLE_OPIE}" = xyes && AC_DEFINE([ENABLE_OPIE], 1,
-   [Define if you want the Opie support for FTP compiled in.])
+dnl SSL: Configure SSL backend to use
+AC_ARG_WITH([ssl],
+    [AS_HELP_STRING([--with-ssl={gnutls,openssl}], [specify SSL backend. GNU TLS is the default.])])
 
-AC_ARG_ENABLE(digest,
-[  --disable-digest        disable support for HTTP digest authorization],
-ENABLE_DIGEST=$enableval, ENABLE_DIGEST=yes)
-test x"${ENABLE_DIGEST}" = xyes && AC_DEFINE([ENABLE_DIGEST], 1,
-   [Define if you want the HTTP Digest Authorization compiled in.])
 
-AC_ARG_ENABLE(ntlm,
-[  --disable-ntlm          disable support for NTLM authorization],
-[ENABLE_NTLM=$enableval], [ENABLE_NTLM=auto])
+dnl Zlib: Configure use of zlib for compression
+AC_ARG_WITH([zlib],
+    [AS_HELP_STRING([--without-zlib], [disable zlib.])])
 
-AC_ARG_ENABLE(debug,
-[  --disable-debug         disable support for debugging output],
-ENABLE_DEBUG=$enableval, ENABLE_DEBUG=yes)
-test x"${ENABLE_DEBUG}" = xyes && AC_DEFINE([ENABLE_DEBUG], 1,
-   [Define if you want the debug output support compiled in.])
 
 dnl
-dnl Check for valgrind
+dnl Process features
 dnl
+
+dnl Opie: Support for opie s/key FTP logins
+AC_ARG_ENABLE([opie],
+    [AS_HELP_STRING([--disable-opie], [disable support for opie or s/key FTP login])],
+    [ENABLE_OPIE=$enableval],
+    [ENABLE_OPIE=yes])
+AS_IF([test "x$ENABLE_OPIE" = xyes], [
+       AC_LIBOBJ([ftp-opie])
+       AC_DEFINE([ENABLE_OPIE], [1], [Define if you want Opie support for FTP compiled in.])
+    ],
+    []
+)
+
+
+dnl Digest: Support for HTTP Digest Authentication
+AC_ARG_ENABLE([digest],
+    [AS_HELP_STRING([--disable-digest], [disable support for HTTP digest authorization])],
+    [ENABLE_DIGEST=$enableval],
+    [ENABLE_DIGEST=yes])
+AS_IF([test "x$ENABLE_DIGEST" = xyes],
+    [AC_DEFINE([ENABLE_DIGEST], [1], [Define if you want the HTTP Digest Authorization compiled in.])],
+    [])
+
+dnl NTLM: Support for HTTP NTLM Authentication
+AC_ARG_ENABLE([ntlm],
+    [AS_HELP_STRING([--disable-ntlm], [disable support for NTLM authorization])],
+    [ENABLE_NTLM=$enableval],
+    [ENABLE_NTLM=auto])
+
+dnl Debug: Support for printing debugging output
+AC_ARG_ENABLE([debug],
+    [AS_HELP_STRING([--disable-debug], [disable support for debugging output])],
+    [ENABLE_DEBUG=$enableval],
+    [ENABLE_DEBUG=yes])
+AS_IF([test "x$ENABLE_DEBUG" = xyes],
+    [AC_DEFINE([ENABLE_DEBUG], [1], [Define if you want the debug output support compiled in.])],
+    [])
+
+dnl Valgrind-tests: Should test suite be run under valgrind?
 AC_ARG_ENABLE(valgrind-tests,
-  AS_HELP_STRING([--enable-valgrind-tests], [enable using Valgrind for tests]),
-  [ac_enable_valgrind=$enableval], [ac_enable_valgrind=no])
-if test "${ac_enable_valgrind}" != "no" ; then
-  AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
-  if test "$HAVE_VALGRIND" = "yes" ; then
-    VALGRIND_TESTS="1"
-    AC_SUBST(VALGRIND_TESTS)
-    VALGRIND_INFO="Test suite will be run under Valgrind"
-  else
-    VALGRIND_INFO="Valgrind not found"
-  fi
-else
-  VALGRIND_INFO="Valgrind testing not enabled"
-fi
+    [AS_HELP_STRING([--enable-valgrind-tests], [enable using Valgrind for tests])],
+    [ENABLE_VALGRIND=$enableval],
+    [ENABLE_VALGRIND=no])
+AS_IF([test "x$ENABLE_VALGRIND" != xno],
+      [AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
+       AS_IF([test "x$HAVE_VALGRIND" = xyes],
+             [VALGRIND_TESTS="1"
+              AC_SUBST(VALGRIND_TESTS)
+              VALGRIND_INFO="Test suite will be run under Valgrind"],
+              [VALGRIND_INFO="Valgrind not found"])],
+      [VALGRIND_INFO="Valgrind testing not enabled"])
 
 dnl
 dnl Find the compiler
@@ -245,10 +266,6 @@ AC_CHECK_FUNCS(strptime timegm vsnprintf vasprintf drand48 pathconf)
 AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc)
 AC_CHECK_FUNCS(sleep symlink utime strlcpy)
 
-if test x"$ENABLE_OPIE" = xyes; then
-  AC_LIBOBJ([ftp-opie])
-fi
-
 dnl We expect to have these functions on Unix-like systems configure
 dnl runs on.  The defines are provided to get them in config.h.in so
 dnl Wget can still be ported to non-Unix systems (such as Windows)
-- 
2.1.3

Attachment: pgp073yL0u7Qq.pgp
Description: PGP signature

Reply via email to