On Tue, Feb 11, 2014 at 08:09:35PM +0000, Jeff Squyres (jsquyres) wrote: > On Feb 8, 2014, at 4:49 PM, Adrian Reber <adr...@lisas.de> wrote: > > >> I note you have a stray $3 at the end of your configure.m4, too (it might > >> supposed to be $2?). > > > > I think I do not really understand configure.m4 and was happy to just > > copy it from blcr. Especially what $2 and $3 mean and how they are > > supposed to be used. I will try to simplify my configure.m4. Is there an > > example which I can have a look at? > > Sorry -- been a bit busy with releasing OMPI 1.7.4 and preparing for 1.7.5... > > m4 is a macro language, so think of it as templates with some intelligence. > > $1, $2, and $3 are the "parameters" passed in to the macro. So when you do > something like: > > AC_DEFUN([FOO], [ > echo 1 is $1 > echo 2 is $2]) > > and you invoke that macro via > > FOO([hello world], [goodbye world]) > > the generated script will contain: > > echo 1 is hello world > echo 2 is goodbye world > > In our case, $1 is the action to execute if the package is happy / wants to > build, and $2 is the action to execute if the package is unhappy / does not > want to build. > > Meaning: we have a top-level engine that is iterating over all frameworks and > components, and calling their *_CONFIG macros with appropriate $1 and $2 > values that expand to actions-to-execute-if-happy / > actions-to-execute-if-unhappy. > > Make sense?
Thanks. I also tried to understand the macros better and with the generated output and your description I think I understand it. Trying to simplify configure.m4 like you suggested I would change this: AS_IF([test "$check_crs_criu_good" != "yes"], [$2], [AS_IF([test ! -z "$with_criu" -a "$with_criu" != "yes"], [check_crs_criu_dir="$with_criu" check_crs_criu_dir_msg="$with_criu (from --with-criu)"]) AS_IF([test ! -z "$with_criu_libdir" -a "$with_criu_libdir" != "yes"], [check_crs_criu_libdir="$with_criu_libdir" check_crs_criu_libdir_msg="$with_criu_libdir (from --with-criu-libdir)"]) ]) to this: AS_IF([test "$check_crs_criu_good" = "yes" -a ! -z "$with_criu" -a "$with_criu" != "yes"], [check_crs_criu_dir="$with_criu" check_crs_criu_dir_msg="$with_criu (from --with-criu)"], [$2 check_crs_criu_good="no"]) AS_IF([test "$check_crs_criu_good" = "yes" -a ! -z "$with_criu_libdir" -a "$with_criu_libdir" != "yes"], [check_crs_criu_dir_libdir="$with_criu_libdir" check_crs_criu_dir_libdir_msg="$with_criu_libdir (from --with-criu)"], [$2 check_crs_criu_good="no"]) correct? With three checks in one line it seems bit unreadable and the nested AS_IF seems easier for me to understand. Did I understand it correctly what you meant or did you mean something else? Adrian