]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Support AddressSanitizer in builds.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 4 Dec 2018 14:36:02 +0000 (09:36 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 4 Dec 2018 14:36:02 +0000 (09:36 -0500)
Fix a compiler warning on macOS.

Makedefs.in
backend/usb-darwin.c
config-scripts/cups-compiler.m4
config-scripts/cups-sharedlibs.m4
configure
cups/Makefile
test/asan-suppressions.txt [new file with mode: 0644]
test/run-stp-tests.sh

index abd24863e6e247cfb7cd53185ac8a7afa75f22ba..f96a5e9bf4d0054d0841a1fa45d22dad00c8a031 100644 (file)
@@ -138,10 +138,12 @@ CODE_SIGN_IDENTITY = -
 #               for extra debug info)
 #
 
-ALL_CFLAGS     =       -I.. -D_CUPS_SOURCE $(CFLAGS) $(SSLFLAGS) \
-                       @LARGEFILE@ @PTHREAD_FLAGS@ $(ONDEMANDFLAGS) $(OPTIONS)
-ALL_CXXFLAGS   =       -I.. -D_CUPS_SOURCE $(CXXFLAGS) $(SSLFLAGS) \
-                       @LARGEFILE@ @PTHREAD_FLAGS@ $(ONDEMANDFLAGS) $(OPTIONS)
+ALL_CFLAGS     =       -I.. -D_CUPS_SOURCE $(CFLAGS) \
+                       $(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \
+                       $(ONDEMANDFLAGS) $(OPTIONS)
+ALL_CXXFLAGS   =       -I.. -D_CUPS_SOURCE $(CXXFLAGS) \
+                       $(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \
+                       $(ONDEMANDFLAGS) $(OPTIONS)
 ARCHFLAGS      =       @ARCHFLAGS@
 ARFLAGS                =       @ARFLAGS@
 BACKLIBS       =       @BACKLIBS@
@@ -153,20 +155,21 @@ CXXLIBS           =       @CXXLIBS@
 DBUS_NOTIFIER  =       @DBUS_NOTIFIER@
 DBUS_NOTIFIERLIBS =    @DBUS_NOTIFIERLIBS@
 DNSSD_BACKEND  =       @DNSSD_BACKEND@
-DSOFLAGS       =       -L../cups @DSOFLAGS@
+DSOFLAGS       =       -L../cups @ARCHFLAGS@ @LDFLAGS@ @RELROFLAGS@ \
+                       @DSOFLAGS@ $(OPTIM)
 DSOLIBS                =       @DSOLIBS@ $(COMMONLIBS)
 DNSSDLIBS      =       @DNSSDLIBS@
 IPPFIND_BIN    =       @IPPFIND_BIN@
 IPPFIND_MAN    =       @IPPFIND_MAN@
-LDFLAGS                =       -L../cups @LDARCHFLAGS@ \
-                       @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
+LDFLAGS                =       -L../cups @LDARCHFLAGS@ @LDFLAGS@ @RELROFLAGS@ \
+                       @PIEFLAGS@ $(OPTIM)
 LINKCUPS       =       @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(SSLLIBS) $(LIBZ)
 LINKCUPSIMAGE  =       @LINKCUPSIMAGE@
 LIBS           =       $(LINKCUPS) $(COMMONLIBS)
 ONDEMANDFLAGS  =       @ONDEMANDFLAGS@
 ONDEMANDLIBS   =       @ONDEMANDLIBS@
 OPTIM          =       @OPTIM@
-OPTIONS                =
+OPTIONS                =       @WARNING_OPTIONS@
 PAMLIBS                =       @PAMLIBS@
 SERVERLIBS     =       @SERVERLIBS@
 SSLFLAGS       =       @SSLFLAGS@
index 4a85b476619e6629e8a9430f459df4639028ae51..d6ad5875d6649d13acf9d460e520e2b294a5f781 100644 (file)
@@ -2009,7 +2009,7 @@ static void parse_options(char *options,
                             value);
     }
     else if (!_cups_strcasecmp(name, "serial"))
-      strlcpy(serial, value, serial_size);
+      strlcpy(serial, value, (size_t)serial_size);
     else if (!_cups_strcasecmp(name, "location") && location)
       *location = (UInt32)strtoul(value, NULL, 16);
   }
index 08c3f131c647c30058e7f5021379f2687bc9bd5a..7cd440ff487d518d0ff7a6a08a68f829cc89a9a1 100644 (file)
@@ -10,18 +10,20 @@ dnl
 dnl Clear the debugging and non-shared library options unless the user asks
 dnl for them...
 INSTALL_STRIP=""
-OPTIM=""
 AC_SUBST(INSTALL_STRIP)
+
+AC_ARG_WITH(optim, [  --with-optim            set optimization flags ],
+       OPTIM="$withval",
+       OPTIM="")
 AC_SUBST(OPTIM)
 
-AC_ARG_WITH(optim, [  --with-optim            set optimization flags ])
 AC_ARG_ENABLE(debug, [  --enable-debug          build with debugging symbols])
 AC_ARG_ENABLE(debug_guards, [  --enable-debug-guards   build with memory allocation guards])
 AC_ARG_ENABLE(debug_printfs, [  --enable-debug-printfs  build with CUPS_DEBUG_LOG support])
 AC_ARG_ENABLE(unit_tests, [  --enable-unit-tests     build and run unit tests])
 
 dnl For debugging, keep symbols, otherwise strip them...
-if test x$enable_debug = xyes; then
+if test x$enable_debug = xyes -a "x$OPTIM" = x; then
        OPTIM="-g"
 else
        INSTALL_STRIP="-s"
@@ -79,6 +81,9 @@ AC_SUBST(LDARCHFLAGS)
 dnl Read-only data/program support on Linux...
 AC_ARG_ENABLE(relro, [  --enable-relro          build with the GCC relro option])
 
+dnl Clang/GCC address sanitizer...
+AC_ARG_ENABLE(sanitizer, [  --enable-sanitizer      build with AddressSanitizer])
+
 dnl Update compiler options...
 CXXLIBS="${CXXLIBS:=}"
 AC_SUBST(CXXLIBS)
@@ -89,15 +94,28 @@ AC_SUBST(PIEFLAGS)
 RELROFLAGS=""
 AC_SUBST(RELROFLAGS)
 
+WARNING_OPTIONS=""
+AC_SUBST(WARNING_OPTIONS)
+
 if test -n "$GCC"; then
        # Add GCC-specific compiler options...
+
+        # Address sanitizer is a useful tool to use when developing/debugging
+        # code but adds about 2x overhead...
+        if test x$enable_sanitizer = xyes; then
+               # Use -fsanitize=address with debugging...
+               OPTIM="$OPTIM -g -fsanitize=address"
+        else
+               # Otherwise use the Fortify enhancements to catch any unbounded
+               # string operations...
+               CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
+               CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
+        fi
+
+       # Default optimization options...
        if test -z "$OPTIM"; then
-               if test "x$with_optim" = x; then
-                       # Default to optimize-for-size and debug
-                               OPTIM="-Os -g"
-               else
-                       OPTIM="$with_optim $OPTIM"
-               fi
+               # Default to optimize-for-size and debug
+               OPTIM="-Os -g"
        fi
 
        # Generate position-independent code as needed...
@@ -150,54 +168,29 @@ if test -n "$GCC"; then
                CFLAGS="$OLDCFLAGS"
        fi
 
-       if test "x$with_optim" = x; then
-               # Add useful warning options for tracking down problems...
-               OPTIM="-Wall -Wno-format-y2k -Wunused -Wno-unused-result -Wsign-conversion $OPTIM"
-
-               # Test GCC version for certain warning flags since -Werror
-               # doesn't trigger...
-               gccversion=`$CC --version | head -1 | awk '{print $NF}'`
-               case "$gccversion" in
-                       7.* | 8.*)
-                               OPTIM="$OPTIM -Wno-format-truncation -Wno-tautological-compare"
-                               ;;
-               esac
+       # Add useful warning options for tracking down problems...
+       WARNING_OPTIONS="-Wall -Wno-format-y2k -Wunused -Wno-unused-result -Wsign-conversion"
 
