diff --git a/autogen/config.in b/autogen/config.in
index 89174519488..c39453938be 100644
--- a/autogen/config.in
+++ b/autogen/config.in
@@ -161,6 +161,13 @@ along with GNU Emacs. If not, see . */
or signaling SIGFPE/SIGILL. */
#undef FLOAT_CHECK_DOMAIN
+/* Enable compile-time and run-time bounds-checking, and some warnings,
+ without upsetting glibc 2.15+. */
+ #if defined __OPTIMIZE__ && __OPTIMIZE__
+ # define _FORTIFY_SOURCE 2
+ #endif
+
+
/* Define to 1 if futimesat mishandles a NULL file name. */
#undef FUTIMESAT_NULL_BUG
@@ -1458,9 +1465,6 @@ along with GNU Emacs. If not, see . */
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
-/* enable compile-time and run-time bounds-checking, and some warnings */
-#undef _FORTIFY_SOURCE
-
/* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct
stat.st_size becomes 64-bit. */
#undef _GL_WINDOWS_64_BIT_ST_SIZE
diff --git a/autogen/configure b/autogen/configure
index 90fa63c7322..11bca94ea05 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -7784,8 +7784,6 @@ fi
$as_echo "#define lint 1" >>confdefs.h
-$as_echo "#define _FORTIFY_SOURCE 2" >>confdefs.h
-
$as_echo "#define GNULIB_PORTCHECK 1" >>confdefs.h