summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/pg_config-ref.sgml
blob: 5aac38b3cec88879b5c8337f318cc4dfe6ae28d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<!-- doc/src/sgml/ref/pg_config-ref.sgml -->

<refentry id="app-pgconfig">
 <refmeta>
  <refentrytitle>pg_config</refentrytitle>
  <manvolnum>1</manvolnum>
  <refmiscinfo>Application</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>pg_config</refname>
  <refpurpose>retrieve information about the installed version of <productname>PostgreSQL</></refpurpose>
 </refnamediv>

 <indexterm zone="app-pgconfig">
  <primary>pg_config</primary>
 </indexterm>

 <refsynopsisdiv>
  <cmdsynopsis>
   <command>pg_config</command>
   <arg rep="repeat"><replaceable>option</replaceable></arg>
  </cmdsynopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</>
  <para>
   The <application>pg_config</> utility prints configuration parameters
   of the currently installed version of <productname>PostgreSQL</>. It is
   intended, for example, to be used by software packages that want to interface
   to <productname>PostgreSQL</> to facilitate finding the required header files
   and libraries.
  </para>
 </refsect1>


 <refsect1>
  <title>Options</title>

  <para>
   To use <application>pg_config</>, supply one or more of the following
   options:
   <variablelist>
    <varlistentry>
     <term><option>--bindir</option></>
     <listitem>
      <para>
       Print the location of user executables. Use this, for example, to find
       the <command>psql</> program. This is normally also the location
       where the <filename>pg_config</> program resides.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--docdir</option></>
     <listitem>
      <para>
       Print the location of documentation files.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--htmldir</option></>
     <listitem>
      <para>
       Print the location of HTML documentation files.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--includedir</option></>
     <listitem>
      <para>
       Print the location of C header files of the client interfaces.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--pkgincludedir</option></>
     <listitem>
      <para>
       Print the location of other C header files.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--includedir-server</option></>
     <listitem>
      <para>
       Print the location of C header files for server programming.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--libdir</option></>
     <listitem>
      <para>
       Print the location of object code libraries.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--pkglibdir</option></>
     <listitem>
      <para>
       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.)
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--localedir</option></>
     <listitem>
      <para>
       Print the location of locale support files.  (This will be an empty
       string if locale support was not configured when
       <productname>PostgreSQL</> was built.)
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--mandir</option></>
     <listitem>
      <para>
       Print the location of manual pages.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--sharedir</option></>
     <listitem>
      <para>
       Print the location of architecture-independent support files.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--sysconfdir</option></>
     <listitem>
      <para>
       Print the location of system-wide configuration files.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--pgxs</option></>
     <listitem>
      <para>
       Print the location of extension makefiles.
     </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--configure</option></>
     <listitem>
      <para>
       Print the options that were given to the <filename>configure</>
       script when <productname>PostgreSQL</> 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.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--cc</option></>
     <listitem>
      <para>
       Print the value of the <varname>CC</varname> variable that was used for building
       <productname>PostgreSQL</>.  This shows the C compiler used.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--cppflags</option></>
     <listitem>
      <para>
       Print the value of the <varname>CPPFLAGS</varname> variable that was used for building
       <productname>PostgreSQL</>.  This shows C compiler switches needed
       at preprocessing time (typically, <literal>-I</> switches).
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--cflags</option></>
     <listitem>
      <para>
       Print the value of the <varname>CFLAGS</varname> variable that was used for building
       <productname>PostgreSQL</>.  This shows C compiler switches.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--cflags_sl</option></>
     <listitem>
      <para>
       Print the value of the <varname>CFLAGS_SL</varname> variable that was used for building
       <productname>PostgreSQL</>.  This shows extra C compiler switches
       used for building shared libraries.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--ldflags</option></>
     <listitem>
      <para>
       Print the value of the <varname>LDFLAGS</varname> variable that was used for building
       <productname>PostgreSQL</>.  This shows linker switches.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--ldflags_ex</option></>
     <listitem>
      <para>
       Print the value of the <varname>LDFLAGS_EX</varname> variable that was used for building
       <productname>PostgreSQL</>.  This shows linker switches
       used for building executables only.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--ldflags_sl</option></>
     <listitem>
      <para>
       Print the value of the <varname>LDFLAGS_SL</varname> variable that was used for building
       <productname>PostgreSQL</>.  This shows linker switches
       used for building shared libraries only.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--libs</option></>
     <listitem>
      <para>
       Print the value of the <varname>LIBS</varname> variable that was used for building
       <productname>PostgreSQL</>.  This normally contains <literal>-l</>
       switches for external libraries linked into <productname>PostgreSQL</>.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--version</option></>
     <listitem>
      <para>
       Print the version of <productname>PostgreSQL</>.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>-?</></term>
     <term><option>--help</></term>
      <listitem>
       <para>
        Show help about <application>pg_config</application> command line
        arguments, and exit.
       </para>
      </listitem>
     </varlistentry>
   </variablelist>

   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.
  </para>
 </refsect1>


 <refsect1>
  <title>Notes</title>

  <para>
   The option <option>--includedir-server</option> was added in
   <productname>PostgreSQL</> 7.2.  In prior releases, the server include files were
   installed in the same location as the client headers, which could
   be queried with the option <option>--includedir</option>.  To make your
   package handle both cases, try the newer option first and test the
   exit status to see whether it succeeded.
  </para>

  <para>
   The options <option>--docdir</option>, <option>--pkgincludedir</option>,
   <option>--localedir</option>, <option>--mandir</option>,
   <option>--sharedir</option>, <option>--sysconfdir</option>,
   <option>--cc</option>, <option>--cppflags</option>,
   <option>--cflags</option>, <option>--cflags_sl</option>,
   <option>--ldflags</option>, <option>--ldflags_sl</option>,
   and <option>--libs</option> were added in <productname>PostgreSQL</> 8.1.
   The option <option>--htmldir</option> was added in <productname>PostgreSQL</> 8.4.
   The option <option>--ldflags_ex</option> was added in <productname>PostgreSQL</> 9.0.
  </para>

  <para>
   In releases prior to <productname>PostgreSQL</> 7.1, before
   <command>pg_config</command> came to be, a method for finding the
   equivalent configuration information did not exist.
  </para>
 </refsect1>


 <refsect1>
  <title>Example</title>

  <para>
   To reproduce the build configuration of the current PostgreSQL
   installation, run the following command:
<programlisting>
eval ./configure `pg_config --configure`
</programlisting>
   The output of <literal>pg_config --configure</literal> contains
   shell quotation marks so arguments with spaces are represented
   correctly.  Therefore, using <literal>eval</literal> is required
   for proper results.
  </para>
 </refsect1>

</refentry>