-               # Additional warning options for development testing...
-               if test -d .git; then
-                       OPTIM="-Werror $OPTIM"
-               fi
-       fi
-
-       case "$host_os_name" in
-               darwin*)
-                       # -D_FORTIFY_SOURCE=2 adds additional object size
-                       # checking, basically wrapping all string functions
-                       # with buffer-limited ones.  Not strictly needed for
-                       # CUPS since we already use buffer-limited calls, but
-                       # this will catch any additions that are broken.
-                       CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
-                       ;;
-
-               linux*)
-                       # The -z relro option is provided by the Linux linker command to
-                       # make relocatable data read-only.
-                       if test x$enable_relro = xyes; then
-                               RELROFLAGS="-Wl,-z,relro,-z,now"
-                       fi
+       # Test GCC version for certain warning flags since -Werror
+       # doesn't trigger...
+       gccversion=`$CC --version | head -1 | awk '{print $NF}'`
+       case "$gccversion" in
+               7.* | 8.*)
+                       WARNING_OPTIONS="$WARNING_OPTIONS -Wno-format-truncation -Wno-tautological-compare"
                        ;;
        esac
+
+       # Additional warning options for development testing...
+       if test -d .git; then
+               WARNING_OPTIONS="-Werror $WARNING_OPTIONS"
+       fi
 else
        # Add vendor-specific compiler options...
        case $host_os_name in
                sunos*)
                        # Solaris
                        if test -z "$OPTIM"; then
