summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/install-procedure.html
blob: c6ca127bec2b75ba1e54e02814c9f557ba069faa (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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>17.4. Installation Procedure</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="install-getsource.html" title="17.3. Getting the Source" /><link rel="next" href="install-post.html" title="17.5. Post-Installation Setup" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">17.4. Installation Procedure</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="install-getsource.html" title="17.3. Getting the Source">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="installation.html" title="Chapter 17. Installation from Source Code">Up</a></td><th width="60%" align="center">Chapter 17. Installation from Source Code</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.6 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="install-post.html" title="17.5. Post-Installation Setup">Next</a></td></tr></table><hr /></div><div class="sect1" id="INSTALL-PROCEDURE"><div class="titlepage"><div><div><h2 class="title" style="clear: both">17.4. Installation Procedure</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="install-procedure.html#CONFIGURE-OPTIONS">17.4.1. <code class="filename">configure</code> Options</a></span></dt><dt><span class="sect2"><a href="install-procedure.html#CONFIGURE-ENVVARS">17.4.2. <code class="filename">configure</code> Environment Variables</a></span></dt></dl></div><div class="procedure"><ol class="procedure" type="1"><li class="step" id="CONFIGURE"><p class="title"><strong>Configuration</strong></p><a id="id-1.6.4.8.2.1.2" class="indexterm"></a><p>
    The first step of the installation procedure is to configure the
    source tree for your system and choose the options you would like.
    This is done by running the <code class="filename">configure</code> script. For a
    default installation simply enter:
</p><pre class="screen">
<strong class="userinput"><code>./configure</code></strong>
</pre><p>
    This script will run a number of tests to determine values for various
    system dependent variables and detect any quirks of your
    operating system, and finally will create several files in the
    build tree to record what it found.
   </p><p>
    You can also run <code class="filename">configure</code> in a directory outside
    the source tree, and then build there, if you want to keep the build
    directory separate from the original source files.  This procedure is
    called a
    <a id="id-1.6.4.8.2.1.4.2" class="indexterm"></a><em class="firstterm">VPATH</em>
    build.  Here's how:
</p><pre class="screen">
<strong class="userinput"><code>mkdir build_dir</code></strong>
<strong class="userinput"><code>cd build_dir</code></strong>
<strong class="userinput"><code>/path/to/source/tree/configure [options go here]</code></strong>
<strong class="userinput"><code>make</code></strong>
</pre><p>
   </p><p>
    The default configuration will build the server and utilities, as
    well as all client applications and interfaces that require only a
    C compiler. All files will be installed under
    <code class="filename">/usr/local/pgsql</code> by default.
   </p><p>
    You can customize the build and installation process by supplying one
    or more command line options to <code class="filename">configure</code>.
    Typically you would customize the install location, or the set of
    optional features that are built.  <code class="filename">configure</code>
    has a large number of options, which are described in
    <a class="xref" href="install-procedure.html#CONFIGURE-OPTIONS" title="17.4.1. configure Options">Section 17.4.1</a>.
   </p><p>
    Also, <code class="filename">configure</code> responds to certain environment
    variables, as described in <a class="xref" href="install-procedure.html#CONFIGURE-ENVVARS" title="17.4.2. configure Environment Variables">Section 17.4.2</a>.
    These provide additional ways to customize the configuration.
   </p></li><li class="step" id="BUILD"><p class="title"><strong>Build</strong></p><p>
    To start the build, type either of:
</p><pre class="screen">
<strong class="userinput"><code>make</code></strong>
<strong class="userinput"><code>make all</code></strong>
</pre><p>
    (Remember to use <acronym class="acronym">GNU</acronym> <span class="application">make</span>.)
    The build will take a few minutes depending on your
    hardware.
   </p><p>
   If you want to build everything that can be built, including the
   documentation (HTML and man pages), and the additional modules
   (<code class="filename">contrib</code>), type instead:
</p><pre class="screen">
<strong class="userinput"><code>make world</code></strong>
</pre><p>
  </p><p>
   If you want to build everything that can be built, including the
   additional modules (<code class="filename">contrib</code>), but without
   the documentation, type instead:
</p><pre class="screen">
<strong class="userinput"><code>make world-bin</code></strong>
</pre><p>
   </p><p>
    If you want to invoke the build from another makefile rather than
    manually, you must unset <code class="varname">MAKELEVEL</code> or set it to zero,
    for instance like this:
</p><pre class="programlisting">
build-postgresql:
        $(MAKE) -C postgresql MAKELEVEL=0 all
</pre><p>
    Failure to do that can lead to strange error messages, typically about
    missing header files.
   </p></li><li class="step"><p class="title"><strong>Regression Tests</strong></p><a id="id-1.6.4.8.2.3.2" class="indexterm"></a><p>
    If you want to test the newly built server before you install it,
    you can run the regression tests at this point. The regression
    tests are a test suite to verify that <span class="productname">PostgreSQL</span>
    runs on your machine in the way the developers expected it
    to. Type:
</p><pre class="screen">
<strong class="userinput"><code>make check</code></strong>
</pre><p>
    (This won't work as root; do it as an unprivileged user.)
    See <a class="xref" href="regress.html" title="Chapter 33. Regression Tests">Chapter 33</a> for
    detailed information about interpreting the test results. You can
    repeat this test at any later time by issuing the same command.
   </p></li><li class="step" id="INSTALL"><p class="title"><strong>Installing the Files</strong></p><div class="note"><h3 class="title">Note</h3><p>
     If you are upgrading an existing system be sure to read
     <a class="xref" href="upgrading.html" title="19.6. Upgrading a PostgreSQL Cluster">Section 19.6</a>,
     which has instructions about upgrading a
     cluster.
    </p></div><p>
    To install <span class="productname">PostgreSQL</span> enter:
</p><pre class="screen">
<strong class="userinput"><code>make install</code></strong>
</pre><p>
    This will install files into the directories that were specified
    in <a class="xref" href="install-procedure.html#CONFIGURE" title="Configuration">Step 1</a>. Make sure that you have appropriate
    permissions to write into that area. Normally you need to do this
    step as root. Alternatively, you can create the target
    directories in advance and arrange for appropriate permissions to
    be granted.
   </p><p>
    To install the documentation (HTML and man pages), enter:
</p><pre class="screen">
<strong class="userinput"><code>make install-docs</code></strong>
</pre><p>
   </p><p>
    If you built the world above, type instead:
</p><pre class="screen">
<strong class="userinput"><code>make install-world</code></strong>
</pre><p>
    This also installs the documentation.
   </p><p>
    If you built the world without the documentation above, type instead:
</p><pre class="screen">
<strong class="userinput"><code>make install-world-bin</code></strong>
</pre><p>
   </p><p>
    You can use <code class="literal">make install-strip</code> instead of
    <code class="literal">make install</code> to strip the executable files and
    libraries as they are installed.  This will save some space.  If
    you built with debugging support, stripping will effectively
    remove the debugging support, so it should only be done if
    debugging is no longer needed.  <code class="literal">install-strip</code>
    tries to do a reasonable job saving space, but it does not have
    perfect knowledge of how to strip every unneeded byte from an
    executable file, so if you want to save all the disk space you
    possibly can, you will have to do manual work.
   </p><p>
    The standard installation provides all the header files needed for client
    application development as well as for server-side program
    development, such as custom functions or data types written in C.
   </p><p><strong>Client-only installation: </strong>
     If you want to install only the client applications and
     interface libraries, then you can use these commands:
</p><pre class="screen">
<strong class="userinput"><code>make -C src/bin install</code></strong>
<strong class="userinput"><code>make -C src/include install</code></strong>
<strong class="userinput"><code>make -C src/interfaces install</code></strong>
<strong class="userinput"><code>make -C doc install</code></strong>
</pre><p>
    <code class="filename">src/bin</code> has a few binaries for server-only use,
    but they are small.
    </p></li></ol></div><p><strong>Uninstallation: </strong>
    To undo the installation use the command <code class="command">make
    uninstall</code>. However, this will not remove any created directories.
   </p><p><strong>Cleaning: </strong>
    After the installation you can free disk space by removing the built
    files from the source tree with the command <code class="command">make
    clean</code>. This will preserve the files made by the <code class="command">configure</code>
    program, so that you can rebuild everything with <code class="command">make</code>
    later on. To reset the source tree to the state in which it was
    distributed, use <code class="command">make distclean</code>. If you are going to
    build for several platforms within the same source tree you must do
    this and re-configure for each platform.  (Alternatively, use
    a separate build tree for each platform, so that the source tree
    remains unmodified.)
   </p><p>
   If you perform a build and then discover that your <code class="command">configure</code>
   options were wrong, or if you change anything that <code class="command">configure</code>
   investigates (for example, software upgrades), then it's a good
   idea to do <code class="command">make distclean</code> before reconfiguring and
   rebuilding.  Without this, your changes in configuration choices
   might not propagate everywhere they need to.
  </p><div class="sect2" id="CONFIGURE-OPTIONS"><div class="titlepage"><div><div><h3 class="title">17.4.1. <code class="filename">configure</code> Options</h3></div></div></div><a id="id-1.6.4.8.6.2" class="indexterm"></a><p>
    <code class="command">configure</code>'s command line options are explained below.
    This list is not exhaustive (use <code class="literal">./configure --help</code>
    to get one that is).  The options not covered here are meant for
    advanced use-cases such as cross-compilation, and are documented in
    the standard Autoconf documentation.
   </p><div class="sect3" id="CONFIGURE-OPTIONS-LOCATIONS"><div class="titlepage"><div><div><h4 class="title">17.4.1.1. Installation Locations</h4></div></div></div><p>
      These options control where <code class="literal">make install</code> will put
      the files.  The <code class="option">--prefix</code> option is sufficient for
      most cases.  If you have special needs, you can customize the
      installation subdirectories with the other options described in this
      section.  Beware however that changing the relative locations of the
      different subdirectories may render the installation non-relocatable,
      meaning you won't be able to move it after installation.
      (The <code class="literal">man</code> and <code class="literal">doc</code> locations are
      not affected by this restriction.)  For relocatable installs, you
      might want to use the <code class="literal">--disable-rpath</code> option
      described later.
     </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--prefix=<em class="replaceable"><code>PREFIX</code></em></code></span></dt><dd><p>
         Install all files under the directory <em class="replaceable"><code>PREFIX</code></em>
         instead of <code class="filename">/usr/local/pgsql</code>. The actual
         files will be installed into various subdirectories; no files
         will ever be installed directly into the
         <em class="replaceable"><code>PREFIX</code></em> directory.
        </p></dd><dt><span class="term"><code class="option">--exec-prefix=<em class="replaceable"><code>EXEC-PREFIX</code></em></code></span></dt><dd><p>
         You can install architecture-dependent files under a
         different prefix, <em class="replaceable"><code>EXEC-PREFIX</code></em>, than what
         <em class="replaceable"><code>PREFIX</code></em> was set to. This can be useful to
         share architecture-independent files between hosts. If you
         omit this, then <em class="replaceable"><code>EXEC-PREFIX</code></em> is set equal to
         <em class="replaceable"><code>PREFIX</code></em> and both architecture-dependent and
         independent files will be installed under the same tree,
         which is probably what you want.
        </p></dd><dt><span class="term"><code class="option">--bindir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Specifies the directory for executable programs. The default
         is <code class="filename"><em class="replaceable"><code>EXEC-PREFIX</code></em>/bin</code>, which
         normally means <code class="filename">/usr/local/pgsql/bin</code>.
        </p></dd><dt><span class="term"><code class="option">--sysconfdir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Sets the directory for various configuration files,
         <code class="filename"><em class="replaceable"><code>PREFIX</code></em>/etc</code> by default.
        </p></dd><dt><span class="term"><code class="option">--libdir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Sets the location to install libraries and dynamically loadable
         modules. The default is
         <code class="filename"><em class="replaceable"><code>EXEC-PREFIX</code></em>/lib</code>.
        </p></dd><dt><span class="term"><code class="option">--includedir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Sets the directory for installing C and C++ header files. The
         default is <code class="filename"><em class="replaceable"><code>PREFIX</code></em>/include</code>.
        </p></dd><dt><span class="term"><code class="option">--datarootdir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Sets the root directory for various types of read-only data
         files.  This only sets the default for some of the following
         options.  The default is
         <code class="filename"><em class="replaceable"><code>PREFIX</code></em>/share</code>.
        </p></dd><dt><span class="term"><code class="option">--datadir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Sets the directory for read-only data files used by the
         installed programs. The default is
         <code class="filename"><em class="replaceable"><code>DATAROOTDIR</code></em></code>. Note that this has
         nothing to do with where your database files will be placed.
        </p></dd><dt><span class="term"><code class="option">--localedir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Sets the directory for installing locale data, in particular
         message translation catalog files.  The default is
         <code class="filename"><em class="replaceable"><code>DATAROOTDIR</code></em>/locale</code>.
        </p></dd><dt><span class="term"><code class="option">--mandir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         The man pages that come with <span class="productname">PostgreSQL</span> will be installed under
         this directory, in their respective
         <code class="filename">man<em class="replaceable"><code>x</code></em></code> subdirectories.
         The default is <code class="filename"><em class="replaceable"><code>DATAROOTDIR</code></em>/man</code>.
        </p></dd><dt><span class="term"><code class="option">--docdir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Sets the root directory for installing documentation files,
         except <span class="quote"><span class="quote">man</span></span> pages.  This only sets the default for
         the following options.  The default value for this option is
         <code class="filename"><em class="replaceable"><code>DATAROOTDIR</code></em>/doc/postgresql</code>.
        </p></dd><dt><span class="term"><code class="option">--htmldir=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         The HTML-formatted documentation for
         <span class="productname">PostgreSQL</span> will be installed under
         this directory.  The default is
         <code class="filename"><em class="replaceable"><code>DATAROOTDIR</code></em></code>.
        </p></dd></dl></div><div class="note"><h3 class="title">Note</h3><p>
       Care has been taken to make it possible to install
       <span class="productname">PostgreSQL</span> into shared installation locations
       (such as <code class="filename">/usr/local/include</code>) without
       interfering with the namespace of the rest of the system. First,
       the string <span class="quote"><span class="quote"><code class="literal">/postgresql</code></span></span> is
       automatically appended to <code class="varname">datadir</code>,
       <code class="varname">sysconfdir</code>, and <code class="varname">docdir</code>,
       unless the fully expanded directory name already contains the
       string <span class="quote"><span class="quote"><code class="literal">postgres</code></span></span> or
       <span class="quote"><span class="quote"><code class="literal">pgsql</code></span></span>. For example, if you choose
       <code class="filename">/usr/local</code> as prefix, the documentation will
       be installed in <code class="filename">/usr/local/doc/postgresql</code>,
       but if the prefix is <code class="filename">/opt/postgres</code>, then it
       will be in <code class="filename">/opt/postgres/doc</code>. The public C
       header files of the client interfaces are installed into
       <code class="varname">includedir</code> and are namespace-clean. The
       internal header files and the server header files are installed
       into private directories under <code class="varname">includedir</code>. See
       the documentation of each interface for information about how to
       access its header files. Finally, a private subdirectory will
       also be created, if appropriate, under <code class="varname">libdir</code>
       for dynamically loadable modules.
      </p></div></div><div class="sect3" id="CONFIGURE-OPTIONS-FEATURES"><div class="titlepage"><div><div><h4 class="title">17.4.1.2. <span class="productname">PostgreSQL</span> Features</h4></div></div></div><p>
     The options described in this section enable building of
     various <span class="productname">PostgreSQL</span> features that are not
     built by default.  Most of these are non-default only because they
     require additional software, as described in
     <a class="xref" href="install-requirements.html" title="17.2. Requirements">Section 17.2</a>.
    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--enable-nls[<span class="optional">=<em class="replaceable"><code>LANGUAGES</code></em></span>]</code></span></dt><dd><p>
         Enables Native Language Support (<acronym class="acronym">NLS</acronym>),
         that is, the ability to display a program's messages in a
         language other than English.
         <em class="replaceable"><code>LANGUAGES</code></em> is an optional space-separated
         list of codes of the languages that you want supported, for
         example <code class="literal">--enable-nls='de fr'</code>.  (The intersection
         between your list and the set of actually provided
         translations will be computed automatically.)  If you do not
         specify a list, then all available translations are
         installed.
        </p><p>
         To use this option, you will need an implementation of the
         <span class="application">Gettext</span> API.
        </p></dd><dt><span class="term"><code class="option">--with-perl</code></span></dt><dd><p>
         Build the <span class="application">PL/Perl</span> server-side language.
        </p></dd><dt><span class="term"><code class="option">--with-python</code></span></dt><dd><p>
         Build the <span class="application">PL/Python</span> server-side language.
        </p></dd><dt><span class="term"><code class="option">--with-tcl</code></span></dt><dd><p>
         Build the <span class="application">PL/Tcl</span> server-side language.
        </p></dd><dt><span class="term"><code class="option">--with-tclconfig=<em class="replaceable"><code>DIRECTORY</code></em></code></span></dt><dd><p>
         Tcl installs the file <code class="filename">tclConfig.sh</code>, which
         contains configuration information needed to build modules
         interfacing to Tcl. This file is normally found automatically
         at a well-known location, but if you want to use a different
         version of Tcl you can specify the directory in which to look
         for <code class="filename">tclConfig.sh</code>.
        </p></dd><dt><span class="term"><code class="option">--with-icu</code></span></dt><dd><p>
         Build with support for
         the <span class="productname">ICU</span><a id="id-1.6.4.8.6.5.3.6.2.1.2" class="indexterm"></a>
         library, enabling use of ICU collation
         features<span class="phrase"> (see
         <a class="xref" href="collation.html" title="24.2. Collation Support">Section 24.2</a>)</span>.
         This requires the <span class="productname">ICU4C</span> package
         to be installed.  The minimum required version
         of <span class="productname">ICU4C</span> is currently 4.2.
        </p><p>
         By default,
         <span class="productname">pkg-config</span><a id="id-1.6.4.8.6.5.3.6.2.2.2" class="indexterm"></a>
         will be used to find the required compilation options.  This is
         supported for <span class="productname">ICU4C</span> version 4.6 and later.
         For older versions, or if <span class="productname">pkg-config</span> is
         not available, the variables <code class="envar">ICU_CFLAGS</code>
         and <code class="envar">ICU_LIBS</code> can be specified
         to <code class="filename">configure</code>, like in this example:
</p><pre class="programlisting">
./configure ... --with-icu ICU_CFLAGS='-I/some/where/include' ICU_LIBS='-L/some/where/lib -licui18n -licuuc -licudata'
</pre><p>
         (If <span class="productname">ICU4C</span> is in the default search path
         for the compiler, then you still need to specify nonempty strings in
         order to avoid use of <span class="productname">pkg-config</span>, for
         example, <code class="literal">ICU_CFLAGS=' '</code>.)
        </p></dd><dt id="CONFIGURE-WITH-LLVM"><span class="term"><code class="option">--with-llvm</code></span></dt><dd><p>
         Build with support for <span class="productname">LLVM</span> based
         <acronym class="acronym">JIT</acronym> compilation<span class="phrase"> (see <a class="xref" href="jit.html" title="Chapter 32. Just-in-Time Compilation (JIT)">Chapter 32</a>)</span>.  This
         requires the <span class="productname">LLVM</span> library to be installed.
         The minimum required version of <span class="productname">LLVM</span> is
         currently 3.9.
        </p><p>
         <code class="command">llvm-config</code><a id="id-1.6.4.8.6.5.3.7.2.2.2" class="indexterm"></a>
         will be used to find the required compilation options.
         <code class="command">llvm-config</code>, and then
         <code class="command">llvm-config-$major-$minor</code> for all supported
         versions, will be searched for in your <code class="envar">PATH</code>.  If
         that would not yield the desired program,
         use <code class="envar">LLVM_CONFIG</code> to specify a path to the
         correct <code class="command">llvm-config</code>. For example
</p><pre class="programlisting">
./configure ... --with-llvm LLVM_CONFIG='/path/to/llvm/bin/llvm-config'
</pre><p>
        </p><p>
         <span class="productname">LLVM</span> support requires a compatible
         <code class="command">clang</code> compiler (specified, if necessary, using the
         <code class="envar">CLANG</code> environment variable), and a working C++
         compiler (specified, if necessary, using the <code class="envar">CXX</code>
         environment variable).
        </p></dd><dt><span class="term"><code class="option">--with-lz4</code></span></dt><dd><p>
         Build with <span class="productname">LZ4</span> compression support.
        </p></dd><dt><span class="term"><code class="option">--with-zstd</code></span></dt><dd><p>
         Build with <span class="productname">Zstandard</span> compression support.
        </p></dd><dt><span class="term"><code class="option">--with-ssl=<em class="replaceable"><code>LIBRARY</code></em></code>
       <a id="id-1.6.4.8.6.5.3.10.1.2" class="indexterm"></a>
       </span></dt><dd><p>
         Build with support for <acronym class="acronym">SSL</acronym> (encrypted)
         connections. The only <em class="replaceable"><code>LIBRARY</code></em>
         supported is <code class="option">openssl</code>. This requires the
         <span class="productname">OpenSSL</span> package to be installed.
         <code class="filename">configure</code> will check for the required
         header files and libraries to make sure that your
         <span class="productname">OpenSSL</span> installation is sufficient
         before proceeding.
        </p></dd><dt><span class="term"><code class="option">--with-openssl</code></span></dt><dd><p>
         Obsolete equivalent of <code class="literal">--with-ssl=openssl</code>.
        </p></dd><dt><span class="term"><code class="option">--with-gssapi</code></span></dt><dd><p>
         Build with support for GSSAPI authentication. On many systems, the
         GSSAPI system (usually a part of the Kerberos installation) is not
         installed in a location
         that is searched by default (e.g., <code class="filename">/usr/include</code>,
         <code class="filename">/usr/lib</code>), so you must use the options
         <code class="option">--with-includes</code> and <code class="option">--with-libraries</code> in
         addition to this option.  <code class="filename">configure</code> will check
         for the required header files and libraries to make sure that
         your GSSAPI installation is sufficient before proceeding.
        </p></dd><dt><span class="term"><code class="option">--with-ldap</code></span></dt><dd><p>
         Build with <acronym class="acronym">LDAP</acronym><a id="id-1.6.4.8.6.5.3.13.2.1.2" class="indexterm"></a>
         support for authentication and connection parameter lookup (see
         <span id="INSTALL-LDAP-LINKS" class="phrase"><a class="xref" href="libpq-ldap.html" title="34.18. LDAP Lookup of Connection Parameters">Section 34.18</a> and
         <a class="xref" href="auth-ldap.html" title="21.10. LDAP Authentication">Section 21.10</a></span> for more information). On Unix,
         this requires the <span class="productname">OpenLDAP</span> package to be
         installed. On Windows, the default <span class="productname">WinLDAP</span>
         library is used.  <code class="filename">configure</code> will check for the required
         header files and libraries to make sure that your
         <span class="productname">OpenLDAP</span> installation is sufficient before
         proceeding.
        </p></dd><dt><span class="term"><code class="option">--with-pam</code></span></dt><dd><p>
         Build with <acronym class="acronym">PAM</acronym><a id="id-1.6.4.8.6.5.3.14.2.1.2" class="indexterm"></a>
         (Pluggable Authentication Modules) support.
        </p></dd><dt><span class="term"><code class="option">--with-bsd-auth</code></span></dt><dd><p>
         Build with BSD Authentication support.
         (The BSD Authentication framework is
         currently only available on OpenBSD.)
        </p></dd><dt><span class="term"><code class="option">--with-systemd</code></span></dt><dd><p>
         Build with support
         for <span class="application">systemd</span><a id="id-1.6.4.8.6.5.3.16.2.1.2" class="indexterm"></a>
         service notifications.  This improves integration if the server
         is started under <span class="application">systemd</span> but has no impact
         otherwise<span class="phrase">; see <a class="xref" href="server-start.html" title="19.3. Starting the Database Server">Section 19.3</a> for more
         information</span>.  <span class="application">libsystemd</span> and the
         associated header files need to be installed to use this option.
        </p></dd><dt><span class="term"><code class="option">--with-bonjour</code></span></dt><dd><p>
         Build with support for Bonjour automatic service discovery.
         This requires Bonjour support in your operating system.
         Recommended on macOS.
        </p></dd><dt><span class="term"><code class="option">--with-uuid=<em class="replaceable"><code>LIBRARY</code></em></code></span></dt><dd><p>
         Build the <a class="xref" href="uuid-ossp.html" title="F.49. uuid-ossp">uuid-ossp</a> module
         (which provides functions to generate UUIDs), using the specified
         UUID library.<a id="id-1.6.4.8.6.5.3.18.2.1.2" class="indexterm"></a>
         <em class="replaceable"><code>LIBRARY</code></em> must be one of:
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
           <code class="option">bsd</code> to use the UUID functions found in FreeBSD
           and some other BSD-derived systems
          </p></li><li class="listitem"><p>
           <code class="option">e2fs</code> to use the UUID library created by
           the <code class="literal">e2fsprogs</code> project; this library is present in most
           Linux systems and in macOS, and can be obtained for other
           platforms as well
          </p></li><li class="listitem"><p>
           <code class="option">ossp</code> to use the <a class="ulink" href="http://www.ossp.org/pkg/lib/uuid/" target="_top">OSSP UUID library</a>
          </p></li></ul></div></dd><dt><span class="term"><code class="option">--with-ossp-uuid</code></span></dt><dd><p>
         Obsolete equivalent of <code class="literal">--with-uuid=ossp</code>.
        </p></dd><dt><span class="term"><code class="option">--with-libxml</code></span></dt><dd><p>
         Build with libxml2, enabling SQL/XML support.  Libxml2 version 2.6.23 or
         later is required for this feature.
        </p><p>
         To detect the required compiler and linker options, PostgreSQL will
         query <code class="command">pkg-config</code>, if that is installed and knows
         about libxml2.  Otherwise the program <code class="command">xml2-config</code>,
         which is installed by libxml2, will be used if it is found.  Use
         of <code class="command">pkg-config</code> is preferred, because it can deal
         with multi-architecture installations better.
        </p><p>
         To use a libxml2 installation that is in an unusual location, you
         can set <code class="command">pkg-config</code>-related environment
         variables (see its documentation), or set the environment variable
         <code class="envar">XML2_CONFIG</code> to point to
         the <code class="command">xml2-config</code> program belonging to the libxml2
         installation, or set the variables <code class="envar">XML2_CFLAGS</code>
         and <code class="envar">XML2_LIBS</code>.  (If <code class="command">pkg-config</code> is
         installed, then to override its idea of where libxml2 is you must
         either set <code class="envar">XML2_CONFIG</code> or set
         both <code class="envar">XML2_CFLAGS</code> and <code class="envar">XML2_LIBS</code> to
         nonempty strings.)
        </p></dd><dt><span class="term"><code class="option">--with-libxslt</code></span></dt><dd><p>
         Build with libxslt, enabling the
         <a class="xref" href="xml2.html" title="F.50. xml2">xml2</a>
         module to perform XSL transformations of XML.
         <code class="option">--with-libxml</code> must be specified as well.
        </p></dd></dl></div></div><div class="sect3" id="CONFIGURE-OPTIONS-ANTI-FEATURES"><div class="titlepage"><div><div><h4 class="title">17.4.1.3. Anti-Features</h4></div></div></div><p>
     The options described in this section allow disabling
     certain <span class="productname">PostgreSQL</span> features that are built
     by default, but which might need to be turned off if the required
     software or system features are not available.  Using these options is
     not recommended unless really necessary.
    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--without-readline</code></span></dt><dd><p>
         Prevents use of the <span class="application">Readline</span> library
         (and <span class="application">libedit</span> as well).  This option disables
         command-line editing and history in
         <span class="application">psql</span>.
        </p></dd><dt><span class="term"><code class="option">--with-libedit-preferred</code></span></dt><dd><p>
         Favors the use of the BSD-licensed <span class="application">libedit</span> library
         rather than GPL-licensed <span class="application">Readline</span>.  This option
         is significant only if you have both libraries installed; the
         default in that case is to use <span class="application">Readline</span>.
        </p></dd><dt><span class="term"><code class="option">--without-zlib</code></span></dt><dd><p>
         <a id="id-1.6.4.8.6.6.3.3.2.1.1" class="indexterm"></a>
         Prevents use of the <span class="application">Zlib</span> library.
         This disables
         support for compressed archives in <span class="application">pg_dump</span>
         and <span class="application">pg_restore</span>.
        </p></dd><dt><span class="term"><code class="option">--disable-spinlocks</code></span></dt><dd><p>
         Allow the build to succeed even if <span class="productname">PostgreSQL</span>
         has no CPU spinlock support for the platform.  The lack of
         spinlock support will result in very poor performance; therefore,
         this option should only be used if the build aborts and
         informs you that the platform lacks spinlock support. If this
         option is required to build <span class="productname">PostgreSQL</span> on
         your platform, please report the problem to the
         <span class="productname">PostgreSQL</span> developers.
        </p></dd><dt><span class="term"><code class="option">--disable-atomics</code></span></dt><dd><p>
         Disable use of CPU atomic operations.  This option does nothing on
         platforms that lack such operations.  On platforms that do have
         them, this will result in poor performance.  This option is only
         useful for debugging or making performance comparisons.
        </p></dd><dt><span class="term"><code class="option">--disable-thread-safety</code></span></dt><dd><p>
         Disable the thread-safety of client libraries.  This prevents
         concurrent threads in <span class="application">libpq</span> and
         <span class="application">ECPG</span> programs from safely controlling
         their private connection handles.  Use this only on platforms
         with deficient threading support.
        </p></dd></dl></div></div><div class="sect3" id="CONFIGURE-OPTIONS-BUILD-PROCESS"><div class="titlepage"><div><div><h4 class="title">17.4.1.4. Build Process Details</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--with-includes=<em class="replaceable"><code>DIRECTORIES</code></em></code></span></dt><dd><p>
         <em class="replaceable"><code>DIRECTORIES</code></em> is a colon-separated list of
         directories that will be added to the list the compiler
         searches for header files. If you have optional packages
         (such as GNU <span class="application">Readline</span>) installed in a non-standard
         location,
         you have to use this option and probably also the corresponding
         <code class="option">--with-libraries</code> option.
        </p><p>
         Example: <code class="literal">--with-includes=/opt/gnu/include:/usr/sup/include</code>.
        </p></dd><dt><span class="term"><code class="option">--with-libraries=<em class="replaceable"><code>DIRECTORIES</code></em></code></span></dt><dd><p>
         <em class="replaceable"><code>DIRECTORIES</code></em> is a colon-separated list of
         directories to search for libraries. You will probably have
         to use this option (and the corresponding
         <code class="option">--with-includes</code> option) if you have packages
         installed in non-standard locations.
        </p><p>
         Example: <code class="literal">--with-libraries=/opt/gnu/lib:/usr/sup/lib</code>.
        </p></dd><dt><span class="term"><code class="option">--with-system-tzdata=<em class="replaceable"><code>DIRECTORY</code></em></code>
       <a id="id-1.6.4.8.6.7.2.3.1.2" class="indexterm"></a>
       </span></dt><dd><p>
         <span class="productname">PostgreSQL</span> includes its own time zone database,
         which it requires for date and time operations.  This time zone
         database is in fact compatible with the IANA time zone
         database provided by many operating systems such as FreeBSD,
         Linux, and Solaris, so it would be redundant to install it again.
         When this option is used, the system-supplied time zone database
         in <em class="replaceable"><code>DIRECTORY</code></em> is used instead of the one
         included in the PostgreSQL source distribution.
         <em class="replaceable"><code>DIRECTORY</code></em> must be specified as an
         absolute path.  <code class="filename">/usr/share/zoneinfo</code> is a
         likely directory on some operating systems.  Note that the
         installation routine will not detect mismatching or erroneous time
         zone data.  If you use this option, you are advised to run the
         regression tests to verify that the time zone data you have
         pointed to works correctly with <span class="productname">PostgreSQL</span>.
        </p><a id="id-1.6.4.8.6.7.2.3.2.2" class="indexterm"></a><p>
         This option is mainly aimed at binary package distributors
         who know their target operating system well.  The main
         advantage of using this option is that the PostgreSQL package
         won't need to be upgraded whenever any of the many local
         daylight-saving time rules change.  Another advantage is that
         PostgreSQL can be cross-compiled more straightforwardly if the
         time zone database files do not need to be built during the
         installation.
        </p></dd><dt><span class="term"><code class="option">--with-extra-version=<em class="replaceable"><code>STRING</code></em></code></span></dt><dd><p>
         Append <em class="replaceable"><code>STRING</code></em> to the PostgreSQL version number.  You
         can use this, for example, to mark binaries built from unreleased Git
         snapshots or containing custom patches with an extra version string,
         such as a <code class="command">git describe</code> identifier or a
         distribution package release number.
        </p></dd><dt><span class="term"><code class="option">--disable-rpath</code></span></dt><dd><p>
         Do not mark <span class="productname">PostgreSQL</span>'s executables
         to indicate that they should search for shared libraries in the
         installation's library directory (see <code class="option">--libdir</code>).
         On most platforms, this marking uses an absolute path to the
         library directory, so that it will be unhelpful if you relocate
         the installation later.  However, you will then need to provide
         some other way for the executables to find the shared libraries.
         Typically this requires configuring the operating system's
         dynamic linker to search the library directory; see
         <a class="xref" href="install-post.html#INSTALL-POST-SHLIBS" title="17.5.1. Shared Libraries">Section 17.5.1</a> for more detail.
        </p></dd></dl></div></div><div class="sect3" id="CONFIGURE-OPTIONS-MISC"><div class="titlepage"><div><div><h4 class="title">17.4.1.5. Miscellaneous</h4></div></div></div><p>
     It's fairly common, particularly for test builds, to adjust the
     default port number with <code class="option">--with-pgport</code>.
     The other options in this section are recommended only for advanced
     users.
    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--with-pgport=<em class="replaceable"><code>NUMBER</code></em></code></span></dt><dd><p>
         Set <em class="replaceable"><code>NUMBER</code></em> as the default port number for
         server and clients. The default is 5432. The port can always
         be changed later on, but if you specify it here then both
         server and clients will have the same default compiled in,
         which can be very convenient.  Usually the only good reason
         to select a non-default value is if you intend to run multiple
         <span class="productname">PostgreSQL</span> servers on the same machine.
        </p></dd><dt><span class="term"><code class="option">--with-krb-srvnam=<em class="replaceable"><code>NAME</code></em></code></span></dt><dd><p>
         The default name of the Kerberos service principal used
         by GSSAPI.
         <code class="literal">postgres</code> is the default. There's usually no
         reason to change this unless you are building for a Windows
         environment, in which case it must be set to upper case
         <code class="literal">POSTGRES</code>.
        </p></dd><dt><span class="term"><code class="option">--with-segsize=<em class="replaceable"><code>SEGSIZE</code></em></code></span></dt><dd><p>
         Set the <em class="firstterm">segment size</em>, in gigabytes.  Large tables are
         divided into multiple operating-system files, each of size equal
         to the segment size.  This avoids problems with file size limits
         that exist on many platforms.  The default segment size, 1 gigabyte,
         is safe on all supported platforms.  If your operating system has
         <span class="quote"><span class="quote">largefile</span></span> support (which most do, nowadays), you can use
         a larger segment size.  This can be helpful to reduce the number of
         file descriptors consumed when working with very large tables.
         But be careful not to select a value larger than is supported
         by your platform and the file systems you intend to use.  Other
         tools you might wish to use, such as <span class="application">tar</span>, could
         also set limits on the usable file size.
         It is recommended, though not absolutely required, that this value
         be a power of 2.
         Note that changing this value breaks on-disk database compatibility,
         meaning you cannot use <code class="command">pg_upgrade</code> to upgrade to
         a build with a different segment size.
        </p></dd><dt><span class="term"><code class="option">--with-blocksize=<em class="replaceable"><code>BLOCKSIZE</code></em></code></span></dt><dd><p>
         Set the <em class="firstterm">block size</em>, in kilobytes.  This is the unit
         of storage and I/O within tables.  The default, 8 kilobytes,
         is suitable for most situations; but other values may be useful
         in special cases.
         The value must be a power of 2 between 1 and 32 (kilobytes).
         Note that changing this value breaks on-disk database compatibility,
         meaning you cannot use <code class="command">pg_upgrade</code> to upgrade to
         a build with a different block size.
        </p></dd><dt><span class="term"><code class="option">--with-wal-blocksize=<em class="replaceable"><code>BLOCKSIZE</code></em></code></span></dt><dd><p>
         Set the <em class="firstterm">WAL block size</em>, in kilobytes.  This is the unit
         of storage and I/O within the WAL log.  The default, 8 kilobytes,
         is suitable for most situations; but other values may be useful
         in special cases.
         The value must be a power of 2 between 1 and 64 (kilobytes).
         Note that changing this value breaks on-disk database compatibility,
         meaning you cannot use <code class="command">pg_upgrade</code> to upgrade to
         a build with a different WAL block size.
        </p></dd></dl></div></div><div class="sect3" id="CONFIGURE-OPTIONS-DEVEL"><div class="titlepage"><div><div><h4 class="title">17.4.1.6. Developer Options</h4></div></div></div><p>
     Most of the options in this section are only of interest for
     developing or debugging <span class="productname">PostgreSQL</span>.
     They are not recommended for production builds, except
     for <code class="option">--enable-debug</code>, which can be useful to enable
     detailed bug reports in the unlucky event that you encounter a bug.
     On platforms supporting DTrace, <code class="option">--enable-dtrace</code>
     may also be reasonable to use in production.
    </p><p>
     When building an installation that will be used to develop code inside
     the server, it is recommended to use at least the
     options <code class="option">--enable-debug</code>
     and <code class="option">--enable-cassert</code>.
    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--enable-debug</code></span></dt><dd><p>
         Compiles all programs and libraries with debugging symbols.
         This means that you can run the programs in a debugger
         to analyze problems. This enlarges the size of the installed
         executables considerably, and on non-GCC compilers it usually
         also disables compiler optimization, causing slowdowns. However,
         having the symbols available is extremely helpful for dealing
         with any problems that might arise.  Currently, this option is
         recommended for production installations only if you use GCC.
         But you should always have it on if you are doing development work
         or running a beta version.
        </p></dd><dt><span class="term"><code class="option">--enable-cassert</code></span></dt><dd><p>
         Enables <em class="firstterm">assertion</em> checks in the server, which test for
         many <span class="quote"><span class="quote">cannot happen</span></span> conditions.  This is invaluable for
         code development purposes, but the tests can slow down the
         server significantly.
         Also, having the tests turned on won't necessarily enhance the
         stability of your server!  The assertion checks are not categorized
         for severity, and so what might be a relatively harmless bug will
         still lead to server restarts if it triggers an assertion
         failure.  This option is not recommended for production use, but
         you should have it on for development work or when running a beta
         version.
        </p></dd><dt><span class="term"><code class="option">--enable-tap-tests</code></span></dt><dd><p>
         Enable tests using the Perl TAP tools.  This requires a Perl
         installation and the Perl module <code class="literal">IPC::Run</code>.
         <span class="phrase">See <a class="xref" href="regress-tap.html" title="33.4. TAP Tests">Section 33.4</a> for more information.</span>
        </p></dd><dt><span class="term"><code class="option">--enable-depend</code></span></dt><dd><p>
         Enables automatic dependency tracking.  With this option, the
         makefiles are set up so that all affected object files will
         be rebuilt when any header file is changed.  This is useful
         if you are doing development work, but is just wasted overhead
         if you intend only to compile once and install.  At present,
         this option only works with GCC.
        </p></dd><dt><span class="term"><code class="option">--enable-coverage</code></span></dt><dd><p>
         If using GCC, all programs and libraries are compiled with
         code coverage testing instrumentation.  When run, they
         generate files in the build directory with code coverage
         metrics.
         <span class="phrase">See <a class="xref" href="regress-coverage.html" title="33.5. Test Coverage Examination">Section 33.5</a>
         for more information.</span> This option is for use only with GCC
         and when doing development work.
        </p></dd><dt><span class="term"><code class="option">--enable-profiling</code></span></dt><dd><p>
         If using GCC, all programs and libraries are compiled so they
         can be profiled.  On backend exit, a subdirectory will be created
         that contains the <code class="filename">gmon.out</code> file containing
         profile data.
         This option is for use only with GCC and when doing development work.
        </p></dd><dt><span class="term"><code class="option">--enable-dtrace</code></span></dt><dd><p>
         <a id="id-1.6.4.8.6.9.4.7.2.1.1" class="indexterm"></a>
         Compiles <span class="productname">PostgreSQL</span> with support for the
         dynamic tracing tool DTrace.
         <span class="phrase">See <a class="xref" href="dynamic-trace.html" title="28.5. Dynamic Tracing">Section 28.5</a>
         for more information.</span>
        </p><p>
         To point to the <code class="command">dtrace</code> program, the
         environment variable <code class="envar">DTRACE</code> can be set.  This
         will often be necessary because <code class="command">dtrace</code> is
         typically installed under <code class="filename">/usr/sbin</code>,
         which might not be in your <code class="envar">PATH</code>.
        </p><p>
         Extra command-line options for the <code class="command">dtrace</code> program
         can be specified in the environment variable
         <code class="envar">DTRACEFLAGS</code>.  On Solaris,
         to include DTrace support in a 64-bit binary, you must specify
         <code class="literal">DTRACEFLAGS="-64"</code>.  For example,
         using the GCC compiler:
</p><pre class="screen">
./configure CC='gcc -m64' --enable-dtrace DTRACEFLAGS='-64' ...
</pre><p>
         Using Sun's compiler:
</p><pre class="screen">
./configure CC='/opt/SUNWspro/bin/cc -xtarget=native64' --enable-dtrace DTRACEFLAGS='-64' ...
</pre><p>
        </p></dd></dl></div></div></div><div class="sect2" id="CONFIGURE-ENVVARS"><div class="titlepage"><div><div><h3 class="title">17.4.2. <code class="filename">configure</code> Environment Variables</h3></div></div></div><a id="id-1.6.4.8.7.2" class="indexterm"></a><p>
     In addition to the ordinary command-line options described above,
     <code class="filename">configure</code> responds to a number of environment
     variables.
     You can specify environment variables on the
     <code class="filename">configure</code> command line, for example:
</p><pre class="screen">
<strong class="userinput"><code>./configure CC=/opt/bin/gcc CFLAGS='-O2 -pipe'</code></strong>
</pre><p>
     In this usage an environment variable is little different from a
     command-line option.
     You can also set such variables beforehand:
</p><pre class="screen">
<strong class="userinput"><code>export CC=/opt/bin/gcc</code></strong>
<strong class="userinput"><code>export CFLAGS='-O2 -pipe'</code></strong>
<strong class="userinput"><code>./configure</code></strong>
</pre><p>
     This usage can be convenient because many programs' configuration
     scripts respond to these variables in similar ways.
    </p><p>
     The most commonly used of these environment variables are
     <code class="envar">CC</code> and <code class="envar">CFLAGS</code>.
     If you prefer a C compiler different from the one
     <code class="filename">configure</code> picks, you can set the
     variable <code class="envar">CC</code> to the program of your choice.
     By default, <code class="filename">configure</code> will pick
     <code class="filename">gcc</code> if available, else the platform's
     default (usually <code class="filename">cc</code>).  Similarly, you can override the
     default compiler flags if needed with the <code class="envar">CFLAGS</code> variable.
    </p><p>
     Here is a list of the significant variables that can be set in
     this manner:

     </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">BISON</code></span></dt><dd><p>
         Bison program
        </p></dd><dt><span class="term"><code class="envar">CC</code></span></dt><dd><p>
         C compiler
        </p></dd><dt><span class="term"><code class="envar">CFLAGS</code></span></dt><dd><p>
         options to pass to the C compiler
        </p></dd><dt><span class="term"><code class="envar">CLANG</code></span></dt><dd><p>
         path to <code class="command">clang</code> program used to process source code
         for inlining when compiling with <code class="literal">--with-llvm</code>
        </p></dd><dt><span class="term"><code class="envar">CPP</code></span></dt><dd><p>
         C preprocessor
        </p></dd><dt><span class="term"><code class="envar">CPPFLAGS</code></span></dt><dd><p>
         options to pass to the C preprocessor
        </p></dd><dt><span class="term"><code class="envar">CXX</code></span></dt><dd><p>
         C++ compiler
        </p></dd><dt><span class="term"><code class="envar">CXXFLAGS</code></span></dt><dd><p>
         options to pass to the C++ compiler
        </p></dd><dt><span class="term"><code class="envar">DTRACE</code></span></dt><dd><p>
         location of the <code class="command">dtrace</code> program
        </p></dd><dt><span class="term"><code class="envar">DTRACEFLAGS</code></span></dt><dd><p>
         options to pass to the <code class="command">dtrace</code> program
        </p></dd><dt><span class="term"><code class="envar">FLEX</code></span></dt><dd><p>
         Flex program
        </p></dd><dt><span class="term"><code class="envar">LDFLAGS</code></span></dt><dd><p>
         options to use when linking either executables or shared libraries
        </p></dd><dt><span class="term"><code class="envar">LDFLAGS_EX</code></span></dt><dd><p>
         additional options for linking executables only
        </p></dd><dt><span class="term"><code class="envar">LDFLAGS_SL</code></span></dt><dd><p>
         additional options for linking shared libraries only
        </p></dd><dt><span class="term"><code class="envar">LLVM_CONFIG</code></span></dt><dd><p>
         <code class="command">llvm-config</code> program used to locate the
         <span class="productname">LLVM</span> installation
        </p></dd><dt><span class="term"><code class="envar">MSGFMT</code></span></dt><dd><p>
         <code class="command">msgfmt</code> program for native language support
        </p></dd><dt><span class="term"><code class="envar">PERL</code></span></dt><dd><p>
         Perl interpreter program.  This will be used to determine the
         dependencies for building PL/Perl.  The default is
         <code class="command">perl</code>.
        </p></dd><dt><span class="term"><code class="envar">PYTHON</code></span></dt><dd><p>
         Python interpreter program.  This will be used to determine the
         dependencies for building PL/Python.  If this is not set, the
         following are probed in this order:
         <code class="literal">python3 python</code>.
        </p></dd><dt><span class="term"><code class="envar">TCLSH</code></span></dt><dd><p>
         Tcl interpreter program.  This will be used to
         determine the dependencies for building PL/Tcl.
         If this is not set, the following are probed in this
         order: <code class="literal">tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85
         tclsh8.4 tclsh84</code>.
        </p></dd><dt><span class="term"><code class="envar">XML2_CONFIG</code></span></dt><dd><p>
         <code class="command">xml2-config</code> program used to locate the
         libxml2 installation
        </p></dd></dl></div><p>
    </p><p>
     Sometimes it is useful to add compiler flags after-the-fact to the set
     that were chosen by <code class="filename">configure</code>.  An important example is
     that <span class="application">gcc</span>'s <code class="option">-Werror</code> option cannot be included
     in the <code class="envar">CFLAGS</code> passed to <code class="filename">configure</code>, because
     it will break many of <code class="filename">configure</code>'s built-in tests.  To add
     such flags, include them in the <code class="envar">COPT</code> environment variable
     while running <code class="filename">make</code>.  The contents of <code class="envar">COPT</code>
     are added to both the <code class="envar">CFLAGS</code> and <code class="envar">LDFLAGS</code>
     options set up by <code class="filename">configure</code>.  For example, you could do
</p><pre class="screen">
<strong class="userinput"><code>make COPT='-Werror'</code></strong>
</pre><p>
     or
</p><pre class="screen">
<strong class="userinput"><code>export COPT='-Werror'</code></strong>
<strong class="userinput"><code>make</code></strong>
</pre><p>
    </p><div class="note"><h3 class="title">Note</h3><p>
      If using GCC, it is best to build with an optimization level of
      at least <code class="option">-O1</code>, because using no optimization
      (<code class="option">-O0</code>) disables some important compiler warnings (such
      as the use of uninitialized variables).  However, non-zero
      optimization levels can complicate debugging because stepping
      through compiled code will usually not match up one-to-one with
      source code lines.  If you get confused while trying to debug
      optimized code, recompile the specific files of interest with
      <code class="option">-O0</code>.  An easy way to do this is by passing an option
      to <span class="application">make</span>: <code class="command">make PROFILE=-O0 file.o</code>.
     </p><p>
      The <code class="envar">COPT</code> and <code class="envar">PROFILE</code> environment variables are
      actually handled identically by the <span class="productname">PostgreSQL</span>
      makefiles.  Which to use is a matter of preference, but a common habit
      among developers is to use <code class="envar">PROFILE</code> for one-time flag
      adjustments, while <code class="envar">COPT</code> might be kept set all the time.
     </p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="install-getsource.html" title="17.3. Getting the Source">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="installation.html" title="Chapter 17. Installation from Source Code">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="install-post.html" title="17.5. Post-Installation Setup">Next</a></td></tr><tr><td width="40%" align="left" valign="top">17.3. Getting the Source </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.6 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 17.5. Post-Installation Setup</td></tr></table></div></body></html>