PostgreSQL源码安装时的./configure相关选项

Posted PostgreSQLChina

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PostgreSQL源码安装时的./configure相关选项相关的知识,希望对你有一定的参考价值。

作者:李明

从PostgreSQL源码运行./configure时,相关可用选项有:
[root@pg postgresql-13.4]# ./configure --help
`configure’ configures PostgreSQL 13.4 to adapt to many kinds of systems.

Usage: ./configure [OPTION]… [VAR=VALUE]…

To assign environment variables (e.g., CC, CFLAGS…), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
-h, --help display this help and exit
–help=short display options specific to this package
–help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for–cache-file=config.cache’
-n, --no-create do not create output files
–srcdir=DIR find the sources in DIR [configure dir or `…’]

Installation directories:
–prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/pgsql]
–exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]

By default, make install' will install all the files in/usr/local/pgsql/bin’, /usr/local/pgsql/lib' etc. You can specify an installation prefix other than/usr/local/pgsql’ using --prefix', for instance–prefix=$HOME’.

For better control, use the options below.

Fine tuning of the installation directories:
–bindir=DIR user executables [EPREFIX/bin]
–sbindir=DIR system admin executables [EPREFIX/sbin]
–libexecdir=DIR program executables [EPREFIX/libexec]
–sysconfdir=DIR read-only single-machine data [PREFIX/etc]
–sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
–localstatedir=DIR modifiable single-machine data [PREFIX/var]
–libdir=DIR object code libraries [EPREFIX/lib]
–includedir=DIR C header files [PREFIX/include]
–oldincludedir=DIR C header files for non-gcc [/usr/include]
–datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
–datadir=DIR read-only architecture-independent data [DATAROOTDIR]
–infodir=DIR info documentation [DATAROOTDIR/info]
–localedir=DIR locale-dependent data [DATAROOTDIR/locale]
–mandir=DIR man documentation [DATAROOTDIR/man]
–docdir=DIR documentation root [DATAROOTDIR/doc/postgresql]
htmldir=DIR html documentation [DOCDIR]
–dvidir=DIR dvi documentation [DOCDIR]
–pdfdir=DIR pdf documentation [DOCDIR]
–psdir=DIR ps documentation [DOCDIR]

System types:
–build=BUILD configure for building on BUILD [guessed]
–host=HOST cross-compile to build programs to run on HOST [BUILD]

Optional Features:
–disable-option-checking ignore unrecognized --enable/–with options
–disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
–enable-FEATURE[=ARG] include FEATURE [ARG=yes]
–disable-integer-datetimes
obsolete option, no longer supported
–enable-nls[=LANGUAGES]
enable Native Language Support
–disable-rpath do not embed shared library search path in
executables
–disable-spinlocks do not use spinlocks
–disable-atomics do not use atomic operations
–enable-debug build with debugging symbols (-g)
–enable-profiling build with profiling enabled
–enable-coverage build with coverage testing instrumentation
–enable-dtrace build with DTrace support
–enable-tap-tests enable TAP tests (requires Perl and IPC::Run)
–enable-depend turn on automatic dependency tracking
–enable-cassert enable assertion checks (for debugging)
–disable-thread-safety disable thread-safety in client libraries
–disable-largefile omit support for large files

