pg_config
Description
Thepg_config utility prints configuration parameters of the currently installed version ofPostgreSQL. It is intended, for example, to be used by software packages that want to interface toPostgreSQL to facilitate finding the required header files and libraries.
Options
To usepg_config, supply one or more of the following options:
- --bindir
Print the location of user executables. Use this, for example, to find thepsql program. This is normally also the location where thepg_config program resides.
- --docdir
Print the location of documentation files.
- --htmldir
Print the location of HTML documentation files.
- --includedir
Print the location of C header files of the client interfaces.
- --pkgincludedir
Print the location of other C header files.
- --includedir-server
Print the location of C header files for server programming.
- --libdir
Print the location of object code libraries.
- --pkglibdir
Print 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.)
- --localedir
Print the location of locale support files. (This will be an empty string if locale support was not configured whenPostgreSQL was built.)
- --mandir
Print the location of manual pages.
- --sharedir
Print the location of architecture-independent support files.
- --sysconfdir
Print the location of system-wide configuration files.
- --pgxs
Print the location of extension makefiles.
- --configure
Print the options that were given to theconfigure script whenPostgreSQL 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.
- --cc
Print the value of theCC variable that was used for buildingPostgreSQL. This shows the C compiler used.
- --cppflags
Print the value of theCPPFLAGS variable that was used for buildingPostgreSQL. This shows C compiler switches needed at preprocessing time (typically,-I switches).
- --cflags
Print the value of theCFLAGS variable that was used for buildingPostgreSQL. This shows C compiler switches.
- --cflags_sl
Print the value of theCFLAGS_SL variable that was used for buildingPostgreSQL. This shows extra C compiler switches used for building shared libraries.
- --ldflags
Print the value of theLDFLAGS variable that was used for buildingPostgreSQL. This shows linker switches.
- --ldflags_ex
Print the value of theLDFLAGS_EX variable that was used for buildingPostgreSQL. This shows linker switches used for building executables only.
- --ldflags_sl
Print the value of theLDFLAGS_SL variable that was used for buildingPostgreSQL. This shows linker switches used for building shared libraries only.
- --libs
Print the value of theLIBS variable that was used for buildingPostgreSQL. This normally contains-l switches for external libraries linked intoPostgreSQL.
- --version
Print the version ofPostgreSQL.
- -?
--help Show help aboutpg_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 inPostgreSQL 8.1. The option--htmldir was added inPostgreSQL 8.4. The option--ldflags_ex was added inPostgreSQL 9.0.
Example
To reproduce the build configuration of the current PostgreSQL installation, run the following command:
eval ./configure `pg_config --configure`
The output ofpg_config --configure contains shell quotation marks so arguments with spaces are represented correctly. Therefore, usingeval is required for proper results.