-                               if test "x$with_optim" = x; then
-                                       OPTIM="-xO2"
-                               else
-                                       OPTIM="$with_optim $OPTIM"
-                               fi
+                               OPTIM="-xO2"
                        fi
 
                        if test $PICFLAG = 1; then
@@ -205,13 +198,13 @@ else
                        fi
                        ;;
                *)
-                       # Running some other operating system; inform the user they
-                       # should contribute the necessary options to
-                       # cups-support@cups.org...
-                       echo "Building CUPS with default compiler optimizations; contact"
-                       echo "cups-devel@cups.org with uname and compiler options needed"
-                       echo "for your platform, or set the CFLAGS and LDFLAGS environment"
-                       echo "variables before running configure."
+                       # Running some other operating system; inform the user
+                       # they should contribute the necessary options via
+                       # Github...
+                       echo "Building CUPS with default compiler optimizations; contact the CUPS developers on Github"
+                       echo "(https://github.com/apple/cups/issues) with the uname and compiler options needed for"
+                       echo "your platform, or set the CFLAGS and LDFLAGS environment variables before running"
+                       echo "configure."
                        ;;
        esac
 fi
@@ -222,5 +215,11 @@ case $host_os_name in
                # glibc 2.8 and higher breaks peer credentials unless you
                # define _GNU_SOURCE...
                OPTIM="$OPTIM -D_GNU_SOURCE"
+
+               # The -z relro option is provided by the Linux linker command to
+               # make relocatable data read-only.
+               if test x$enable_relro = xyes; then
+                       RELROFLAGS="-Wl,-z,relro,-z,now"
+               fi
                ;;
 esac
index 80e1ee2f59cd18f7003f1caef88f629116c7dff0..914e621359aec8f224c39caf7a58b35064db5786 100644 (file)
@@ -27,7 +27,7 @@ if test x$enable_shared != xno; then
                        fi
                        DSO="\$(CC)"
                        DSOXX="\$(CXX)"