Optional Packages:
–with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
–without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
–with-extra-version=STRING
append STRING to version
–with-template=NAME override operating system template
–with-includes=DIRS look for additional header files in DIRS
–with-libraries=DIRS look for additional libraries in DIRS
–with-libs=DIRS alternative spelling of --with-libraries
–with-pgport=PORTNUM set default port number [5432]
–with-blocksize=BLOCKSIZE
set table block size in kB [8]
–with-segsize=SEGSIZE set table segment size in GB [1]
–with-wal-blocksize=BLOCKSIZE
set WAL block size in kB [8]
–with-CC=CMD set compiler (deprecated)
–with-llvm build with LLVM based JIT support
–with-icu build with ICU support
–with-tcl build Tcl modules (PL/Tcl)
–with-tclconfig=DIR tclConfig.sh is in DIR
–with-perl build Perl modules (PL/Perl)
–with-python build Python modules (PL/Python)
–with-gssapi build with GSSAPI support
–with-krb-srvnam=NAME default service principal name in Kerberos (GSSAPI)
[postgres]
–with-pam build with PAM support
–with-bsd-auth build with BSD Authentication support
–with-ldap build with LDAP support
–with-bonjour build with Bonjour support
–with-openssl build with OpenSSL support
–with-selinux build with SELinux support
–with-systemd build with systemd support
–without-readline do not use GNU Readline nor BSD Libedit for editing
–with-libedit-preferred
prefer BSD Libedit over GNU Readline
–with-uuid=LIB build contrib/uuid-ossp using LIB (bsd,e2fs,ossp)
–with-ossp-uuid obsolete spelling of --with-uuid=ossp
–with-libxml build with XML support
–with-libxslt use XSLT support when building contrib/xml2
–with-system-tzdata=DIR
use system time zone data in DIR
–without-zlib do not use Zlib
–with-gnu-ld assume the C compiler uses GNU ld [default=no]

Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CXX C++ compiler command
CXXFLAGS C++ compiler flags
LLVM_CONFIG path to llvm-config command
CLANG path to clang compiler to generate bitcode
CPP C preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config’s search path
PKG_CONFIG_LIBDIR
path overriding pkg-config’s built-in search path
ICU_CFLAGS C compiler flags for ICU, overriding pkg-config
ICU_LIBS linker flags for ICU, overriding pkg-config
XML2_CONFIG path to xml2-config utility
XML2_CFLAGS C compiler flags for XML2, overriding pkg-config
XML2_LIBS linker flags for XML2, overriding pkg-config
LDFLAGS_EX extra linker flags for linking executables only
LDFLAGS_SL extra linker flags for linking shared libraries only
PERL Perl program
PYTHON Python program
MSGFMT msgfmt program for NLS
TCLSH Tcl interpreter program (tclsh)

