changeset 21397:df859661e31e

generate default-qt-settings at configure time * acinclude.m4 (OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES): New macro. * configure.ac: Use it. * mk-default-qt-settings.in: New script template created from do_subst_qt_settings macro in common.mk * common.mk (do_subst_qt_settings): Delete macro definition.
author John W. Eaton <jwe@octave.org>
date Wed, 02 Mar 2016 16:46:23 -0500
parents 309bba07a4f6
children 7e8a410e6124
files build-aux/common.mk configure.ac libgui/mk-default-qt-settings.in libgui/module.mk m4/acinclude.m4
diffstat 5 files changed, 50 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/build-aux/common.mk	Thu Mar 03 09:56:00 2016 -0800
+++ b/build-aux/common.mk	Wed Mar 02 16:46:23 2016 -0500
@@ -508,13 +508,6 @@
   $(simple_move_if_change_rule)
 endef
 
-define do_subst_qt_settings
-  $(SED) < $< \
-    -e "s|%DEFAULT_TERMINAL_FONT%|${DEFAULT_TERMINAL_FONT}|" \
-    -e "s|%DEFAULT_TERMINAL_FONT_SIZE%|${DEFAULT_TERMINAL_FONT_SIZE}|" > $@-t && \
-  $(simple_move_if_change_rule)
-endef
-
 define subst-bison-api-decls
   case "$(BISON_API_PREFIX_DECL_STYLE)" in \
     *api*) \
--- a/configure.ac	Thu Mar 03 09:56:00 2016 -0800
+++ b/configure.ac	Wed Mar 02 16:46:23 2016 -0500
@@ -3196,7 +3196,10 @@
   oct-conf-post.h:oct-conf-post.in.h
   Makefile
   doc/doxyhtml/Doxyfile
-  libgnu/Makefile
+  libgnu/Makefile])
+
+OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES([
+  libgui/mk-default-qt-settings
   liboctave/cruft/mkf77def])
 
 AC_OUTPUT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/mk-default-qt-settings.in	Wed Mar 02 16:46:23 2016 -0500
@@ -0,0 +1,28 @@
+#! /bin/sh
+#
+# Copyright (C) 2016 John W. Eaton
+#
+# This file is part of Octave.
+#
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+SED=${SED:-sed}
+
+DEFAULT_TERMINAL_FONT = @DEFAULT_TERMINAL_FONT@
+DEFAULT_TERMINAL_FONT_SIZE = @DEFAULT_TERMINAL_FONT_SIZE@
+
+$(SED) \
+  -e "s|%DEFAULT_TERMINAL_FONT%|${DEFAULT_TERMINAL_FONT}|" \
+  -e "s|%DEFAULT_TERMINAL_FONT_SIZE%|${DEFAULT_TERMINAL_FONT_SIZE}|"
--- a/libgui/module.mk	Thu Mar 03 09:56:00 2016 -0800
+++ b/libgui/module.mk	Wed Mar 02 16:46:23 2016 -0500
@@ -70,8 +70,14 @@
 
 octlocale_DATA += $(LOCALES)
 
-libgui/default-qt-settings: libgui/default-qt-settings.in | libgui/$(octave_dirstamp)
-	$(AM_V_GEN)$(do_subst_qt_settings)
+define gen-default-qt-settings
+  rm -f $@-t $@ && \
+  $(SHELL) libgui/mk-default-qt-settings < $< > $@-t && \
+  mv $@-t $@
+endef
+
+libgui/default-qt-settings: libgui/default-qt-settings.in libgui/mk-default-qt-settings | libgui/$(octave_dirstamp)
+	$(AM_V_GEN)$(gen-default_qt_settings)
 
 DIRSTAMP_FILES += \
   libgui/$(octave_dirstamp)
--- a/m4/acinclude.m4	Thu Mar 03 09:56:00 2016 -0800
+++ b/m4/acinclude.m4	Wed Mar 02 16:46:23 2016 -0500
@@ -1317,6 +1317,16 @@
     fi])
 ])
 dnl
+dnl Like AC_CONFIG_FILES, but don't touch the output file if it already
+dnl exists and hasn't changed.
+dnl
+AC_DEFUN([OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES], [
+  m4_foreach_w([elt], [$1], [
+    AC_CONFIG_FILES(elt[-tmp:]elt[.in])
+    AC_CONFIG_COMMANDS(elt,
+    [$SHELL $srcdir/build-aux/move-if-change ]elt[-tmp ]elt)])])
+
+dnl
 dnl Check if the C++ library has the bit_and, bit_or, and bit_xor
 dnl templates defined.
 dnl