-                       DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G \$(OPTIM)"
+                       DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
                        ;;
                linux* | gnu* | *bsd*)
                        LIBCUPS="lib$cupsbase.so.2"
@@ -36,7 +36,7 @@ if test x$enable_shared != xno; then
                        fi
                        DSO="\$(CC)"
                        DSOXX="\$(CXX)"
-                       DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
+                       DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
                        ;;
                darwin*)
                        LIBCUPS="lib$cupsbase.2.dylib"
@@ -45,7 +45,7 @@ if test x$enable_shared != xno; then
                        fi
                        DSO="\$(CC)"
                        DSOXX="\$(CXX)"
-                       DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
+                       DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
                        ;;
                *)
                        echo "Warning: shared libraries may not be supported.  Trying -shared"
@@ -56,7 +56,7 @@ if test x$enable_shared != xno; then
                        fi
                        DSO="\$(CC)"
                        DSOXX="\$(CXX)"
-                       DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
+                       DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
                        ;;
        esac
 else
index 16f58abd9fbef09c424c5d73e664047b33540205..77bff4540bff1ecf294e3506cde535d6df52fce4 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,11 +1,13 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for CUPS 2.3b6.
+# Generated by GNU Autoconf 2.68 for CUPS 2.3b6.
 #
 # Report bugs to <https://github.com/apple/cups/issues>.
 #
 #
-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -134,31 +136,6 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
-# Use a proper internal environment variable to ensure we don't fall
-  # into an infinite loop, continuously re-executing ourselves.
-  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
-    _as_can_reexec=no; export _as_can_reexec;
-    # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
-  *v*x* | *x*v* ) as_opts=-vx ;;
-  *v* ) as_opts=-v ;;
-  *x* ) as_opts=-x ;;
-  * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-as_fn_exit 255
-  fi
-  # We don't want this to propagate to other subprocesses.
-          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -192,8 +169,7 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1
-test -x / || exit 1"
+test x\$exitcode = x0 || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -238,25 +214,21 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  export CONFIG_SHELL
-             # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
-  *v*x* | *x*v* ) as_opts=-vx ;;
-  *v* ) as_opts=-v ;;
-  *x* ) as_opts=-x ;;
-  * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-exit 255
+  # We cannot yet assume a decent shell, so we have to provide a
+       # neutralization value for shells without unset; and this also
+       # works around shells that cannot unset nonexistent variables.
+       # Preserve -v and -x to the replacement shell.
+       BASH_ENV=/dev/null
+       ENV=/dev/null
+       (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+       export CONFIG_SHELL
+       case $- in # ((((
+         *v*x* | *x*v* ) as_opts=-vx ;;
+         *v* ) as_opts=-v ;;
+         *x* ) as_opts=-x ;;
+         * ) as_opts= ;;
+       esac
+       exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -359,14 +331,6 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
-  test -f "$1" && test -x "$1"
-} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -488,10 +452,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
-  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
-  # already done that, so ensure we don't try to do so again and fall
-  # in an infinite loop.  This has already happened in practice.
-  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -526,16 +486,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -pR'.
+    # In both cases, we have to default to `cp -p'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -pR'
+      as_ln_s='cp -p'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -pR'
+    as_ln_s='cp -p'
   fi
 else
-  as_ln_s='cp -pR'
+  as_ln_s='cp -p'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -547,8 +507,28 @@ else
   as_mkdir_p=false
 fi
 
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+       test -d "$1/.";
+      else
+       case $1 in #(
+       -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -686,6 +666,7 @@ KRB5CONFIG
 LIBGSSAPI
 CUPS_LISTEN_DOMAINSOCKET
 CUPS_DEFAULT_DOMAINSOCKET
+WARNING_OPTIONS
 RELROFLAGS
 PIEFLAGS
 CXXLIBS
@@ -871,6 +852,7 @@ enable_unit_tests
 with_archflags
 with_ldarchflags
 enable_relro
