1
<!-- doc/src/sgml/ref/pg_config-ref.sgml -->
3
<refentry id="app-pgconfig">
5
<refentrytitle>pg_config</refentrytitle>
6
<manvolnum>1</manvolnum>
7
<refmiscinfo>Application</refmiscinfo>
11
<refname>pg_config</refname>
12
<refpurpose>retrieve information about the installed version of <productname>PostgreSQL</></refpurpose>
15
<indexterm zone="app-pgconfig">
16
<primary>pg_config</primary>
21
<command>pg_config</command>
22
<arg rep="repeat"><replaceable>option</replaceable></arg>
29
The <application>pg_config</> utility prints configuration parameters
30
of the currently installed version of <productname>PostgreSQL</>. It is
31
intended, for example, to be used by software packages that want to interface
32
to <productname>PostgreSQL</> to facilitate finding the required header files
39
<title>Options</title>
42
To use <application>pg_config</>, supply one or more of the following
46
<term><option>--bindir</option></>
49
Print the location of user executables. Use this, for example, to find
50
the <command>psql</> program. This is normally also the location
51
where the <filename>pg_config</> program resides.
57
<term><option>--docdir</option></>
60
Print the location of documentation files.
66
<term><option>--htmldir</option></>
69
Print the location of HTML documentation files.
75
<term><option>--includedir</option></>
78
Print the location of C header files of the client interfaces.
84
<term><option>--pkgincludedir</option></>
87
Print the location of other C header files.
93
<term><option>--includedir-server</option></>
96
Print the location of C header files for server programming.
102
<term><option>--libdir</option></>
105
Print the location of object code libraries.
111
<term><option>--pkglibdir</option></>
114
Print the location of dynamically loadable modules, or where
115
the server would search for them. (Other
116
architecture-dependent data files might also be installed in this
123
<term><option>--localedir</option></>
126
Print the location of locale support files. (This will be an empty
127
string if locale support was not configured when
128
<productname>PostgreSQL</> was built.)
134
<term><option>--mandir</option></>
137
Print the location of manual pages.
143
<term><option>--sharedir</option></>
146
Print the location of architecture-independent support files.
152
<term><option>--sysconfdir</option></>
155
Print the location of system-wide configuration files.
161
<term><option>--pgxs</option></>
164
Print the location of extension makefiles.
170
<term><option>--configure</option></>
173
Print the options that were given to the <filename>configure</>
174
script when <productname>PostgreSQL</> was configured for building.
175
This can be used to reproduce the identical configuration, or
176
to find out with what options a binary package was built. (Note
177
however that binary packages often contain vendor-specific custom
178
patches.) See also the examples below.
184
<term><option>--cc</option></>
187
Print the value of the <varname>CC</varname> variable that was used for building
188
<productname>PostgreSQL</>. This shows the C compiler used.
194
<term><option>--cppflags</option></>
197
Print the value of the <varname>CPPFLAGS</varname> variable that was used for building
198
<productname>PostgreSQL</>. This shows C compiler switches needed
199
at preprocessing time (typically, <literal>-I</> switches).
205
<term><option>--cflags</option></>
208
Print the value of the <varname>CFLAGS</varname> variable that was used for building
209
<productname>PostgreSQL</>. This shows C compiler switches.
215
<term><option>--cflags_sl</option></>
218
Print the value of the <varname>CFLAGS_SL</varname> variable that was used for building
219
<productname>PostgreSQL</>. This shows extra C compiler switches
220
used for building shared libraries.
226
<term><option>--ldflags</option></>
229
Print the value of the <varname>LDFLAGS</varname> variable that was used for building
230
<productname>PostgreSQL</>. This shows linker switches.
236
<term><option>--ldflags_ex</option></>
239
Print the value of the <varname>LDFLAGS_EX</varname> variable that was used for building
240
<productname>PostgreSQL</>. This shows linker switches
241
used for building executables only.
247
<term><option>--ldflags_sl</option></>
250
Print the value of the <varname>LDFLAGS_SL</varname> variable that was used for building
251
<productname>PostgreSQL</>. This shows linker switches
252
used for building shared libraries only.
258
<term><option>--libs</option></>
261
Print the value of the <varname>LIBS</varname> variable that was used for building
262
<productname>PostgreSQL</>. This normally contains <literal>-l</>
263
switches for external libraries linked into <productname>PostgreSQL</>.
269
<term><option>--version</option></>
272
Print the version of <productname>PostgreSQL</>.
278
If more than one option is given, the information is printed in that order,
279
one item per line. If no options are given, all available information
280
is printed, with labels.
289
The option <option>--includedir-server</option> was added in
290
<productname>PostgreSQL</> 7.2. In prior releases, the server include files were
291
installed in the same location as the client headers, which could
292
be queried with the option <option>--includedir</option>. To make your
293
package handle both cases, try the newer option first and test the
294
exit status to see whether it succeeded.
298
The options <option>--docdir</option>, <option>--pkgincludedir</option>,
299
<option>--localedir</option>, <option>--mandir</option>,
300
<option>--sharedir</option>, <option>--sysconfdir</option>,
301
<option>--cc</option>, <option>--cppflags</option>,
302
<option>--cflags</option>, <option>--cflags_sl</option>,
303
<option>--ldflags</option>, <option>--ldflags_sl</option>,
304
and <option>--libs</option> were added in <productname>PostgreSQL</> 8.1.
305
The option <option>--htmldir</option> was added in <productname>PostgreSQL</> 8.4.
306
The option <option>--ldflags_ex</option> was added in <productname>PostgreSQL</> 9.0.
310
In releases prior to <productname>PostgreSQL</> 7.1, before
311
<command>pg_config</command> came to be, a method for finding the
312
equivalent configuration information did not exist.
318
<title>Example</title>
321
To reproduce the build configuration of the current PostgreSQL
322
installation, run the following command:
324
eval ./configure `pg_config --configure`
326
The output of <literal>pg_config --configure</literal> contains
327
shell quotation marks so arguments with spaces are represented
328
correctly. Therefore, using <literal>eval</literal> is required