Opened 6 years ago

Closed 6 years ago

#864 closed request (fixed)

change behaviour of yat-config so duplicated flag is kept

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.14
Component: build Version: 0.13
Keywords: Cc:

Description

yat-config has this somewhat unreadable code in the end

# only keep last of replicates
if test -n "$flags"; then
   reversed_flags=
   for opt in $flags; do
     reversed_flags="$opt $reversed_flags"
   done
   unique_flags=
   for opt in $reversed_flags; do
     unique=1;
     for opt2 in $unique_flags; do
       if test $opt = $opt2; then
         unique=0
       fi
     done
     if test $unique -eq 1; then
       unique_flags="$opt $unique_flags"
     fi
   done
   echo $unique_flags
fi

which, I suppose, was introduced in order to get rid of compilation lines such as

-I/opt/local -I/opt/local -I/opt/local

That is fine because calling -I/opt/local is equivalent, but that kind of trimming belongs in the configure script not in the yat-config script. But [as always] one should refrain from be uber-smart and instead trust the user knows what he is doing, as illustrated by use-case:

I set LDFLAGS via configure commandline with

./configure LDFLAGS="-Wl,-rpath /software/gsl/gsl-2.1/lib -Wl,-rpath /software/boost/boost-1.59.0/lib -L/software/htslib/htslib-1.3/lib -Wl,-rpath /software/htslib/htslib-1.3/lib"

and by design configure doesn't massage that but trust that the user knows what he doing. Unfortunately, yat-config is not equally generous but cuts out the first two instances of '-Wl,-rpath', i.e., the output becomes jibberish that the linker has no chance of understanding.

I could possibly solve with some tricky quoting, but it should not be needed; yat-config should not touch the values, so I suggest we remove this code in next minor version (v0.14).

Change History (2)

comment:1 Changed 6 years ago by Peter

Owner: changed from Jari Häkkinen to Peter
Status: newassigned

comment:2 Changed 6 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [3505]) closes #864; yat-config: do not filter out duplicated flags

Note: See TracTickets for help on using tickets.