pg_config
pg_config — вывести информацию об установленной версии Postgres Pro
Синтаксис
pg_config [параметр...]
Описание
Утилита pg_config выводит параметры конфигурации текущей установленной версии Postgres Pro. Это помогает, например, найти заголовочные файлы и библиотеки, требующиеся программным средствам, которые хотят взаимодействовать с Postgres Pro.
Параметры
При использовании pg_config можно передать следующие параметры:
--bindirВывести расположение исполняемых файлов. Можно использовать, например, для поиска утилиты
psql. Обычно там же находится и сама утилитаpg_config.--docdirВывести расположение файлов документации.
--htmldirВывести расположение файлов документации в формате HTML.
--includedirВывести расположение заголовочных C-файлов клиентских интерфейсов.
--pkgincludedirВывести расположение других заголовочных C-файлов.
--includedir-serverВывести расположение заголовочных C-файлов для программирования серверной части.
--libdirВывести расположение библиотек объектного кода.
--pkglibdirВывести расположение динамически подгружаемых модулей, либо путь, где сервер должен их искать. По этому пути также могут размещаться и другие архитектурно-зависимые файлы.
--localedirВывести расположение файлов поддержки локалей. Если поддержка локалей не была сконфигурирована на этапе сборки Postgres Pro, будет выведена пустая строка.
--mandirВывести расположение страниц руководства man.
--sharedirВывести расположение архитектурно-независимых вспомогательных файлов.
--sysconfdirВывести расположение системных конфигурационных файлов.
--pgxsВывести расположение файлов сборки расширений.
--configureВывести список параметров
configure, использованных при сборке Postgres Pro. Это может пригодиться, чтобы при последующей сборке сделать идентичную конфигурацию. Или для того, чтобы найти с какими параметрами был собран используемый бинарный пакет. (Стоит отметить, что бинарные пакеты нередко содержат патчи, специфичные для дистрибутивов.) См. примеры ниже.--ccВывести использованное при сборке Postgres Pro значение переменной
CC. Оно отражает, какой C-компилятор применялся.--cppflagsВывести использованное при сборке Postgres Pro значение переменной
CPPFLAGS. Оно отражает флаги C-компилятора, применённые для препроцессора. Обычно это флаги-I.--cflagsВывести использованное при сборке Postgres Pro значение переменной
CFLAGS. Оно отражает флаги C-компилятора, применённые при сборке.--cflags_slВывести использованное при сборке Postgres Pro значение переменной
CFLAGS_SL. Оно отражает дополнительные флаги C-компилятора для сборки разделяемых библиотек.--ldflagsВывести использованное при сборке Postgres Pro значение переменной
LDFLAGS. Оно отражает флаги компоновщика.--ldflags_exВывести использованное при сборке Postgres Pro значение переменной
LDFLAGS_EX. Оно отражает флаги компоновщика, использованные при сборке лишь исполняемых файлов.--ldflags_slВывести использованное при сборке Postgres Pro значение переменной
LDFLAGS_SL. Оно отражает флаги компоновщика, использованные при сборке лишь разделяемых библиотек.--libsВывести использованное при сборке Postgres Pro значение переменной
LIBS. Обычно оно отражает флаги подключения внешних библиотек к Postgres Pro, переданные с ключом-l.--versionВывести версию PostgreSQL, на которой основан Postgres Pro.
--pgpro-versionВывести версию Postgres Pro.
--pgpro-editionВывести редакцию Postgres Pro.
-?--helpВывести справку по команде pg_config.
Если одновременно передано несколько параметров, то выводимая информация будет следовать согласно их порядку. Если параметры не переданы, то будет выведена вся информация с подписями, к чему она относится.
Замечания
Параметры --docdir, --pkgincludedir, --localedir, --mandir, --sharedir, --sysconfdir, --cc, --cppflags, --cflags, --cflags_sl, --ldflags, --ldflags_sl и --libs доступны, начиная с версии PostgreSQL 8.1. Параметр --htmldir добавлен в PostgreSQL 8.4. Параметр --ldflags_ex добавлен в PostgreSQL 9.0.
Пример
Чтобы воспроизвести конфигурацию сборки текущей инсталляции Postgres Pro, можно выполнить команду:
eval ./configure `pg_config --configure`
Вывод pg_config --configure содержит символы экранирования, поэтому значения аргументов, содержащие пробелы, представлены корректно. Таким образом, для получения корректного результата необходимо применить eval.
pg_config
pg_config — retrieve information about the installed version of Postgres Pro
Synopsis
pg_config [option...]
Description
The pg_config utility prints configuration parameters of the currently installed version of Postgres Pro. It is intended, for example, to be used by software packages that want to interface to Postgres Pro to facilitate finding the required header files and libraries.
Options
To use pg_config, supply one or more of the following options:
--bindirPrint the location of user executables. Use this, for example, to find the
psqlprogram. This is normally also the location where thepg_configprogram resides.--docdirPrint the location of documentation files.
--htmldirPrint the location of HTML documentation files.
--includedirPrint the location of C header files of the client interfaces.
--pkgincludedirPrint the location of other C header files.
--includedir-serverPrint the location of C header files for server programming.
--libdirPrint the location of object code libraries.
--pkglibdirPrint the location of dynamically loadable modules, or where the server would search for them. (Other architecture-dependent data files might also be installed in this directory.)
--localedirPrint the location of locale support files. (This will be an empty string if locale support was not configured when Postgres Pro was built.)
--mandirPrint the location of manual pages.
--sharedirPrint the location of architecture-independent support files.
--sysconfdirPrint the location of system-wide configuration files.
--pgxsPrint the location of extension makefiles.
--configurePrint the options that were given to the
configurescript when Postgres Pro was configured for building. This can be used to reproduce the identical configuration, or to find out with what options a binary package was built. (Note however that binary packages often contain vendor-specific custom patches.) See also the examples below.--ccPrint the value of the
CCvariable that was used for building Postgres Pro. This shows the C compiler used.--cppflagsPrint the value of the
CPPFLAGSvariable that was used for building Postgres Pro. This shows C compiler switches needed at preprocessing time (typically,-Iswitches).--cflagsPrint the value of the
CFLAGSvariable that was used for building Postgres Pro. This shows C compiler switches.--cflags_slPrint the value of the
CFLAGS_SLvariable that was used for building Postgres Pro. This shows extra C compiler switches used for building shared libraries.--ldflagsPrint the value of the
LDFLAGSvariable that was used for building Postgres Pro. This shows linker switches.--ldflags_exPrint the value of the
LDFLAGS_EXvariable that was used for building Postgres Pro. This shows linker switches used for building executables only.--ldflags_slPrint the value of the
LDFLAGS_SLvariable that was used for building Postgres Pro. This shows linker switches used for building shared libraries only.--libsPrint the value of the
LIBSvariable that was used for building Postgres Pro. This normally contains-lswitches for external libraries linked into Postgres Pro.--versionPrint the PostgreSQL version on which Postgres Pro is based.
--pgpro-versionPrint the version of Postgres Pro.
--pgpro-editionPrint the edition of Postgres Pro.
-?--helpShow help about pg_config command line arguments, and exit.
If more than one option is given, the information is printed in that order, one item per line. If no options are given, all available information is printed, with labels.
Notes
The options --docdir, --pkgincludedir, --localedir, --mandir, --sharedir, --sysconfdir, --cc, --cppflags, --cflags, --cflags_sl, --ldflags, --ldflags_sl, and --libs were added in PostgreSQL 8.1. The option --htmldir was added in PostgreSQL 8.4. The option --ldflags_ex was added in PostgreSQL 9.0.
Example
To reproduce the build configuration of the current Postgres Pro installation, run the following command:
eval ./configure `pg_config --configure`
The output of pg_config --configure contains shell quotation marks so arguments with spaces are represented correctly. Therefore, using eval is required for proper results.