]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/pg_config-ref.sgml
Create a "sort support" interface API for faster sorting.
[postgresql] / doc / src / sgml / ref / pg_config-ref.sgml
1 <!-- doc/src/sgml/ref/pg_config-ref.sgml -->
2
3 <refentry id="app-pgconfig">
4  <refmeta>
5   <refentrytitle>pg_config</refentrytitle>
6   <manvolnum>1</manvolnum>
7   <refmiscinfo>Application</refmiscinfo>
8  </refmeta>
9
10  <refnamediv>
11   <refname>pg_config</refname>
12   <refpurpose>retrieve information about the installed version of <productname>PostgreSQL</></refpurpose>
13  </refnamediv>
14
15  <indexterm zone="app-pgconfig">
16   <primary>pg_config</primary>
17  </indexterm>
18
19  <refsynopsisdiv>
20   <cmdsynopsis>
21    <command>pg_config</command>
22    <arg rep="repeat"><replaceable>option</replaceable></arg>
23   </cmdsynopsis>
24  </refsynopsisdiv>
25
26  <refsect1>
27   <title>Description</>
28   <para>
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
33    and libraries.
34   </para>
35  </refsect1>
36
37
38  <refsect1>
39   <title>Options</title>
40
41   <para>
42    To use <application>pg_config</>, supply one or more of the following
43    options:
44    <variablelist>
45     <varlistentry>
46      <term><option>--bindir</option></>
47      <listitem>
48       <para>
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.
52       </para>
53      </listitem>
54     </varlistentry>
55
56     <varlistentry>
57      <term><option>--docdir</option></>
58      <listitem>
59       <para>
60        Print the location of documentation files.
61       </para>
62      </listitem>
63     </varlistentry>
64
65     <varlistentry>
66      <term><option>--htmldir</option></>
67      <listitem>
68       <para>
69        Print the location of HTML documentation files.
70       </para>
71      </listitem>
72     </varlistentry>
73
74     <varlistentry>
75      <term><option>--includedir</option></>
76      <listitem>
77       <para>
78        Print the location of C header files of the client interfaces.
79       </para>
80      </listitem>
81     </varlistentry>
82
83     <varlistentry>
84      <term><option>--pkgincludedir</option></>
85      <listitem>
86       <para>
87        Print the location of other C header files.
88       </para>
89      </listitem>
90     </varlistentry>
91
92     <varlistentry>
93      <term><option>--includedir-server</option></>
94      <listitem>
95       <para>
96        Print the location of C header files for server programming.
97       </para>
98      </listitem>
99     </varlistentry>
100
101     <varlistentry>
102      <term><option>--libdir</option></>
103      <listitem>
104       <para>
105        Print the location of object code libraries.
106       </para>
107      </listitem>
108     </varlistentry>
109
110     <varlistentry>
111      <term><option>--pkglibdir</option></>
112      <listitem>
113       <para>
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
117        directory.)
118       </para>
119      </listitem>
120     </varlistentry>
121
122     <varlistentry>
123      <term><option>--localedir</option></>
124      <listitem>
125       <para>
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.)
129       </para>
130      </listitem>
131     </varlistentry>
132
133     <varlistentry>
134      <term><option>--mandir</option></>
135      <listitem>
136       <para>
137        Print the location of manual pages.
138       </para>
139      </listitem>
140     </varlistentry>
141
142     <varlistentry>
143      <term><option>--sharedir</option></>
144      <listitem>
145       <para>
146        Print the location of architecture-independent support files.
147       </para>
148      </listitem>
149     </varlistentry>
150
151     <varlistentry>
152      <term><option>--sysconfdir</option></>
153      <listitem>
154       <para>
155        Print the location of system-wide configuration files.
156       </para>
157      </listitem>
158     </varlistentry>
159
160     <varlistentry>
161      <term><option>--pgxs</option></>
162      <listitem>
163       <para>
164        Print the location of extension makefiles.
165      </para>
166      </listitem>
167     </varlistentry>
168
169     <varlistentry>
170      <term><option>--configure</option></>
171      <listitem>
172       <para>
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.
179       </para>
180      </listitem>
181     </varlistentry>
182
183     <varlistentry>
184      <term><option>--cc</option></>
185      <listitem>
186       <para>
187        Print the value of the <varname>CC</varname> variable that was used for building
188        <productname>PostgreSQL</>.  This shows the C compiler used.
189       </para>
190      </listitem>
191     </varlistentry>
192
193     <varlistentry>
194      <term><option>--cppflags</option></>
195      <listitem>
196       <para>
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).
200       </para>
201      </listitem>
202     </varlistentry>
203
204     <varlistentry>
205      <term><option>--cflags</option></>
206      <listitem>
207       <para>
208        Print the value of the <varname>CFLAGS</varname> variable that was used for building
209        <productname>PostgreSQL</>.  This shows C compiler switches.
210       </para>
211      </listitem>
212     </varlistentry>
213
214     <varlistentry>
215      <term><option>--cflags_sl</option></>
216      <listitem>
217       <para>
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.
221       </para>
222      </listitem>
223     </varlistentry>
224
225     <varlistentry>
226      <term><option>--ldflags</option></>
227      <listitem>
228       <para>
229        Print the value of the <varname>LDFLAGS</varname> variable that was used for building
230        <productname>PostgreSQL</>.  This shows linker switches.
231       </para>
232      </listitem>
233     </varlistentry>
234
235     <varlistentry>
236      <term><option>--ldflags_ex</option></>
237      <listitem>
238       <para>
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.
242       </para>
243      </listitem>
244     </varlistentry>
245
246     <varlistentry>
247      <term><option>--ldflags_sl</option></>
248      <listitem>
249       <para>
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.
253       </para>
254      </listitem>
255     </varlistentry>
256
257     <varlistentry>
258      <term><option>--libs</option></>
259      <listitem>
260       <para>
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</>.
264       </para>
265      </listitem>
266     </varlistentry>
267
268     <varlistentry>
269      <term><option>--version</option></>
270      <listitem>
271       <para>
272        Print the version of <productname>PostgreSQL</>.
273       </para>
274      </listitem>
275     </varlistentry>
276    </variablelist>
277
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.
281   </para>
282  </refsect1>
283
284
285  <refsect1>
286   <title>Notes</title>
287
288   <para>
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.
295   </para>
296
297   <para>
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.
307   </para>
308
309   <para>
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.
313   </para>
314  </refsect1>
315
316
317  <refsect1>
318   <title>Example</title>
319
320   <para>
321    To reproduce the build configuration of the current PostgreSQL
322    installation, run the following command:
323 <programlisting>
324 eval ./configure `pg_config --configure`
325 </programlisting>
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
329    for proper results.
330   </para>
331  </refsect1>
332
333 </refentry>