+enable_sanitizer
 with_domainsocket
 enable_gssapi
 with_gssservicename
@@ -1389,6 +1371,8 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1562,6 +1546,7 @@ Optional Features:
   --enable-debug-printfs  build with CUPS_DEBUG_LOG support
   --enable-unit-tests     build and run unit tests
   --enable-relro          build with the GCC relro option
+  --enable-sanitizer      build with AddressSanitizer
   --disable-gssapi        disable GSSAPI support
   --disable-threads       disable multi-threading support
   --disable-ssl           disable SSL/TLS support
@@ -1720,9 +1705,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 CUPS configure 2.3b6
-generated by GNU Autoconf 2.69
+generated by GNU Autoconf 2.68
 
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1873,7 +1858,7 @@ $as_echo "$ac_try_echo"; } >&5
         test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
         test "$cross_compiling" = yes ||
-        test -x conftest$ac_exeext
+        $as_test_x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2184,7 +2169,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by CUPS $as_me 2.3b6, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -2676,7 +2661,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CODE_SIGN="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2752,7 +2737,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2800,7 +2785,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2844,7 +2829,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3288,7 +3273,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-struct stat;
+#include <sys/types.h>
+#include <sys/stat.h>
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3538,7 +3524,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3582,7 +3568,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CXX="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3784,7 +3770,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3824,7 +3810,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3877,7 +3863,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3917,7 +3903,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CHMOD="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3957,7 +3943,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GZIP="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3997,7 +3983,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_LD="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4037,7 +4023,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4077,7 +4063,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MKDIR="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4117,7 +4103,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4157,7 +4143,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4197,7 +4183,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_RMDIR="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4237,7 +4223,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4277,7 +4263,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XDGOPEN="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4353,7 +4339,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4396,7 +4382,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4806,7 +4792,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_GREP" || continue
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -4872,7 +4858,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      as_fn_executable_p "$ac_path_EGREP" || continue
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -6638,7 +6624,7 @@ if test x$enable_shared != xno; then
                        fi
                        DSO="\$(CC)"
                        DSOXX="\$(CXX)"
-                       DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G \$(OPTIM)"
+                       DSOFLAGS="$DSOFLAGS -Wl,-h\`basename \$@\` -G"
                        ;;
                linux* | gnu* | *bsd*)
                        LIBCUPS="lib$cupsbase.so.2"
@@ -6647,7 +6633,7 @@ if test x$enable_shared != xno; then
                        fi
                        DSO="\$(CC)"
                        DSOXX="\$(CXX)"
-                       DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
+                       DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
                        ;;
                darwin*)
                        LIBCUPS="lib$cupsbase.2.dylib"
@@ -6656,7 +6642,7 @@ if test x$enable_shared != xno; then
                        fi
                        DSO="\$(CC)"
                        DSOXX="\$(CXX)"
-                       DSOFLAGS="$DSOFLAGS -dynamiclib -single_module -lc"
+                       DSOFLAGS="$DSOFLAGS -Wl,-no_warn_inits -dynamiclib -single_module -lc"
                        ;;
                *)
                        echo "Warning: shared libraries may not be supported.  Trying -shared"
@@ -6667,7 +6653,7 @@ if test x$enable_shared != xno; then
                        fi
                        DSO="\$(CC)"
                        DSOXX="\$(CXX)"
-                       DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared \$(OPTIM)"
+                       DSOFLAGS="$DSOFLAGS -Wl,-soname,\`basename \$@\` -shared"
                        ;;
        esac
 else
@@ -6822,16 +6808,18 @@ fi
 
 
 INSTALL_STRIP=""
-OPTIM=""
-
 
 
 
 # Check whether --with-optim was given.
 if test "${with_optim+set}" = set; then :
-  withval=$with_optim;
+  withval=$with_optim; OPTIM="$withval"
+else
+  OPTIM=""
 fi
 
+
+
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then :
   enableval=$enable_debug;
