Before launching make for a raw build, Postgres does some preprocessing with configure to setup the installation based on the environment and the different options given by user. If you don’t do that before trying a make, your build will fail with a critical hit of this type:
$ make
You need to run the 'configure' program first. See the file
'INSTALL' for installation instructions.
make: *** [all] Error 1

It is important to get familiar with this way of doing before actually working or developing Postgres, so be sure to go through the notes of this post to learn one thing or two, or even complete those notes with comments at the bottom.

This process is launched with ./configure, located at the root of the code path (it can even be called outside of code folder in the case of a vpath installation) and generated directly from configure.in using autoconf. A couple of scripts located in config/ containing additional methods not in autoconf are also used when generating ./configure from ./configure.in for many things:

  • Check presence of necessary library dependencies, some of them being optional (documentation) and others mandatory as core process need them (flex, bison)
  • Check availability of some languages (perl.m4, python.m4)
  • Test C-related functionalities (c-compiler.m4, c-library.m4)
  • etc.

Note that those files are included through ./aclocal.m4 like that:
m4_include([config/c-compiler.m4])
./aclocal.m4 is included itself automatically by autoconf as default.

If you are a PostgreSQL developer, you might at some point create a fork of Postgres for a private project. In this case, you should definitely modify your project to be a maximum consistent with Postgres itself in order to facilitate merges with future versions. The preprocessing Postgres uses has few chances to change but it usually includes fixes that may be platform dependent, so be sure to fetch the fixes when they are here. Here are also some advices about how you should manage a fork regarding configure:

  • Modify in priority configure.in and not configure. Generate configure based on your modifications of configure.in.
  • When extra preprocessing is needed, add your own m4 procedures in config/ in separate files, except if they overlap with existing checks, so as if a fix happens on Postgres itself you will be able to at least detect easily if there is a conflict with what your own stuff.
  • Declare additional m4 files in ./aclocal.m4
  • Similarly, do not forget to update Makefile.global.in when adding some new variables, and use them!

Here is a short example of how you could add your own .in file with some code dedicated to configure.in understandable by autoconf.
#Some initialization
AC_INIT([mypgfork], [1.0devel], [joe@example.com])
AC_CONFIG_AUX_DIR(config)
 
# Setup a default prefix
AC_PREFIX_DEFAULT(/usr/local/psql)
 
# Addition of my own customized file
AC_CONFIG_FILES([foo.cfg.in])
 
# Option to enforce optimize to a wanted flag
PGAC_ARG_BOOL(enable, optimize, no,
  [build with optimize symbol (-O2)])
 
# supply -g if --enable-super-debug
if test "$enable_optimize" = yes; then
 CFLAGS="-O2"
fi
 
# Substitute CFLAGS value in .in files
AC_SUBST(CFLAGS)
 
# Generate the output to files
AC_OUTPUT

In this case a file called foo.cfg *is* generated… Feel free to play with this piece of code btw.

For a vanilla Postgres build, two files that are used for code make and installation are generated: src/Makefile.global.in (containing all the variables that are environment-dependent as well as all the configuration parameters that user has set when launching ./configure) and GNUMakefile.in.

When generating Postgres from raw code, there are some options in ./configure you should absolutely know about if you are a developer:

  • –prefix to define the folder where library and binaries will be installed (bin, share, lib, include).
  • –enable-cassert, to enable assertions inside a build (avoid that for a production build, this option is good only or development).
  • –enable-debug, making the code to compile with -g in CFLAGS, the default being -O2 for production builds.
  • –enable-depend, to enable automatic dependency tracking, useful to recompile all the objects affected by a header modification.

There are also some options that you might need if you develop an application based on Postgres:

  • –with-perl, to enable PL/Perl on server side
  • –with-python, to enable PL/Python on server side
  • –with-blocksize, defining the default block size used by table pages, default begin 8kB. Note that using binaries compiled with a given block size is not compatible with a existing server that has been initialized with a different block size.

Do not forget to have a look at all the options available here, configure might have many things that remained hidden to you until now.

Each time a new OS is out, there are always cool new features you want to try and so you need absolutely to change the OS of your machine.
There are 2 ways to change the OS:

  • Upgrade the OS
  • Perform a clean install

Upgrading the OS is approximately OK for MacOS as each new release maintains a certain consistency in the system. But you have to keep in mind that each upgrade might let old pieces of files on your system and those rests might interact with the new features you got in.

Personally, I am more a fan of the solution consisting of making a new system entirely from scratch instead of upgrading as such rests from past OS versions can really become annoying in long term.
There are several ways to perform a clean install of MacOS, but one caught my attention by its facility (aimed for lazy guys, like the author of this article).

