aboutsummaryrefslogtreecommitdiff
path: root/am
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-04-21 12:42:12 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-04-21 12:42:12 +0300
commit3f02a6139ea4ed7635453cbcdd600e815a5c2208 (patch)
tree7b5f4ae6581b459cd1ce798c2661bc21803700f6 /am
parentac16853820abac40abb0bc72e7190626877b3c7f (diff)
downloadgrecs-3f02a6139ea4ed7635453cbcdd600e815a5c2208.tar.gz
grecs-3f02a6139ea4ed7635453cbcdd600e815a5c2208.tar.bz2
Improve GRECS_SETUP.
The macro takes an optional second argument. When given, it supplies the name of the preprocessor setup file to install. Options available for use in the 1st argument are: no-preproc Generate the --without-preprocessor option. std-pp-setup Install the default pp-setup file. Note for upgraders: earlier this was the default! pp-setup-option Generate the --with-pp-setup-file option. * am/grecs.m4 (GRECS_SETUP): Handle new options.
Diffstat (limited to 'am')
-rw-r--r--am/grecs.m464
1 files changed, 58 insertions, 6 deletions
diff --git a/am/grecs.m4 b/am/grecs.m4
index 72c6432..dfed409 100644
--- a/am/grecs.m4
+++ b/am/grecs.m4
@@ -1,4 +1,4 @@
1# This file is part of grecs - Gray's Extensible Configuration System 1# This file is part of grecs - Gray's Extensible Configuration System -*- autoconf -*-
2# Copyright (C) 2007, 2009, 2010 Sergey Poznyakoff 2# Copyright (C) 2007, 2009, 2010 Sergey Poznyakoff
3# 3#
4# Grex is free software; you can redistribute it and/or modify 4# Grex is free software; you can redistribute it and/or modify
@@ -14,12 +14,48 @@
14# You should have received a copy of the GNU General Public License 14# You should have received a copy of the GNU General Public License
15# along with Grex. If not, see <http://www.gnu.org/licenses/>. 15# along with Grex. If not, see <http://www.gnu.org/licenses/>.
16 16
17# GRECS_SETUP([no-preproc]) 17# _GRECS_MANGLE_OPTION(NAME)
18# -------------------------
19# Convert NAME to a valid m4 identifier, by replacing invalid characters
20# with underscores, and prepend the _GRECS_OPTION_ suffix to it.
21AC_DEFUN([_GRECS_MANGLE_OPTION],
22[[_GRECS_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
23
24# _GRECS_SET_OPTION(NAME)
25# ----------------------
26# Set option NAME.
27AC_DEFUN([_GRECS_SET_OPTION],
28[m4_define(_GRECS_MANGLE_OPTION([$1]), 1)])
29
30# _GRECS_IF_OPTION_SET(NAME,IF-SET,IF-NOT-SET)
31# -------------------------------------------
32# Check if option NAME is set.
33AC_DEFUN([_GRECS_IF_OPTION_SET],
34[m4_ifset(_GRECS_MANGLE_OPTION([$1]),[$2],[$3])])
35
36# _GRECS_OPTION_SWITCH(NAME1,IF-SET1,[NAME2,IF-SET2,[...]],[IF-NOT-SET])
37# ------------------------------------------------------------------------
38# If NAME1 is set, run IF-SET1. Otherwise, if NAME2 is set, run IF-SET2.
39# Continue the process for all name-if-set pairs within [...]. If none
40# of the options is set, run IF-NOT-SET.
41AC_DEFUN([_GRECS_OPTION_SWITCH],
42[m4_if([$4],,[_GRECS_IF_OPTION_SET($@)],dnl
43[$3],,[_GRECS_IF_OPTION_SET($@)],dnl
44[_GRECS_IF_OPTION_SET([$1],[$2],[_GRECS_OPTION_SWITCH(m4_shift(m4_shift($@)))])])])
45
46# _GRECS_SET_OPTIONS(OPTIONS)
47# ----------------------------------
48# OPTIONS is a space-separated list of Gint options.
49AC_DEFUN([_GRECS_SET_OPTIONS],
50[m4_foreach_w([_GRECS_Option], [$1], [_GRECS_SET_OPTION(_GRECS_Option)])])
51
52# GRECS_SETUP([no-preproc std-pp-setup pp-setup-option],[pp-setup-file])
18AC_DEFUN([GRECS_SETUP],[ 53AC_DEFUN([GRECS_SETUP],[
54 _GRECS_SET_OPTIONS([$1])
19 # ********************** 55 # **********************
20 # Preprocessor 56 # Preprocessor
21 # ********************** 57 # **********************
22 m4_if($1,[no-preproc], 58 _GRECS_IF_OPTION_SET([no-preproc],
23 [use_ext_pp=no], 59 [use_ext_pp=no],
24 [AC_ARG_WITH([preprocessor], 60 [AC_ARG_WITH([preprocessor],
25 AC_HELP_STRING([--without-preprocessor], 61 AC_HELP_STRING([--without-preprocessor],
@@ -48,9 +84,25 @@ AC_DEFUN([GRECS_SETUP],[
48 DEFAULT_PREPROCESSOR=$PPBIN 84 DEFAULT_PREPROCESSOR=$PPBIN
49 if test -n "$DEFAULT_PREPROCESSOR"; then 85 if test -n "$DEFAULT_PREPROCESSOR"; then
50 DEFAULT_PREPROCESSOR="$DEFAULT_PREPROCESSOR $PREPROC_OPTIONS" 86 DEFAULT_PREPROCESSOR="$DEFAULT_PREPROCESSOR $PREPROC_OPTIONS"
51 case $PPBIN in 87 _GRECS_IF_OPTION_SET([std-pp-setup],
52 *m4) AC_SUBST(PP_SETUP_FILE,'pp-setup');; # Install default pp-setup 88 [PP_SETUP_FILE='pp-setup'],
53 esac 89 [m4_if([$2],,[PP_SETUP_FILE=],[PP_SETUP_FILE='$2'])])
90 AC_SUBST(PP_SETUP_FILE)
91 if test -n "$PP_SETUP_FILE"; then
92 _GRECS_IF_OPTION_SET([pp-setup-option],
93 [AC_ARG_WITH([pp-setup-file],
94 AC_HELP_STRING([--with-pp-setup-file],
95 [install the default pp-setup file]),
96 [case "${withval}" in
97 yes) ;;
98 no) PP_SETUP_FILE=;;
99 *) AC_MSG_ERROR([bad value ${withval} for --with-pp-setup-file]) ;;
100 esac])],
101 [case $PPBIN in
102 *m4) ;; # Install default pp-setup
103 *) PP_SETUP_FILE=;; # Skip it
104 esac])
105 fi
54 fi 106 fi
55 PATH=$save_PATH 107 PATH=$save_PATH
56 DEFAULT_PREPROCESSOR="\\\"$DEFAULT_PREPROCESSOR\\\"" 108 DEFAULT_PREPROCESSOR="\\\"$DEFAULT_PREPROCESSOR\\\""

Return to:

Send suggestions and report system problems to the System administrator.