Skip to content
Snippets Groups Projects
dunecontrol 19.4 KiB
Newer Older
  • Learn to ignore specific revisions
  • Christian Engwer's avatar
    Christian Engwer committed
    #!/bin/bash
    
    Christian Engwer's avatar
    Christian Engwer committed
    ###############################################
    ###
    ### check for environment variables
    ###
    
    if test -z $MAKE; then
      MAKE=make
    fi
    
    ###############################################
    ###
    ### read lib
    ###
    
    
    	if test $# -ne 1; then
    		echo Usage: canonicalname path >&2
    		return 1
    	fi
    
    	file="`eval echo $1`" # expand ~
    
    	if test ! -e "$file"; then
    		echo $file: file not found >&2
    		return 1
    	fi
        # if this is a symlink, then follow the symlink
    	if test -L "$file"; then
    		fdir="`dirname \"$file\"`"
    		flink="`readlink \"$file\"`"
    		if test -e "$flink"; then
    			# these are absolute links, or links in the CWD
    			canonicalname "$flink"
    		else
    			canonicalname "$fdir/$flink"
    		fi
    	else
            # if this is a file, then remember the filename and
            # canonicalize the directory name
    		if test -f "$file"; then
    			fdir="`dirname \"$file\"`"
    			fname="`basename \"$file\"`"
    			fdir="`canonicalname \"$fdir\"`"
    			echo "$fdir/$fname"
    		fi
            # if this is a directory, then create an absolute 
            # directory name and we are done
    		if test -d "$file"; then
    			(cd "$file"; pwd)
    		fi
    	fi
    
         echo Usage: canonicalpath path >&2
    
    Christian Engwer's avatar
    Christian Engwer committed
    checkdebug () {
      while test $# -gt 0; do
        if test x$1 = x--debug; then
          echo yes
          return
        fi
        shift
      done
      echo no
    }
    
    Christian Engwer's avatar
    Christian Engwer committed
    DEBUG=`checkdebug $@`
    
    if test "x$DEBUG" = "xyes"; then
    
    export COMMAND_DIR="`canonicalpath $0`"
    
    export RESUME_FILE="$0.resume"
    
    . "$COMMAND_DIR/dunemodules.inc"
    
    # create PKG_CONFIG_PATH for installed dune modules
    
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:`canonicalpath $0`/../lib/pkgconfig"
    
    Christian Engwer's avatar
    Christian Engwer committed
    ###############################################
    
    #
    # for each module load the $CONTROL script part and run $command
    #
    # parameters:
    # $1 command to execute
    #
    
    Christian Engwer's avatar
    Christian Engwer committed
      local command="$1"
    
      for module in $modules ; do
        echo $module
      done > $RESUME_FILE
    
    Christian Engwer's avatar
    Christian Engwer committed
      for module in $modules; do
    
        local path=$(eval "echo \$PATH_${module}")
    
    Christian Engwer's avatar
    Christian Engwer committed
        eval echo "--- calling $command for \$NAME_${module} ---"
    
        if ! (
    
    	  export module
    
          eval_control $runcommand $path/$CONTROL
    
        ); then eval echo "--- Failed to build \$NAME_${module} ---"; exit 1; fi
    
    
        modules_togo=`cat $RESUME_FILE`
        for module_togo in $modules_togo ; do
          if test x$module_togo != x$module ; then
            echo $module_togo
          fi
        done > $RESUME_FILE
    
    
    #
    # load command options from an opts file
    
    Christian Engwer's avatar
    Christian Engwer committed
    # the name of the opts file is stored in the global variable $DUNE_OPTS_FILE
    
    #
    # parameters:
    # $1 command
    #
    
      local command=$1
      local COMMAND=$(echo $command | tr '[:lower:]' '[:upper:]')
    
    Christian Engwer's avatar
    Christian Engwer committed
      CMD_FLAGS="$(eval echo \$${COMMAND}_FLAGS)"
    
      local CMD_FLAGS_FROM_FILE=""
    
    Christian Engwer's avatar
    Christian Engwer committed
      if test "x$DUNE_OPTS_FILE" != "x"; then
    
        CMD_FLAGS_FROM_FILE="$(eval ${COMMAND}_FLAGS=""; . $DUNE_OPTS_FILE; eval echo \$${COMMAND}_FLAGS)"
    
    Christian Engwer's avatar
    Christian Engwer committed
      fi
    
      if test -n "$CMD_FLAGS_FROM_FILE"; then
    
    Christian Engwer's avatar
    Christian Engwer committed
        echo "----- using default flags \$${COMMAND}_FLAGS from $DUNE_OPTS_FILE -----"
    
        CMD_FLAGS=$CMD_FLAGS_FROM_FILE
    
    Christian Engwer's avatar
    Christian Engwer committed
      elif test -n "$CMD_FLAGS"; then
        echo "----- using default flags \$${COMMAND}_FLAGS from environment -----"
    
    }
    
    ###############################################
    
    # check wheteher the parameter is valid command or not
    is_command() {
    
    Christian Engwer's avatar
    Christian Engwer committed
    eval '
    case "$1" in
      '`echo $COMMANDS | sed -e 's/ / | /g'`')
        return 0
        ;;
      *)
        return 1
        ;;
    esac'
    
    # list of all dunecontrol commands
    
    COMMANDS="update autogen configure make all exec status svn"
    
    
    # help string for the commands
    update_HELP="updated all modules from the repository"
    autogen_HELP="run the autogen.sh script for each module"
    configure_HELP="run configure for each module"
           # "NOTE: the --with-dune* parameters will be generated by dunecontrol"
    make_HELP="run make for each module"
    
    all_HELP="\trun 'autogen', 'configure' and 'make' command for each module"
    
           # "NOTE: run all for an initial setup"
    exec_HELP="execute an arbitrary command in each module directory"
    
    status_HELP="show vc status for all modules"
    
    svn_HELP="\trun svn command for each svn managed module"
    
    # setup command proxies
    # call will be forwarded to run_default_$command
    
    for command in $COMMANDS; do
      eval "run_$command () { run_default_$command; }"
    done
    
    #
    # default implementations for commands... 
    # these can be overwritten in the $CONTROL files
    #
    
    Christian Engwer's avatar
    Christian Engwer committed
    run_default_exec () { bash -c "eval $CMD_FLAGS"; }
    
      local verbose=0
      local update=""
    
    Christian Engwer's avatar
    Christian Engwer committed
      for i in $CMD_FLAGS; do
    
        if eval test "x$i" = "x-v"; then verbose=1; fi
        if eval test "x$i" = "x-vv"; then verbose=2; fi
        if eval test "x$i" = "x-u"; then update="-u"; fi
      done
    
      # is out output connected to a tty?
      if test -t 1; then
        blue="\e[1m\e[34m"
        green="\e[1m\e[32m"
    
        red="\e[1m\e[31m"
    
      if test $verbose -eq 1; then
        svn status $update | grep -E "^M|^A|^D|^C|^U"
      elif test $verbose -eq 2; then
        svn status $update
    
      fi
    
      name="$(eval echo \$NAME_$module)"
    
      changed=$(svn status | grep -E "^M|^A|^D" | wc -l)
      collisions=$(svn status | grep -E "^C"| wc -l)
      pending=$(svn status $update | grep -E "^...... \* " | wc -l)
    
      color=$green
      text="no changes"
      if [ $changed -eq 0 ]; then
    	true
      elif [ $changed -eq 1 ]; then
    	color=$blue;
        text="1 change"
      else
    	color=$blue;
        text="$changed changes"
      fi
      if [ $pending -eq 0 ]; then
    	true
      elif [ $pending -eq 1 ]; then
    	color=$blue;
        text="$text, 1 update pending"
      else
    	color=$blue;
        text="$text, $pending updates pending"
      fi
      if [ $collisions -eq 0 ]; then
    	true
      elif [ $collisions -eq 1 ]; then
    	color=$red
        text="$text, 1 collision"
    
    	color=$red
        text="$text, $count collisions"
    
      echo -e "$color[$text]$reset $name"
    
    run_default_update () {
    
      if test -d .git/svn && type git > /dev/null &&
          test x`git config --get dune.autoupdate` = xtrue; then
          git checkout master
          git svn rebase
          echo '*.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store' | tr ' ' '\n' \
              > .git/info/exclude
          git svn show-ignore >> .git/info/exclude
          return
    
      if test -d .svn; then
        svn update
        return
      fi
      if test -d CVS; then
        cvs update -dP
        return
      fi
      echo "WARNING: $module is not under a known version control system."
      echo "         We support svn and cvs."
    }
    
    run_default_autogen () {
    
    Christian Engwer's avatar
    Christian Engwer committed
      PARAMS="$CMD_FLAGS"
    
      local M4_PATH=""
    
      if test -f configure.ac && \
         ( test -d .svn || test -d .git || test -d CVS || test -f stamp-vc ); then
    
        for m in $FOUND_MODULES; do
          path=$(eval "echo \$PATH_$m")
    
    Christian Engwer's avatar
    Christian Engwer committed
          MODULE_PATHS="$MODULE_PATHS$path "
    
          eval echo "WARNING: \$NAME_$module contains obsolete autogen.sh," \
    
    		  >&2
    	  echo "         dune-autogen is used instead." >&2
    
    Christian Engwer's avatar
    Christian Engwer committed
        eval "$COMMAND_DIR/dune-autogen" "$MODULE_PATHS" "$PARAMS" || exit 1
    
        echo Skipping dune-autogen
    
    run_default_configure () {
    
    Christian Engwer's avatar
    Christian Engwer committed
      PARAMS="$CMD_FLAGS"
    
      if test -x configure; then
    
    Christian Engwer's avatar
    Christian Engwer committed
    	ACLOCAL_FLAGS="-I ."
    	for m in $FOUND_MODULES; do
          path=$(eval "echo \$PATH_$m")
          name=$(eval "echo \$NAME_$m")
          if test -d "$path/m4"; then
              ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $path/m4"
          fi
          if test -d "$path/share/aclocal"; then
              ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $path/share/aclocal"
          fi
    	  PARAMS="$PARAMS \"--with-$name=$path\""
    	done
    	PARAMS="$PARAMS ACLOCAL_AMFLAGS=\"$ACLOCAL_FLAGS\""
    
        echo ./configure "$PARAMS"
        eval ./configure "$PARAMS" || exit 1
    
      else
        if test -f configure.in || test -f configure.ac; then
    
          echo "ERROR: configure.[in|ac] found, but configure missing." >&2
          echo "Did you forget to run autoconf?" >&2
          echo "Perhaps you didn't update your project to" >&2
          echo "the latest buildsystem changes (FS#382)." >&2
          echo "If your project is under version control, please make sure" >&2
          echo "you have a file stamp-vc in you top_srcdir." >&2
    
    run_default_make () {
    
    Christian Engwer's avatar
    Christian Engwer committed
      PARAMS="$CMD_FLAGS"
    
      echo make "$PARAMS"
    
    Christian Engwer's avatar
    Christian Engwer committed
      eval $MAKE "$PARAMS"
    
    run_default_all () {
    
    Christian Engwer's avatar
    Christian Engwer committed
      for cmd in autogen configure make; do
        eval echo "--- calling $cmd for \$NAME_${module} ---"
        load_opts $cmd
        run_$cmd
      done
    
    Christian Engwer's avatar
    Christian Engwer committed
    run_default_svn () {
      if test -d .svn; then
    
    Christian Engwer's avatar
    Christian Engwer committed
    	PARAMS="$CMD_FLAGS"
    
    Christian Engwer's avatar
    Christian Engwer committed
    	eval svn "$PARAMS"
      fi
    }
    
    
    ###############################################
    
      echo "Execution of $(basename $0) terminated due to errors!" >&2
    
        echo "Usage: $(basename $0) [OPTIONS] COMMANDS [COMMAND-OPTIONS]"
    
        echo "  Execute COMMANDS for all Dune modules found. All entries in the"
        echo "  DUNE_CONTROL_PATH variable are scanned recursively for Dune modules."
    	echo "  If DUNE_CONTROL_PATH is empty, the current directory is scanned."
        echo "  Dependencies are controlled by the $CONTROL files."
    
        echo "  -h, --help         show this help"
        echo "      --debug        enable debug output of this script"
    
    Markus Blatt's avatar
    Markus Blatt committed
        echo "      --module=mod   only apply the actions on module mod"
        echo "                     and all modules it depends on"
        echo "      --only=mod     only apply the actions on module mod"
        echo "                     and not the modules it depends on"
    
    Christian Engwer's avatar
    Christian Engwer committed
        echo "      --current      only apply the actions on the current module,"
        echo "                     the one in whichs source tree we are standing"
    
        echo "      --resume       resume a previous run (only consider the modules"
        echo "                     not built successfully on the previous run)"
    
        echo "      --opts=FILE    load default options from FILE"
    
        echo "                     (see dune-common/doc/example.opts)"
    
        echo "      --[COMMAND]-opts=opts   set options for COMMAND"
    
    Oliver Sander's avatar
    Oliver Sander committed
        echo "                     (this is mainly useful for the all COMMAND)"
    
        echo "COMMANDS:"
        echo "  Colon seperated list of commands. Availabel commands are:"
    
        printf "  \`help'\tguess what :-)\n"
        printf "  \`print'\tprint the list of modules sorted after their dependencies\n"
    
        for i in $COMMANDS; do
    
          printf "  \`$i'\t$(eval echo \$${i}_HELP)\n"
    
        printf "  \`export'\trun eval \`dunecontrol export\` to save the list of\n"
        printf "  \t\tdune.module files to the DUNE_CONTROL_PATH variable\n"
    
    Christian Engwer's avatar
    Christian Engwer committed
    # create the module list
    create_module_list() {
      find_modules_in_path
    
    Christian Engwer's avatar
    Christian Engwer committed
    	sort_modules $SEARCH_MODULES
    
    Christian Engwer's avatar
    Christian Engwer committed
      fi
      if test "x$ONLY" != x; then
        export MODULES="$ONLY"
      fi
    }
    
    
    # print the module list
    print_module_list() {
      DELIM=$1
      shift
      while test -n "$2"; do
        echo -n "$(eval echo \$NAME_$1)$DELIM"
        shift
      done
      echo -n "$(eval echo \$NAME_$1)"
    }
    
    
    Christian Engwer's avatar
    Christian Engwer committed
    if test "x$1" = "x"; then
    
    Christian Engwer's avatar
    Christian Engwer committed
    #for i in $COMMANDS; do
    #  COMMAND=$(echo $i | tr '[:lower:]' '[:upper:]')
    #  export ${COMMAND}_FLAGS=""
    #done
    
    # clear variables
    export SEARCH_MODULES=""
    export MODULES=""
    export ONLY=""
    
    
    # parse commandline parameters
    
    while test $# -gt 0; do
    
        set +e
        # stolen from configure...
        # when no option is set, this returns an error code
        arg=`expr "x$option" : 'x[^=]*=\(.*\)'`
        set -e
    
    
        case "$option" in
    
    Christian Engwer's avatar
    Christian Engwer committed
          if test "x$arg" = "x"; then
    
            echo "ERROR: Parameter for --opts is missing"  >&2
            echo  >&2
    
          DUNE_OPTS_FILE=`canonicalname $arg`
    
    Christian Engwer's avatar
    Christian Engwer committed
          if ! test -r "$DUNE_OPTS_FILE"; then
    
            echo "ERROR: could not read opts file \"$DUNE_OPTS_FILE\""  >&2
            echo  >&2
    
        ;;
    	--*-opts=*)
          optcmd=`expr "x$option=" : 'x--\([^-]*\)-opts=.*'`
          if is_command $optcmd; then
    
            COMMAND=`echo $optcmd | tr '[:lower:]' '[:upper:]'`
    
            export ${COMMAND}_FLAGS="$arg"
          else
            usage
    
            echo "ERROR: unknown option \"$option\""  >&2
    
    Christian Engwer's avatar
    Christian Engwer committed
          if test "x$arg" = "x"; then
    
            echo "ERROR: Parameter for --module is missing"  >&2
            echo  >&2
    
    	  for a in `echo $arg | tr ',' ' '`; do
    
    Christian Engwer's avatar
    Christian Engwer committed
            export NAME_`fix_variable_name $a`="$a"
    
            fix_and_assign MODULE "$a"
            export SEARCH_MODULES="$SEARCH_MODULES $MODULE"
          done
    
    Christian Engwer's avatar
    Christian Engwer committed
        --only=*)
    
    Christian Engwer's avatar
    Christian Engwer committed
          if test "x$arg" = "x"; then
    
    Christian Engwer's avatar
    Christian Engwer committed
            usage
    
            echo "ERROR: Parameter for --only is missing"  >&2
            echo  >&2
    
    Christian Engwer's avatar
    Christian Engwer committed
            exit 1;
          fi
    
    	  for a in `echo $arg | tr ',' ' '`; do
    
    Christian Engwer's avatar
    Christian Engwer committed
            export NAME_`fix_variable_name $a`="$a"
    
            fix_and_assign MODULE "$a"
            export SEARCH_MODULES="$SEARCH_MODULES $MODULE"
            export ONLY="$ONLY $MODULE"
          done
    
    Christian Engwer's avatar
    Christian Engwer committed
    	;;
        --current)
    	  while ! test -f $CONTROL; do
            cd ..
    	 	if test "$OLDPWD" = "$PWD"; then
    		  echo "You are not inside the source tree of a DUNE module." >&2
    		  exit -1
     		fi
    	  done;
    	  parse_control $PWD/$CONTROL
          fix_and_assign MODULE "$module"
          export SEARCH_MODULES="$SEARCH_MODULES $MODULE"
          export ONLY="$ONLY $MODULE"
          export HAVE_${module}=
    
    Christian Engwer's avatar
    Christian Engwer committed
        ;;
    
        --resume)
          if test -s $RESUME_FILE ; then
            RESUME="`cat $RESUME_FILE`"
            for a in $RESUME ; do
              export NAME_`fix_variable_name $a`="$a"
              fix_and_assign MODULE "$a"
              export SEARCH_MODULES="$SEARCH_MODULES $MODULE"
              export ONLY="$ONLY $MODULE"
            done
          else
            echo "Error: No previous run to resume. ('$RESUME_FILE' is empty or does not exist)"
            exit 1
          fi
        ;;
    
    Christian Engwer's avatar
    Christian Engwer committed
        --debug) true ;; # ignore this option, it is handled right at the beginning
    
          echo "ERROR: Unknown option \`$option'"  >&2
          echo  >&2
    
    while test $# -gt 0; do
    
    Christian Engwer's avatar
    Christian Engwer committed
      # get command
      command=$1
    
    Christian Engwer's avatar
    Christian Engwer committed
      # get command options
      CMD_FLAGS=
      while test $# -gt 0 && test "$1" != ":"; do
        COMMAND=$(echo $command | tr '[:lower:]' '[:upper:]')
        # setup paramter list
        CMD_FLAGS="$CMD_FLAGS \"$1\""
        shift
      done
      if test -z "$CMD_FLAGS"; then
        load_opts $command
      else
        # disable usage of opts file
        if test "x$DUNE_OPTS_FILE" != "x"; then
          echo "WARNING: commandline parameters will overwrite setting in opts file \"$DUNE_OPTS_FILE\""
        fi 
      fi
    
      # skip command delimiter
      if test "$1" = ":"; then shift; fi
    
    
      case "$command" in
        print)
          create_module_list
          eval "print_module_list ' ' $MODULES"
          echo >&2
          ;;
        export)
          create_module_list
          DUNE_CONTROL_PATH=""
          for mod in $MODULES; do
            if test x != x$DUNE_CONTROL_PATH; then
              export DUNE_CONTROL_PATH="$DUNE_CONTROL_PATH:$(eval echo \$PATH_$mod/dune.module)"
            else
              export DUNE_CONTROL_PATH="$(eval echo \$PATH_$mod/dune.module)"
            fi
          done
          echo export DUNE_CONTROL_PATH=$DUNE_CONTROL_PATH
          ;;
        m4create)
          find_modules_in_path
          mainmod=`echo $SEARCH_MODULES`
          fname="dependencies.m4"
          name=`eval echo \\${NAME_$mainmod}`
          version=`eval echo \\${VERS_$mainmod}`
          maintainer=`eval echo \\${MAIN_$mainmod}`
    
    Christian Engwer's avatar
    Christian Engwer committed
          # get dependencies
          eval deps=\$DEPS_$module
    
          #initially remove leading space
          deps=`echo "$deps" | sed 's/^ *//'`
    
    Christian Engwer's avatar
    Christian Engwer committed
          while test -n "$deps"; do
    
            #the end of the name is marked either by space, opening paren
            #or comma
            depname="${deps%%[ (,]*}"
            #remove the name and adjacent whitespace
            deps=`echo "$deps" | sed 's/^[^ (,]* *//'`
            #check whether there is a dependency version
            case "$deps" in
            '('*) deps="${deps#(}"
                  depver="${deps%%)*}"
                  deps="${deps#*)}"
                  ;;
            *)    depver=
                  ;;
            esac
            #remove any leading whitespace or commas for te next iteration
            deps=`echo "$deps" | sed 's/^[, ]*//'`
      
    
    Martin Nolte's avatar
    Martin Nolte committed
            requires="$requires $depname $depver "
    
    Christian Engwer's avatar
    Christian Engwer committed
          done
    
          # ensure a version number
          if test "x$version" = "x"; then version="0.0"; fi
          echo "writing $fname"
          echo "    for $name $version $maintainer"
    
    Christian Engwer's avatar
    Christian Engwer committed
          echo "        requires $requires"
    
    m4_define([DUNE_AC_INIT],[
      AC_INIT([$name], [$version], [$maintainer])
      AC_SUBST([DUNE_MOD_VERSION], [$version])
      AC_SUBST([DUNE_MOD_NAME], [$name])
      AC_SUBST([DUNE_MAINTAINER_NAME], [$maintainer])
    
      DUNE_PARSE_MODULE_VERSION([$name], [$version])
    
      # don't build shared libs per default, this is way better for debugging...
      m4_ifdef([LT_INIT],
    
        [LT_INIT([disable-shared])],
    
        [AC_DEFUN([LT_OUTPUT])])
      AC_DISABLE_SHARED
    
    Christian Engwer's avatar
    Christian Engwer committed
    
      REQUIRES="$requires"
      AC_SUBST(REQUIRES, [$REQUIRES])
    
    ])
    
    AC_DEFUN([DUNE_CHECK_MOD_DEPENDENCIES], [
      AC_REQUIRE([PKG_PROG_PKG_CONFIG])
    
      AC_REQUIRE([AC_PROG_CC])
      AC_REQUIRE([AC_PROG_CPP])
      AC_REQUIRE([AC_PROG_CXX])
      AC_REQUIRE([AC_PROG_CXXCPP])
      AC_REQUIRE([AC_PROG_LIBTOOL])
      m4_ifdef([AC_LIBTOOL_LANG_CXX_CONFIG],[AC_LIBTOOL_LANG_CXX_CONFIG])
    
          ### initialize AM_CONDITIONAL for suggestions that were not found
          for name in $(eval echo \$SUGS_$mainmod); do
            mod=$(fix_variable_name $name)
            MOD=`echo $mod | tr [:lower:] [:upper:]`
            if test "x$(eval echo \$HAVE_$mod)" = "x"; then
              cat >> $fname <<EOF
    
      ### add a conditional check for $name,
      # just in case the module is not available at autogen time
      AM_CONDITIONAL([HAVE_${MOD}], false)
    EOF
    
            fi
          done
          ### DEPENDENCIES
          if test "x$SEARCH_MODULES" != "x"; then
            MODULES=$SEARCH_MODULES
    
    Christian Engwer's avatar
    Christian Engwer committed
          fi
    
          sort_dependencies $MODULES
          for mod in $MODULES; do
            name=`eval echo \\$NAME_$mod`
            MOD=`echo $mod | tr [:lower:] [:upper:]`
            cat >> $fname <<EOF
    
      ### check dependency $name
      # invoke checks required by this module
      AC_REQUIRE([${MOD}_CHECKS])
      # invoke check for this module
      AC_REQUIRE([${MOD}_CHECK_MODULE])
      if test x\$with_$mod = xno; then
        AC_MSG_ERROR([could not find required module _dune_name])
      fi
    EOF
    
          done
          ### 
          sort_suggestions $mainmod
          for mod in $MODULES; do
            name=`eval echo \\$NAME_$mod`
            MOD=`echo $mod | tr [:lower:] [:upper:]`
            cat >> $fname <<EOF
    
      ### check suggestion $name
      # invoke checks required by this module
      AC_REQUIRE([${MOD}_CHECKS])
      # invoke check for this module
      AC_REQUIRE([${MOD}_CHECK_MODULE])
      if test x\$with_$mod = xno; then
        AC_MSG_WARN([could not find suggested module _dune_name])
      fi
    EOF
    
          done
          ###
          mod=$mainmod
          name=`eval echo \\$NAME_$mod`
          MOD=`echo $mod | tr [:lower:] [:upper:]`
          cat >> $fname <<EOF
    
      ### invoke checks for $name
      AC_REQUIRE([${MOD}_CHECKS])
    ])
    EOF
    
    Christian Engwer's avatar
    Christian Engwer committed
        ;;
    
        unexport)
          echo export DUNE_CONTROL_PATH=""
    
        *)
          if is_command $command; then
            create_module_list
            NAMES=""
            BUILDMODULES=""
            for mod in $MODULES; do
              if test "$(eval echo \$INST_$mod)" != "yes"; then
                NAMES="$NAMES$(eval echo \$NAME_$mod) "
                BUILDMODULES="$BUILDMODULES$mod "
              fi
            done
            echo "--- going to build $NAMES ---"
              build_modules "$command" $BUILDMODULES
            echo "--- done ---"
          else
            usage
            echo "ERROR: unknown command \"$command\""  >&2
            exit 1
          fi
        ;;
      esac
    done