1PG_CONFIG(1) PostgreSQL 15.4 Documentation PG_CONFIG(1)
2
3
4
6 pg_config - retrieve information about the installed version of
7 PostgreSQL
8
10 pg_config [option...]
11
13 The pg_config utility prints configuration parameters of the currently
14 installed version of PostgreSQL. It is intended, for example, to be
15 used by software packages that want to interface to PostgreSQL to
16 facilitate finding the required header files and libraries.
17
19 To use pg_config, supply one or more of the following options:
20
21 --bindir
22 Print the location of user executables. Use this, for example, to
23 find the psql program. This is normally also the location where the
24 pg_config program resides.
25
26 --docdir
27 Print the location of documentation files.
28
29 --htmldir
30 Print the location of HTML documentation files.
31
32 --includedir
33 Print the location of C header files of the client interfaces.
34
35 --pkgincludedir
36 Print the location of other C header files.
37
38 --includedir-server
39 Print the location of C header files for server programming.
40
41 --libdir
42 Print the location of object code libraries.
43
44 --pkglibdir
45 Print the location of dynamically loadable modules, or where the
46 server would search for them. (Other architecture-dependent data
47 files might also be installed in this directory.)
48
49 --localedir
50 Print the location of locale support files. (This will be an empty
51 string if locale support was not configured when PostgreSQL was
52 built.)
53
54 --mandir
55 Print the location of manual pages.
56
57 --sharedir
58 Print the location of architecture-independent support files.
59
60 --sysconfdir
61 Print the location of system-wide configuration files.
62
63 --pgxs
64 Print the location of extension makefiles.
65
66 --configure
67 Print the options that were given to the configure script when
68 PostgreSQL was configured for building. This can be used to
69 reproduce the identical configuration, or to find out with what
70 options a binary package was built. (Note however that binary
71 packages often contain vendor-specific custom patches.) See also
72 the examples below.
73
74 --cc
75 Print the value of the CC variable that was used for building
76 PostgreSQL. This shows the C compiler used.
77
78 --cppflags
79 Print the value of the CPPFLAGS variable that was used for building
80 PostgreSQL. This shows C compiler switches needed at preprocessing
81 time (typically, -I switches).
82
83 --cflags
84 Print the value of the CFLAGS variable that was used for building
85 PostgreSQL. This shows C compiler switches.
86
87 --cflags_sl
88 Print the value of the CFLAGS_SL variable that was used for
89 building PostgreSQL. This shows extra C compiler switches used for
90 building shared libraries.
91
92 --ldflags
93 Print the value of the LDFLAGS variable that was used for building
94 PostgreSQL. This shows linker switches.
95
96 --ldflags_ex
97 Print the value of the LDFLAGS_EX variable that was used for
98 building PostgreSQL. This shows linker switches used for building
99 executables only.
100
101 --ldflags_sl
102 Print the value of the LDFLAGS_SL variable that was used for
103 building PostgreSQL. This shows linker switches used for building
104 shared libraries only.
105
106 --libs
107 Print the value of the LIBS variable that was used for building
108 PostgreSQL. This normally contains -l switches for external
109 libraries linked into PostgreSQL.
110
111 --version
112 Print the version of PostgreSQL.
113
114 -?
115 --help
116 Show help about pg_config command line arguments, and exit.
117 If more than one option is given, the information is printed in that
118 order, one item per line. If no options are given, all available
119 information is printed, with labels.
120
122 The options --docdir, --pkgincludedir, --localedir, --mandir,
123 --sharedir, --sysconfdir, --cc, --cppflags, --cflags, --cflags_sl,
124 --ldflags, --ldflags_sl, and --libs were added in PostgreSQL 8.1. The
125 option --htmldir was added in PostgreSQL 8.4. The option --ldflags_ex
126 was added in PostgreSQL 9.0.
127
129 To reproduce the build configuration of the current PostgreSQL
130 installation, run the following command:
131
132 eval ./configure `pg_config --configure`
133
134 The output of pg_config --configure contains shell quotation marks so
135 arguments with spaces are represented correctly. Therefore, using eval
136 is required for proper results.
137
138
139
140PostgreSQL 15.4 2023 PG_CONFIG(1)