Thank your for comments.
1) I'am using
GNU bash, version 3.00.15(1)-release (i686-redhat-linux-gnu)
To see the problem with the original
eval "set %{configure_options}"

I start the configure_options with -- in buildrpm.sh, like this:

configure_options="--with-tm=/usr/local FC=pgf90 F77=pgf90 CC=pgcc CXX=pgCC CFLAGS=-Msignextend CXXFLAGS=-Msignextend --with-wrapper-cflags=-Msignextend --with-wrapper-cxxflags=-Msignextend FFLAGS=-Msignextend FCFLAGS=-Msignextend --with-wrapper-fflags=-Msignextend --with-wrapper-fcflags=-Msignextend"

Or to see the problem directly, I go to the shell:
sh; set --w
sh: set: --: invalid option
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]

2)
if ("\$LD_LIBRARY_PATH" !~ *%{_libdir}*) then
is the only possibility which works for me.

I'am using
tcsh 6.13.00 (Astron) 2004-05-19 (i386-intel-linux) options 8b,nls,dl,al,kan,rh,color,dspm,filec

If I use "%{_libdir}", then every time I
source /opt/openmpi/1.2/bin/mpivars-1.2.csh
a new entry of opemnpi is prepended, so the LD_LIBRARY_PATH is growing.
The same if I use  
"*%{_libdir}*"
it seems that with the double quotes the shell despite the pattern comparison requested by !~ uses literal matching.

3) 

using

setenv MANPATH %{_mandir}:
(with the colon (:) included), if I start from empty MANPATH

unsetenv MANPATH

and run
source /opt/openmpi/1.2/bin/mpivars-1.2.csh
I get
echo $MANPATH

/opt/openmpi/1.2/man:

I tried to google for something like
also include the default MANPATH
but I cannot find anything. What is the meaning of this colon at the end?

Marcin

Jeff Squyres wrote:
On Apr 4, 2007, at 4:50 AM, Marcin Dulak wrote:

  
Thank you for the links.
I tried the  Revision 14205 of  openmpi.spec and it works for me  
only after some changes:
- in the mpivars-1.2.csh script part,
- and related to the line 330 in the original (14205) openmpi.spec:

eval "set %{configure_options}"

which will fail, if configure_options starts with --, in which case  
it will be interpreted as an option to set.
    

Hmm.  I did not have this problem.  What version of shell are you using?

I can apply this change because it's harmless, but I'm curious as to  
why I did not see the same problem.

See below for more comments.

  
--- openmpi.spec	2007-04-04 09:34:12.397722000 +0200
+++ openmpi-fixed.spec	2007-04-04 10:25:26.648442000 +0200
@@ -327,7 +327,8 @@

 if test "$using_gcc" = "1"; then
     # Do wretched things to find a CC=* token
-    eval "set %{configure_options}"
+    # Remove starting --*, as it is interpreted as an option to set
+    eval "set `echo %{configure_options} | sed 's/--*//'`"
    

See comment above.

  
     compiler=
     while test "$1" != "" -a "$compiler" = ""; do
          case "$1" in
@@ -449,7 +450,7 @@

 # LD_LIBRARY_PATH
 if ("1" == "\$?LD_LIBRARY_PATH") then
-    if ("\$LD_LIBRARY_PATH" =~ "'*%{_libdir}*'") then
+    if ("\$LD_LIBRARY_PATH" !~ *%{_libdir}*) then
         setenv LD_LIBRARY_PATH %{_libdir}:\${LD_LIBRARY_PATH}
     endif
 else
@@ -458,11 +459,11 @@

 # MANPATH
 if ("1" == "\$?MANPATH") then
-    if ("\$MANPATH" =~ '*%{_mandir}*'") then
+    if ("\$MANPATH" !~ *%{_mandir}*) then
    

Fixed the above 2 typos, although the *'s should also disappear and  
the double quotes should remain (the %{_mandir} one was actually  
broken).

  
         setenv MANPATH %{_mandir}:\${MANPATH}
     endif
 else
-    setenv MANPATH %{_mandir}:
+    setenv MANPATH %{_mandir}
    

The : at the end of the string is intentional.  Its presence means  
"also include the default MANPATH".