Use these variables to override the choices made by `configure’ or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to .
PostgreSQL home page: .

部分选项解释如下:

安装路径相关选项

该选项控制make install命令安装文件路径。大部分情况下,均可使用–prefix选项。

–prefix=PREFIX
将所有文件放置到PREFIX指定的路径下(而非默认的/usr/local/pgsql)。

–exec-prefix=EXEC-PREFIX
将体系结构相关的文件放置到与PREFIX不同的路径下。

–bindir=DIRECTORY
可执行文件路径。默认为EXEC-PREFIX/bin,即默认为/usr/local/pgsql/bin。

–sysconfdir=DIRECTORY
配置文件路径。默认为PREFIX/etc。

–libdir=DIRECTORY
设置库及动态加载模块安装路径。默认为EXECPREFIX/lib

–includedir=DIRECTORY
C和C++头文件所在路径,默认为PREFIX/include。

–datarootdir=DIRECTORY
只读数据文件的根目录。默认为PREFIX/share

–localedir=DIRECTORY
本地数据,特别是信息翻译库文件的存放路径。默认为DATAROOTDIR/locale

–mandir=DIRECTORY
PostgreSQL的主页面所在路径。默认为DATAROOTDIR/man

–docdir=DIRECTORY
文档文件的路径。默认为DATAROOTDIR/doc/postgresql。

–htmldir=DIRECTORY
PostgreSQL的HTML格式文档的安装路径。默认为DATAROOTDIR。

PostgreSQL特性相关选项

本节介绍创建PostgreSQL非默认特性的选项。之所以这些特性为非默认的,是因为它们依赖于其他的软件。

–enable-nls[=LANGUAGES]
启用本地语言支持(NLS)。若不指定LANGUAGE,则会安装所有可用的语言。
需要Gettext API。

–with-perl
创建PL/Perl服务端语言。

–with-python
创建PL/Python服务端语言。

–with-tcl
创建PL/Tcl服务端语言。

–with-tclconfig=DIRECTORY
tcl配置文件tclConfig.sh所在路径。

–with-icu
支持ICU(International Component for Unicode)库。需要安装ICU4C包,版本至少为4.2。

–with-llvm
构建基于JIT的LLVM支持。需要安装LLVM库,最低版本为3.9。

–with-openssl
支持SSL(加密)连接。需要安装OpenSSL。

–with-gssapi
支持GSSAPI加密。

–with-ldap
支持LDAP认证及连接参数查看。unix下需要安装OpenLDAP包,windows下,需要安装WinLDAP包。

–with-pam
支持PAM(Pluggable Authentication Modules,可拔插认证模块)。

–with-bsd-auth
支持BSD认证。

–with-systemd
支持systemd服务提醒。需要安装libsystemd及其相关文件。

–with-bonjour
支持Bonjour自动服务发现。

–with-uuid=LIBRARY
创建使用指定UUID库的uuid-ossp模块(提供生成UUID的功能)。LIBRARY需为以下之一:

  • bsd
  • e2fs
  • ossp

–with-ossp-uuid
等同–with-uuid=ossp。

–with-libxml
支持SQL/XML。需要安装Libxml2 2.6.23及更新版本。

–with-libxslt
使用libxslt构建,启用xml2模块从而可以从xml到xsl的转换。必须同时指定–withlibxml

关闭PostgreSQL特性的选项

本节介绍关闭某些默认创建的PostgreSQL特性。如非必要,无需执行。

–without-readline
禁用readline。使得无法在命令行psql编辑和使用历史命令。

–with-libedit-preferred
使用BSD-licensed libedit库而非GPL-licensed ReadLine。默认使用ReadLine。

–without-zlib
不使用zlib库。

–disable-spinlocks
即使PostgreSQL不支持平台的CPU自旋锁,也可以构建成功。使用此选项,会导致很严重的数据库性能问题。

–disable-atomics
禁用CPU原子操作。可能导致数据库性能问题。

–disable-thread-safety
禁用客户端库的线程安全。 这样可以防止libpq和ECPG程序中的并发线程安全地控制其专用连接句柄。 仅在线程支持不足的平台上使用此功能。

构建过程详情选项

–with-includes=DIRECTORIES
DIRECTORIES为冒号分隔的列表,编译器从该路径中检索头文件。如果包装在了非默认路径,则需要指定该参数。
示例:–with-includes=/opt/gnu/include:/usr/sup/include

–with-libraries=DIRECTORIES
DIRECTORIES为冒号分隔的列表,内为库文件。
示例:–with-libraries=/opt/gnu/lib:/usr/sup/lib

–with-system-tzdata=DIRECTORY
使用外部的时区数据库。

–with-extra-version=STRING
添加STRING到PostgreSQL版本号上。

–disable-rpath
不要标记PostgreSQL的可执行文件以指示它们应该在安装的库目录中搜索共享库(请参见–libdir)。

其他选项

在构建时修改默认端口号–with-pgport。以下参数,限资深用户使用。

–with-pgport=NUMBER
为客户端及服务端设置默认端口号。默认为5432。

–with-krb-srvnam=NAME
GSSAPI使用的Kerberos默认名称。默认为postgres。在windows下,必须设置为POSTGRES。

–with-segsize=SEGSIZE
以GB为单位设置segment size。大表被分为segment size大小的多个文件。默认为1GB。不同segment size,不可使用pg_upgrade升级。

–with-blocksize=BLOCKSIZE
以KB为单位设置block size。此为表中存储及I/O的单位。默认为8kb。值必须为2的1到32次方(kb)。不同block size,不可使用pg_upgrade升级。

–with-wal-blocksize=BLOCKSIZE
以kb为单位,设置WAL block size。此为WAL日志中存储及I/O的单位。默认为8kb。值必须为2的1到64次方(kb)。不同wal block size,不可使用pg_upgrade升级。

开发者选项

本节介绍开发及调试PostgreSQL所使用的选项。除了–enable-debug外,其他选项不建议在生产环境使用。对于支持DTrace的操作系统,生产环境也可以启用–enable-dtrace选项。

若构建代码开发服务端,则建议至少启用选项–enable-debug和–enable-cassert。

–enable-debug
以调试模式编译程序及库。即可以在调试模式下运行程序以对问题进行分析。如果使用了GCC编译器,建议启用该选项。

–enable-cassert
在服务端启用断言检查。不建议在生产环境使用该选项。

–enable-tap-tests
启用使用Perl TAP工具进行测试。需要安装Perl及其模块IPC::Run。

–enable-depend
启用自动依赖跟踪。仅支持GCC。

–enable-coverage
如果使用GCC,则所有程序和库都将使用代码覆盖率测试工具进行编译。仅支持GCC。

–enable-profiling
如果使用GCC,则会编译所有程序和库,以便对其进行概要分析。仅支持GCC。

–enable-dtrace
支持动态跟踪工具DTrace。

以上是关于PostgreSQL源码安装时的./configure相关选项的主要内容,如果未能解决你的问题,请参考以下文章

Postgresql源码安装

源码编译安装PostgreSQL(pg12)

源码编译安装PostgreSQL(pg12)

centos环境源码安装postgresql9.4

源码安装PostgreSQL

Linux CentOS 7 安装PostgreSQL 9.5(源码编译)