@@ -6853,7 +6841,7 @@ if test "${enable_unit_tests+set}" = set; then :
 fi
 
 
-if test x$enable_debug = xyes; then
+if test x$enable_debug = xyes -a "x$OPTIM" = x; then
        OPTIM="-g"
 else
        INSTALL_STRIP="-s"
@@ -6919,6 +6907,12 @@ if test "${enable_relro+set}" = set; then :
 fi
 
 
+# Check whether --enable-sanitizer was given.
+if test "${enable_sanitizer+set}" = set; then :
+  enableval=$enable_sanitizer;
+fi
+
+
 CXXLIBS="${CXXLIBS:=}"
 
 
@@ -6928,15 +6922,28 @@ PIEFLAGS=""
 RELROFLAGS=""
 
 
+WARNING_OPTIONS=""
+
+
 if test -n "$GCC"; then
        # Add GCC-specific compiler options...
+
+        # Address sanitizer is a useful tool to use when developing/debugging
+        # code but adds about 2x overhead...
+        if test x$enable_sanitizer = xyes; then
+               # Use -fsanitize=address with debugging...
+               OPTIM="$OPTIM -g -fsanitize=address"
+        else
+               # Otherwise use the Fortify enhancements to catch any unbounded
+               # string operations...
+               CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
+               CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
+        fi
+
+       # Default optimization options...
        if test -z "$OPTIM"; then
-               if test "x$with_optim" = x; then
-                       # Default to optimize-for-size and debug
-                               OPTIM="-Os -g"
-               else
-                       OPTIM="$with_optim $OPTIM"
-               fi
+               # Default to optimize-for-size and debug
+               OPTIM="-Os -g"
        fi
 
        # Generate position-independent code as needed...
@@ -7042,54 +7049,29 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
                CFLAGS="$OLDCFLAGS"
        fi
 
-       if test "x$with_optim" = x; then
-               # Add useful warning options for tracking down problems...
-               OPTIM="-Wall -Wno-format-y2k -Wunused -Wno-unused-result -Wsign-conversion $OPTIM"
-
-               # Test GCC version for certain warning flags since -Werror
-               # doesn't trigger...
-               gccversion=`$CC --version | head -1 | awk '{print $NF}'`
-               case "$gccversion" in
-                       7.* | 8.*)
-                               OPTIM="$OPTIM -Wno-format-truncation -Wno-tautological-compare"
-                               ;;
-               esac
-
-               # Additional warning options for development testing...
-               if test -d .git; then
-                       OPTIM="-Werror $OPTIM"
-               fi
-       fi
+       # Add useful warning options for tracking down problems...
+       WARNING_OPTIONS="-Wall -Wno-format-y2k -Wunused -Wno-unused-result -Wsign-conversion"
 
-       case "$host_os_name" in
-               darwin*)
-                       # -D_FORTIFY_SOURCE=2 adds additional object size
-                       # checking, basically wrapping all string functions
-                       # with buffer-limited ones.  Not strictly needed for
-                       # CUPS since we already use buffer-limited calls, but
-                       # this will catch any additions that are broken.
-                       CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
-                       ;;
-
-               linux*)
-                       # The -z relro option is provided by the Linux linker command to
-                       # make relocatable data read-only.
-                       if test x$enable_relro = xyes; then
-                               RELROFLAGS="-Wl,-z,relro,-z,now"
-                       fi
+       # Test GCC version for certain warning flags since -Werror
+       # doesn't trigger...
+       gccversion=`$CC --version | head -1 | awk '{print $NF}'`
+       case "$gccversion" in
+               7.* | 8.*)
+                       WARNING_OPTIONS="$WARNING_OPTIONS -Wno-format-truncation -Wno-tautological-compare"
                        ;;
        esac
+
+       # Additional warning options for development testing...
+       if test -d .git; then
+               WARNING_OPTIONS="-Werror $WARNING_OPTIONS"
+       fi
 else
        # Add vendor-specific compiler options...
        case $host_os_name in
                sunos*)
                        # Solaris
                        if test -z "$OPTIM"; then
