- 2006-10-06
- pgsql
PostgreSQL で ./configure --help すると、
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
LDFLAGS_SL
DOCBOOKSTYLE
location of DocBook stylesheets
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
と出てくるわけだけど、全てが上手く動作するわけではないらしい。
src/template/win32 なんかは LDFLAGS を思いっきり上書きしちゃってるじゃないか。
$ cat src/template/win32
# This is required to link pg_dump because it finds pg_toupper() in
# libpq and pgport
LDFLAGS="-Wl,--allow-multiple-definition"
で、-L を追加したい場合は、LDFLAGS ではなく --with-libs=DIRS を、-I を追加したいときは CPPFLAGS ではなく --with-includes=DIRS を使った方が安全。
ちなみに src/template/* が CFLAGS を上書きしていたとしても、configure の中でうまいこと処理してくれているみたいなので問題無い。