There is a small utility called Lion DiskMaker2, whose final version 2.0 is out since the beginning of August 2012, allowing you to create a bootable USB key or a disk that can be used to install a MacOS at machine start-up. This is honestly useful, as you can set up everything in a couple of clicks.

So, here are the main steps to perform the clean install based on this utility.

  1. Download MacOS Mountain Lion 10.8.x or Lion 10.7 from the Apple Store.
  2. Download and launch Lion DiskMaker2 to create a bootable drive.
  3. DiskMaker2 will automatically detect the systems that can be installed on your drive. Then follow the instructions.
  4. In case you wish to use a USB drive, use at least something with 8GB of space
  5. Once the bootable drive is made, shutdown your machine.
  6. While maintaining pushed the Option key on Keyboard, start your machine. You are redirected to the MacOS backup screen.
  7. There are several disks listed like RecoveryHD, select the bootable drive you just built (its name has been defined when creating it with DiskMaker2)
  8. Enter the disk utility and then delete completely the original disk of your machine
  9. Install the OS of your USB key and follow the steps to finish this clean install

This description might lack of precisions, but installing a new MacOS version is really intuitive. Be only sure to press the Option key when restarting your machine!

Woah, the latest version of your favorite Linux-based Operating System is available! This means that after installing it you will have at your disposition all the new fashioned applications and cool additional functionalities.

For beginners, the idea is to cut your hard disk into several pieces allowing each part to be erased or to be modified without touching anything on other parts. It permits to protect some parts of your hard disk.

However, you have to flush the entire disk of your machine just to install the new one. And it is a pain to put a backup of your 100 Go collection of music and movies on an external disk.
You spent also so much time setting your environment that doing it once again looks like a real waste of time. Everything you did to achieve an environment close to perfection will be wasted with your disk data…
Perhaps you feel that installing the latest OS is a pain just for that.

To avoid such a situation, you have the possibility to install your OS while preserving your personal data. How? Read the following lines.

Following screenshots are taken from Ubuntu 10.04 LTS installer. But it is possible to do similar operation with other distributions as well (Centos, Suze, Fedora…).
The machine used is a Virtual machine of 8 Go of Disk and 512 Mo of shared memory.

After initializing the installation with language choice, keyboard setting, or whatever, you will be asked to prepare your disk space.
For your case, choose the option Specify partitions manually.

You will be redirected to a new screen. This is the place when you will set your partitions. Now Create a new partition table on the disk you want.
In the case of my virtual machine, I have only one disk. It is also the case for most of laptops used.

You will see free space created from your hard disk (here 8 Go). This space is going to be cut into smaller pieces. So click on Add.

The first mounting point (the place in the directory folder where you base the access of this part of the disk), has to be what is called root, the lowest level. This is identified by “/”. Here we use 4 Go as disk space, feel free to enter a value adapted to your needs.
In the option “use as”, you can find a list of system files. For instance Windows uses NTFS partitions for its install. In our case, ext3 can make the deal. You can also use ext4 if you wish.
This partition is going to contain the programs you install and Operating System data. That’s why it is the primary partition.

Set up your partition as on the screen below. Then click on OK.

You will be back to the main screen, add a new partition with Add

The second partition is called swap. You have basically to put a memory space equal to 2 times the amount of shared memory of your system.
In our case, the virtual machine has 500 Mo, so we set 1000 Go. Check how much shared memory you have before setting it. After setting it click on OK.

You will be back to the main screen, so let’s go to set up the 3rd partition. Add a new partition.

This partition has to use “/home/” as a mounting point. In Linux based systems, home is the directory containing all the users data. So basically it is the partition of the disk that has to be kept independant and not erased when you reinstall a new OS.
For our case, the disk was empty, so a new partition existed. But if you reinstall a new OS on a disk already partition, don’t forget to associate “/home/” as a mounting point for this partition. This permits to keep user’s data safe with your environment settings also if you are reinstalling the same type of distribution as before (Always try to keep a gnome or KDE desktop!).
Use the rest of amount of memory for this partition.

OK, you are done, congratulations!

What you have to remember about the partitions:

  • One used as a root, mounted at “/”. This can be erased each time you want to make a fresh install.
  • Swap area, always two times equal to the shared memory of your machine. This can also be erased when you do a fresh install.
  • One partition mounted at “/home”. When you reinstall an OS, do not erase the data on it!
©2010-2013 Michael Paquier All content is ©Copyright of Otacoo.com 2010-2013. Privacy Policy - Terms of Use