-                               if test "x$with_optim" = x; then
-                                       OPTIM="-xO2"
-                               else
-                                       OPTIM="$with_optim $OPTIM"
-                               fi
+                               OPTIM="-xO2"
                        fi
 
                        if test $PICFLAG = 1; then
@@ -7097,13 +7079,13 @@ else
                        fi
                        ;;
                *)
-                       # Running some other operating system; inform the user they
-                       # should contribute the necessary options to
-                       # cups-support@cups.org...
-                       echo "Building CUPS with default compiler optimizations; contact"
-                       echo "cups-devel@cups.org with uname and compiler options needed"
-                       echo "for your platform, or set the CFLAGS and LDFLAGS environment"
-                       echo "variables before running configure."
+                       # Running some other operating system; inform the user
+                       # they should contribute the necessary options via
+                       # Github...
+                       echo "Building CUPS with default compiler optimizations; contact the CUPS developers on Github"
+                       echo "(https://github.com/apple/cups/issues) with the uname and compiler options needed for"
+                       echo "your platform, or set the CFLAGS and LDFLAGS environment variables before running"
+                       echo "configure."
                        ;;
        esac
 fi
@@ -7114,6 +7096,12 @@ case $host_os_name in
                # glibc 2.8 and higher breaks peer credentials unless you
                # define _GNU_SOURCE...
                OPTIM="$OPTIM -D_GNU_SOURCE"
+
+               # The -z relro option is provided by the Linux linker command to
+               # make relocatable data read-only.
+               if test x$enable_relro = xyes; then
+                       RELROFLAGS="-Wl,-z,relro,-z,now"
+               fi
                ;;
 esac
 
@@ -7812,7 +7800,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_KRB5CONFIG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7855,7 +7843,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_ac_pt_KRB5CONFIG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8407,7 +8395,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_LIBGNUTLSCONFIG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8450,7 +8438,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_ac_pt_LIBGNUTLSCONFIG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9021,8 +9009,6 @@ _ACEOF
 esac
 rm -rf conftest*
   fi
-
-
 fi
 
 
@@ -10490,16 +10476,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -pR'.
+    # In both cases, we have to default to `cp -p'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -pR'
+      as_ln_s='cp -p'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -pR'
+    as_ln_s='cp -p'
   fi
 else
-  as_ln_s='cp -pR'
+  as_ln_s='cp -p'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -10559,16 +10545,28 @@ else
   as_mkdir_p=false
 fi
 
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
-  test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+       test -d "$1/.";
+      else
+       case $1 in #(
+       -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -10590,7 +10588,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by CUPS $as_me 2.3b6, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -10653,10 +10651,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 CUPS config.status 2.3b6
-configured by $0, generated by GNU Autoconf 2.69,
+configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -10745,7 +10743,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
index da99f02b6dbf099c2d0af18dfb021e6271ead47e..b56e5f34a3fa88e38175b53e904f5358ab5b2190 100644 (file)
@@ -355,7 +355,7 @@ uninstall:
 
 libcups.so.2:  $(LIBOBJS)
        echo Linking $@...
-       $(DSO) $(ARCHFLAGS) $(LDFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) \
+       $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) \
                $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
        $(RM) `basename $@ .2`
        $(LN) $@ `basename $@ .2`
@@ -367,7 +367,7 @@ libcups.so.2:       $(LIBOBJS)
 
 libcups.2.dylib:       $(LIBOBJS)
        echo Linking $@...
-       $(DSO) $(ARCHFLAGS) $(LDFLAGS) $(DSOFLAGS) -o $@ \
+       $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
                -install_name $(libdir)/$@ \
                -current_version 2.14.0 \
                -compatibility_version 2.0.0 \
@@ -384,8 +384,7 @@ libcups.2.dylib:    $(LIBOBJS)
 
 libcups.la:    $(LIBOBJS)
        echo Linking $@...
