Opened 7 years ago

Closed 7 years ago

#156 closed defect (fixed)

autoconf: Make options with spaces supported in LDFLAGS etc.

Reported by: dmik Owned by:
Priority: major Milestone:
Component: automake/autoconf Version:
Severity: medium Keywords:
Cc:

Description (last modified by dmik)

autoconf has a problem that prevents from using options with spaces in LDFLAGS and other similar variables (e.g. a typical "-Zlinker 'DISABLE 1121' to kill the infamous and highly annoying "symbol is already exported" WLINK warning). This problem is illustrated by the following code:

#!/bin/sh

ac_link='python.exe -c "import sys; print sys.argv" $LDFLAGS'
LDFLAGS="-lcx -Zlinker 'DISABLE 1121'"

eval "$ac_link"

You will get this output:

['-c', '-lcx', '-Zlinker', "'DISABLE", "1121'"]

Where you can clearly see that the value for the -Zlinker option was split instead of being passed as a whole. In case of a compiler, this makes it think that 1121" is a file and fail with "file not found" error.

Note that the problem only shows up in autoconf when LDFLAGS appears in eval and such. And this happens in many places, e.g. in AC_CHECK_LIB functions which simply start always failing in such a case.

Change History (2)

comment:1 Changed 7 years ago by dmik

Description: modified (diff)

A solution to this problem is the second expansion, something like this:

ac_link='eval python.exe -c \"import sys\; print sys.argv\" $LDFLAGS'
LDFLAGS="-lcx -Zlinker 'DISABLE 1121'"

eval "$ac_link"

This script gives a correct result:

['-c', '-lcx', '-Zlinker', 'DISABLE 1121']

Now it's necessary to built it into autoconf making sure we don't break anything.

comment:2 Changed 7 years ago by dmik

Resolution: fixed
Status: newclosed

Fixed this in r2192. Will release a new RPM soon to exp for testing. If something goes wrong, I will reopen this ticket.

Note: See TracTickets for help on using tickets.