2 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
9 # Usage: gl_ADD_PROG([prog_list_var_name], [prog_name])
10 AC_DEFUN([gl_ADD_PROG],
12 if test -z "$$1"; then
19 # Usage: gl_REMOVE_PROG([prog_list_var_name], [prog_name])
20 AC_DEFUN([gl_REMOVE_PROG],
22 $1=`for gl_rem_i in $$1; do
23 test "$gl_rem_i" = "$2" || echo "$gl_rem_i"
24 done | tr '\012' ' ' | sed 's/ $//'; echo`
27 # Given the name of a variable containing a space-separated list of
28 # install-by-default programs and the list of do-not-install-by-default
29 # programs, modify the former variable to reflect "no-install" and
30 # "do-install" requests. The names in the latter list should be comma-
33 # Usage: gl_INCLUDE_EXCLUDE_PROG([prog_list_var_name], [no_inst_prog_list])
34 AC_DEFUN([gl_INCLUDE_EXCLUDE_PROG],
36 gl_no_install_progs_default=`echo '$2'|sed 's/,/ /g'`
37 AC_ARG_ENABLE([install-program],
38 [AS_HELP_STRING([--enable-install-program=PROG_LIST],
39 [install the programs in PROG_LIST (comma-separated,
41 [gl_do_install_prog=$enableval],
45 # If you want to refrain from installing programs A and B,
46 # use --enable-no-install-program=A,B
47 AC_ARG_ENABLE([no-install-program],
48 [AS_HELP_STRING([--enable-no-install-program=PROG_LIST],
49 [do NOT install the programs in PROG_LIST
50 (comma-separated, default: $2)])],
51 [gl_no_install_prog=$enableval],
55 # Convert to space separated lists.
56 gl_do_install_prog=`echo "$gl_do_install_prog"|tr -s , ' '`
57 gl_no_install_prog=`echo "$gl_no_install_prog"|tr -s , ' '`
59 # For each not-to-be-installed program name, ensure that it's a
60 # valid name, remove it from the list of programs to build/install,
61 # as well as from the list of man pages to install.
62 for gl_i in $gl_no_install_prog; do
64 # Fail upon a request to install and not-install the same program.
65 case " $gl_do_install_prog " in
66 *" $gl_i "*) AC_MSG_ERROR(['$gl_i' is both included and excluded]) ;;
70 # Warn about a request not to install a program that is not being
71 # built (which may be because the systems lacks a required interface).
73 *" $gl_i "*) gl_REMOVE_PROG([$1], $gl_i) ;;
74 *) gl_msg="'$gl_i' is already not being installed" ;;
77 if test "$gl_msg" = ''; then
78 # Warn about a request not to install a program that is
79 # already on the default-no-install list.
80 case " $gl_no_install_progs_default " in
81 *" $gl_i "*) gl_msg="by default, '$gl_i' is not installed" ;;
85 test "$gl_msg" != '' && AC_MSG_WARN([$gl_msg])
88 for gl_i in $gl_do_install_prog; do
89 case " $gl_no_install_progs_default " in
90 *" $gl_i "*) gl_ADD_PROG([$1], $gl_i) ;;
91 *) AC_MSG_WARN(['$gl_i' is not an optionally-installable program]) ;;