-       $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) $(DSOFLAGS) -o $@ \
-               $(LIBOBJS:.o=.lo) \
+       $(LD_CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
                -rpath $(LIBDIR) -version-info 2:14 $(LIBGSSAPI) $(SSLLIBS) \
                $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
 
@@ -424,8 +423,7 @@ libcups2.def: $(LIBOBJS) $(IMAGEOBJS) Makefile
 
 libcupsimage.so.2:     $(IMAGEOBJS) libcups.so.2
        echo Linking $@...
-       $(DSO) $(ARCHFLAGS) $(LDFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS) $(DSOLIBS) \
-               -L../cups $(LINKCUPS)
+       $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS) $(DSOLIBS) $(LINKCUPS)
        $(RM) `basename $@ .2`
        $(LN) $@ `basename $@ .2`
 
@@ -436,11 +434,11 @@ libcupsimage.so.2:        $(IMAGEOBJS) libcups.so.2
 
 libcupsimage.2.dylib:  $(IMAGEOBJS) libcups.2.dylib
        echo Linking $@...
-       $(DSO) $(ARCHFLAGS) $(LDFLAGS) $(DSOFLAGS) -o $@ \
+       $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
                -install_name $(libdir)/$@ \
                -current_version 2.3.0 \
                -compatibility_version 2.0.0 \
-               $(IMAGEOBJS) $(DSOLIBS) -L../cups $(LINKCUPS)
+               $(IMAGEOBJS) $(DSOLIBS) $(LINKCUPS)
        $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
        $(RM) libcupsimage.dylib
        $(LN) $@ libcupsimage.dylib
@@ -452,9 +450,8 @@ libcupsimage.2.dylib:       $(IMAGEOBJS) libcups.2.dylib
 
 libcupsimage.la:       $(IMAGEOBJS) libcups.la
        echo Linking $@...
-       $(DSO) $(ARCHFLAGS) $(LDFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS:.o=.lo) $(DSOLIBS) \
-               -L../cups $(LINKCUPS) \
-               -rpath $(LIBDIR) -version-info 2:3
+       $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS:.o=.lo) $(DSOLIBS) \
+               $(LINKCUPS) -rpath $(LIBDIR) -version-info 2:3
 
 
 #
diff --git a/test/asan-suppressions.txt b/test/asan-suppressions.txt
new file mode 100644 (file)
index 0000000..e216654
--- /dev/null
@@ -0,0 +1 @@
+leak:main
index ac5ea76c44d24742ac87f9f727e86d7e749c3c29..42395dd7eb9452d45859d267e730e5a59ae91993 100755 (executable)
@@ -569,6 +569,14 @@ fi
 
 echo "Setting up environment variables for test..."
 
+if test "x$ASAN_OPTIONS" = x; then
+       # AddressSanitizer on Linux reports memory leaks from the main function
+       # which is basically useless - in general, programs do not need to free
+       # every object before exit since the OS will recover the process's
+       # memory.
+       ASAN_OPTIONS="suppressions=$root/test/asan-suppressions.txt"
+fi
+
 if test "x$LD_LIBRARY_PATH" = x; then
        LD_LIBRARY_PATH="$root/cups"
 else
@@ -657,17 +665,7 @@ echo "Starting scheduler:"
 echo "    $runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &"
 echo ""
 
-if test `uname` = Darwin -a "x$VALGRIND" = x; then
-        if test "x$DYLD_INSERT_LIBRARIES" = x; then
-                insert="/usr/lib/libgmalloc.dylib"
-        else
-                insert="/usr/lib/libgmalloc.dylib:$DYLD_INSERT_LIBRARIES"
-        fi
-
-       DYLD_INSERT_LIBRARIES="$insert" MallocStackLogging=1 $runcups ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &
-else
-       $runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &
-fi
+$runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &
 
 cupsd=$!