1<!-- 2doc/src/sgml/ref/pg_config-ref.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="app-pgconfig"> 7 <indexterm zone="app-pgconfig"> 8 <primary>pg_config</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>pg_config</refentrytitle> 13 <manvolnum>1</manvolnum> 14 <refmiscinfo>Application</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>pg_config</refname> 19 <refpurpose>retrieve information about the installed version of <productname>PostgreSQL</productname></refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23 <cmdsynopsis> 24 <command>pg_config</command> 25 <arg rep="repeat"><replaceable>option</replaceable></arg> 26 </cmdsynopsis> 27 </refsynopsisdiv> 28 29 <refsect1> 30 <title>Description</title> 31 <para> 32 The <application>pg_config</application> utility prints configuration parameters 33 of the currently installed version of <productname>PostgreSQL</productname>. It is 34 intended, for example, to be used by software packages that want to interface 35 to <productname>PostgreSQL</productname> to facilitate finding the required header files 36 and libraries. 37 </para> 38 </refsect1> 39 40 41 <refsect1> 42 <title>Options</title> 43 44 <para> 45 To use <application>pg_config</application>, supply one or more of the following 46 options: 47 <variablelist> 48 <varlistentry> 49 <term><option>--bindir</option></term> 50 <listitem> 51 <para> 52 Print the location of user executables. Use this, for example, to find 53 the <command>psql</command> program. This is normally also the location 54 where the <filename>pg_config</filename> program resides. 55 </para> 56 </listitem> 57 </varlistentry> 58 59 <varlistentry> 60 <term><option>--docdir</option></term> 61 <listitem> 62 <para> 63 Print the location of documentation files. 64 </para> 65 </listitem> 66 </varlistentry> 67 68 <varlistentry> 69 <term><option>--htmldir</option></term> 70 <listitem> 71 <para> 72 Print the location of HTML documentation files. 73 </para> 74 </listitem> 75 </varlistentry> 76 77 <varlistentry> 78 <term><option>--includedir</option></term> 79 <listitem> 80 <para> 81 Print the location of C header files of the client interfaces. 82 </para> 83 </listitem> 84 </varlistentry> 85 86 <varlistentry> 87 <term><option>--pkgincludedir</option></term> 88 <listitem> 89 <para> 90 Print the location of other C header files. 91 </para> 92 </listitem> 93 </varlistentry> 94 95 <varlistentry> 96 <term><option>--includedir-server</option></term> 97 <listitem> 98 <para> 99 Print the location of C header files for server programming. 100 </para> 101 </listitem> 102 </varlistentry> 103 104 <varlistentry> 105 <term><option>--libdir</option></term> 106 <listitem> 107 <para> 108 Print the location of object code libraries. 109 </para> 110 </listitem> 111 </varlistentry> 112 113 <varlistentry> 114 <term><option>--pkglibdir</option></term> 115 <listitem> 116 <para> 117 Print the location of dynamically loadable modules, or where 118 the server would search for them. (Other 119 architecture-dependent data files might also be installed in this 120 directory.) 121 </para> 122 </listitem> 123 </varlistentry> 124 125 <varlistentry> 126 <term><option>--localedir</option></term> 127 <listitem> 128 <para> 129 Print the location of locale support files. (This will be an empty 130 string if locale support was not configured when 131 <productname>PostgreSQL</productname> was built.) 132 </para> 133 </listitem> 134 </varlistentry> 135 136 <varlistentry> 137 <term><option>--mandir</option></term> 138 <listitem> 139 <para> 140 Print the location of manual pages. 141 </para> 142 </listitem> 143 </varlistentry> 144 145 <varlistentry> 146 <term><option>--sharedir</option></term> 147 <listitem> 148 <para> 149 Print the location of architecture-independent support files. 150 </para> 151 </listitem> 152 </varlistentry> 153 154 <varlistentry> 155 <term><option>--sysconfdir</option></term> 156 <listitem> 157 <para> 158 Print the location of system-wide configuration files. 159 </para> 160 </listitem> 161 </varlistentry> 162 163 <varlistentry> 164 <term><option>--pgxs</option></term> 165 <listitem> 166 <para> 167 Print the location of extension makefiles. 168 </para> 169 </listitem> 170 </varlistentry> 171 172 <varlistentry> 173 <term><option>--configure</option></term> 174 <listitem> 175 <para> 176 Print the options that were given to the <filename>configure</filename> 177 script when <productname>PostgreSQL</productname> was configured for building. 178 This can be used to reproduce the identical configuration, or 179 to find out with what options a binary package was built. (Note 180 however that binary packages often contain vendor-specific custom 181 patches.) See also the examples below. 182 </para> 183 </listitem> 184 </varlistentry> 185 186 <varlistentry> 187 <term><option>--cc</option></term> 188 <listitem> 189 <para> 190 Print the value of the <varname>CC</varname> variable that was used for building 191 <productname>PostgreSQL</productname>. This shows the C compiler used. 192 </para> 193 </listitem> 194 </varlistentry> 195 196 <varlistentry> 197 <term><option>--cppflags</option></term> 198 <listitem> 199 <para> 200 Print the value of the <varname>CPPFLAGS</varname> variable that was used for building 201 <productname>PostgreSQL</productname>. This shows C compiler switches needed 202 at preprocessing time (typically, <literal>-I</literal> switches). 203 </para> 204 </listitem> 205 </varlistentry> 206 207 <varlistentry> 208 <term><option>--cflags</option></term> 209 <listitem> 210 <para> 211 Print the value of the <varname>CFLAGS</varname> variable that was used for building 212 <productname>PostgreSQL</productname>. This shows C compiler switches. 213 </para> 214 </listitem> 215 </varlistentry> 216 217 <varlistentry> 218 <term><option>--cflags_sl</option></term> 219 <listitem> 220 <para> 221 Print the value of the <varname>CFLAGS_SL</varname> variable that was used for building 222 <productname>PostgreSQL</productname>. This shows extra C compiler switches 223 used for building shared libraries. 224 </para> 225 </listitem> 226 </varlistentry> 227 228 <varlistentry> 229 <term><option>--ldflags</option></term> 230 <listitem> 231 <para> 232 Print the value of the <varname>LDFLAGS</varname> variable that was used for building 233 <productname>PostgreSQL</productname>. This shows linker switches. 234 </para> 235 </listitem> 236 </varlistentry> 237 238 <varlistentry> 239 <term><option>--ldflags_ex</option></term> 240 <listitem> 241 <para> 242 Print the value of the <varname>LDFLAGS_EX</varname> variable that was used for building 243 <productname>PostgreSQL</productname>. This shows linker switches 244 used for building executables only. 245 </para> 246 </listitem> 247 </varlistentry> 248 249 <varlistentry> 250 <term><option>--ldflags_sl</option></term> 251 <listitem> 252 <para> 253 Print the value of the <varname>LDFLAGS_SL</varname> variable that was used for building 254 <productname>PostgreSQL</productname>. This shows linker switches 255 used for building shared libraries only. 256 </para> 257 </listitem> 258 </varlistentry> 259 260 <varlistentry> 261 <term><option>--libs</option></term> 262 <listitem> 263 <para> 264 Print the value of the <varname>LIBS</varname> variable that was used for building 265 <productname>PostgreSQL</productname>. This normally contains <literal>-l</literal> 266 switches for external libraries linked into <productname>PostgreSQL</productname>. 267 </para> 268 </listitem> 269 </varlistentry> 270 271 <varlistentry> 272 <term><option>--version</option></term> 273 <listitem> 274 <para> 275 Print the version of <productname>PostgreSQL</productname>. 276 </para> 277 </listitem> 278 </varlistentry> 279 280 <varlistentry> 281 <term><option>-?</option></term> 282 <term><option>--help</option></term> 283 <listitem> 284 <para> 285 Show help about <application>pg_config</application> command line 286 arguments, and exit. 287 </para> 288 </listitem> 289 </varlistentry> 290 </variablelist> 291 292 If more than one option is given, the information is printed in that order, 293 one item per line. If no options are given, all available information 294 is printed, with labels. 295 </para> 296 </refsect1> 297 298 299 <refsect1> 300 <title>Notes</title> 301 302 <para> 303 The options <option>--docdir</option>, <option>--pkgincludedir</option>, 304 <option>--localedir</option>, <option>--mandir</option>, 305 <option>--sharedir</option>, <option>--sysconfdir</option>, 306 <option>--cc</option>, <option>--cppflags</option>, 307 <option>--cflags</option>, <option>--cflags_sl</option>, 308 <option>--ldflags</option>, <option>--ldflags_sl</option>, 309 and <option>--libs</option> were added in <productname>PostgreSQL</productname> 8.1. 310 The option <option>--htmldir</option> was added in <productname>PostgreSQL</productname> 8.4. 311 The option <option>--ldflags_ex</option> was added in <productname>PostgreSQL</productname> 9.0. 312 </para> 313 </refsect1> 314 315 316 <refsect1> 317 <title>Example</title> 318 319 <para> 320 To reproduce the build configuration of the current PostgreSQL 321 installation, run the following command: 322<programlisting> 323eval ./configure `pg_config --configure` 324</programlisting> 325 The output of <literal>pg_config --configure</literal> contains 326 shell quotation marks so arguments with spaces are represented 327 correctly. Therefore, using <literal>eval</literal> is required 328 for proper results. 329 </para> 330 </refsect1> 331 332</refentry> 333