FLTK logo

[master] 2001132 - Add configure option to build tests only on request (#940)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 2001132 - Add configure option to build tests only on request (#940) "Albrecht Schlosser" 09:32 Mar 20  
 
commit 2001132f4a1ab2ad02f31c4a7c4cf9a5d803ed54
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Wed Mar 20 17:23:21 2024 +0100
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Wed Mar 20 17:24:12 2024 +0100

    Add configure option to build tests only on request (#940)
    
    Option: ./configure --disable-test   build test programs (default=yes)
    
    Thanks for the patch(es) to @michaelbaeuerle.
    
    I added `make test` to be able to build the test programs from the
    FLTK root directory if FLTK was configured with --disable-test.

 Makefile       |  9 +++++++--
 configure.ac   | 16 +++++++++++++++-
 makeinclude.in |  3 +++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git Makefile Makefile
index c02de09..41e1121 100644
--- Makefile
+++ Makefile
@@ -1,7 +1,7 @@
 #
 # Top-level Makefile for the Fast Light Tool Kit (FLTK).
 #
-# Copyright 1998-2023 by Bill Spitzak and others.
+# Copyright 1998-2024 by Bill Spitzak and others.
 #
 # This library is free software. Distribution and use rights are outlined in
 # the file "COPYING" which should have been included with this file.  If this
@@ -16,7 +16,7 @@
 
 include makeinclude
 
-DIRS = $(IMAGEDIRS) $(LIBDECORDIR) src $(CAIRODIR) $(FLUIDDIR) fltk-options test \
+DIRS = $(IMAGEDIRS) $(LIBDECORDIR) src $(CAIRODIR) $(FLUIDDIR) fltk-options $(TESTDIR) \
        documentation
 
 all: makeinclude fltk-config
@@ -25,6 +25,11 @@ all: makeinclude fltk-config
 		(cd $$dir; $(MAKE) $(MFLAGS)) || exit 1;\
 	done
 
+# Build test programs (and 'all') if FLTK was configured with '--disable-test'
+test: all
+	echo "=== making test ===";\
+	(cd test; $(MAKE) $(MFLAGS)) || exit 1
+
 install: makeinclude
 	-mkdir -p $(DESTDIR)$(bindir)
 	$(RM) $(DESTDIR)$(bindir)/fltk-config
diff --git configure.ac configure.ac
index e519f84..c00a9a3 100644
--- configure.ac
+++ configure.ac
@@ -3,7 +3,7 @@ dnl the "configure" script is made from this by running GNU "autoconf"
 dnl
 dnl Configuration script for the Fast Light Tool Kit (FLTK).
 dnl
-dnl Copyright 1998-2023 by Bill Spitzak and others.
+dnl Copyright 1998-2024 by Bill Spitzak and others.
 dnl
 dnl This library is free software. Distribution and use rights are outlined in
 dnl the file "COPYING" which should have been included with this file.  If this
@@ -102,6 +102,14 @@ AS_IF([test x$enable_debug = xyes], [
     DEBUGFLAG=""
 ])
 
+AC_ARG_ENABLE([test], AS_HELP_STRING([--disable-test], [build test programs (default=yes)]))
+AS_IF([test x$enable_test = xno], [
+    TESTDIR=""
+], [
+    TESTDIR="test"
+])
+AC_SUBST(TESTDIR)
+
 AC_ARG_ENABLE([forms], AS_HELP_STRING([--disable-forms], [build Forms compatibility library (default=yes)]))
 
 AC_ARG_ENABLE([gl], AS_HELP_STRING([--disable-gl], [turn off OpenGL support]))
@@ -1815,6 +1823,12 @@ AS_IF([test x$enable_fluid != xno], [
     echo "    Build fluid: NO"
     ])
 
+AS_IF([test x$enable_test != xno], [
+    echo "    Build tests: YES"
+    ],[
+    echo "    Build tests: NO"
+    ])
+
 AS_IF([test "$fltk_cross_compiling" = "yes"], [
     echo "Cross-compiling: YES"
     echo "          Build: $build -> Host: $host"
diff --git makeinclude.in makeinclude.in
index 3057095..b1aee3a 100644
--- makeinclude.in
+++ makeinclude.in
@@ -89,6 +89,9 @@ GLLIBBASENAME	= @GLLIBBASENAME@
 IMGLIBBASENAME	= @IMGLIBBASENAME@
 CAIROLIBBASENAME= @CAIROLIBBASENAME@
 
+# Test programs (optional, --disable-test):
+TESTDIR		= @TESTDIR@
+
 # libraries to link with:
 AUDIOLIBS	= @AUDIOLIBS@
 CAIROLIBS	= @CAIROLIBS@
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.