Re: [AD] Fortify and Allegro

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> And here it is. I apparently hadn't made a previous copy of the
> configure.in file before changing it, so I didn't notice it had
> changed for this addition when I scanned for this diff (eg,
> something like find -name \*.fortify).

--- configure.in	Sun Jan 26 17:22:54 2003
+++ configure.in	Tue Mar 11 11:33:51 2003
@@ -99,6 +99,11 @@
 [  --enable-strictwarn[=x] produce strict compiler warnings [default=no]],
 test "X$enableval" != "Xno" && allegro_strict_warnings=yes)
 
+dnl Enable Fortify.
+AC_ARG_ENABLE(fortify,
+[  --enable-fortify[=x]    enable Fortify [default=no]],
+test "X$enableval" != "Xno" && allegro_use_fortify=yes)
+
 dnl Check that $prefix is set (needed for ALLEGRO_ACTEST_GCC_INCLUDE_PREFIX)
 test "$prefix" = NONE && prefix=/usr/local
 
@@ -299,6 +304,12 @@
 dnl Test where is sched_yield (SunOS).
 ALLEGRO_ACTEST_SCHED_YIELD
 
+dnl Fortify support.
+if test -n "$allegro_use_fortify"; then
+  AC_DEFINE(ALLEGRO_USE_FORTIFY)
+  LIBS="$LIBS -lfortify"
+fi
+
 dnl Test for OSS drivers.
 ALLEGRO_ACTEST_OSSDIGI
 if test -n "$allegro_support_ossdigi"; then
--- base.h.fortify	Mon Mar 24 23:57:31 2003
+++ include/allegro/base.h	Tue Mar 18 03:10:05 2003
@@ -31,6 +31,15 @@
    #include <time.h>
 #endif
 
+#if defined DEBUGMODE && defined ALLEGRO_USE_FORTIFY
+#if defined ALLEGRO_LIB_BUILD || defined FORTIFY
+#ifndef FORTIFY
+#define FORTIFY
+#endif
+#include <fortify/fortify.h>
+#endif
+#endif
+
 #ifdef __cplusplus
    extern "C" {
 #endif


If I understand correctly the patch, issuing

	./configure --enable-fortify

won't build the Fortified version of the library, right? You need to 
additionally pass --enable-dbglib. And it's the same for the bundled 
programs, they won't be fortified unless you pass --enable-dbgprog.

So I propose instead --enable-dbg-with-fortify (or --enable-fortify-with-dbg, 
which one is the best?).

-- 
Eric Botcazou




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/