-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New script generate-autotools. Documentatiion improved.
- Loading branch information
Showing
6 changed files
with
166 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
._* | ||
.bzr | ||
autom4te.cache | ||
autotools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
## Autoconf - an introduction | ||
|
||
Autoconf relies upon a number of staged (chained-together) files. Input files are autogenerated from templates, some are edited whilst others are left untouched. The relationships are somewhat complex. For a better understanding of the role of these files consult: | ||
|
||
[Linux Self Help - Autoconf overview](http://www.linuxselfhelp.com/gnu/autoconf/html_chapter/autoconf_3.html), | ||
|
||
[Autoconf Book - the configure process](http://sourceware.org/autobook/autobook/autobook_279.html#SEC279) | ||
|
||
[Autoconf Book - acinclude.m4 input file](http://sourceware.org/autobook/autobook/autobook_69.html#SEC69) | ||
|
||
## Buildconf | ||
|
||
The `buildconf` script is used to re-generate `configure` from the autoconf macro files. Without any arguments it will use the autoconf tools found on your default path. But before you run buildconf, you must... | ||
|
||
## Generate-autotools | ||
|
||
There's not much to say about installing all these programs. The script `generate-autotools` creates a subfolder called `autotools` within the fpm tree. It performs the next 3 steps for us. | ||
|
||
#### Install autoconf version 2.59 | ||
|
||
There are many versions of autoconf, and we must use _exactly_ the right version, no greater or no less. Php-fpm source tree was generated with autoconf 2.59. To re-generate `configure` script from the macro files therefore requires autoconf 2.59. | ||
|
||
`autoconf --version` will tell you which autoconf you have installed. If your OS is running some other version of autoconf (very likely), then we must install the 2.59 version seperately, into its own directory. | ||
|
||
export AC_VER=`head ./configure | grep -i autoconf | sed -e 's/.*toconf //' -e 's/ .*//' -e 's/\.$//'` | ||
cd /usr/local/src | ||
wget http://ftp.gnu.org/gnu/autoconf/autoconf-$AC_VER.tar.gz | ||
tar -zxvf autoconf-$AC_VER.tar.gz | ||
cd autoconf-$AC_VER/ | ||
|
||
Specify the install path with flag --prefix=[DIR] to configure. After all, it would be a bad idea to overwrie the one we already have installed, right? You can use a subdirectory of `/usr/local/src`, your home folder, or perhaps `/opt`. In this example we are going for `/usr/local/src/fpm-autotools` | ||
|
||
mkdir -p /usr/local/src/fpm-autotools | ||
./configure --prefix=/usr/local/src/fpm-autotools | ||
make && make install | ||
|
||
#### Install automake | ||
|
||
export AM_VER=`head ./Makefile.in | grep -i automake | sed -e 's/.*tomake //' -e 's/ .*//' -e 's/\.$//'` | ||
wget http://ftp.gnu.org/gnu/automake/automake-$AM_VER.tar.gz | ||
tar -zxvf automake-$AM_VER.tar.gz | ||
cd automake-$AM_VER/ | ||
./configure --prefix=/usr/local/src/fpm-autotools | ||
make && make install | ||
|
||
#### Install libtool | ||
|
||
Libtool is autoconf's partner in crime, and will also be needed. | ||
|
||
export LT_VER=`head -50 ./ltmain.sh | grep "VERSION=" | sed -e 's/^VERSION=//'` | ||
wget http://ftp.gnu.org/gnu/libtool/libtool-$LT_VER.tar.gz | ||
tar -zxvf libtool-$LT_VER.tar.gz | ||
cd libtool-$LT_VER/ | ||
./configure --prefix=/usr/local/src/fpm-autotools | ||
make && make install | ||
|
||
## Edit macro files, acinclude.m4 | ||
|
||
The first file in our daisy-chain is `acinclude.m4`, which is an m4 marcro file. The layout is divided into sections, such as `AC_DEFUN([AC_FPM_PHP],` and `AC_DEFUN([AC_FPM_LIBEVENT],`. As it depends upon no others it can be safely edited, without risk of breaking the other makefiles and such. | ||
|
||
## Regenerate ./configure | ||
|
||
After editing a macro file, we can then re-generate `./configure` with the `buildconf` script. | ||
|
||
./buildconf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,53 @@ | ||
#! /bin/sh | ||
# | ||
# buildconf - regenerate configure script from macros. | ||
# Usage: ./buildconf "/path/to/autoconf" "/path/to/libtool" | ||
# | ||
# aclocal | ||
# libtoolize --force --copy | ||
# autoheader | ||
# automake --foreign --copy --add-missing | ||
# autoconf | ||
# | ||
|
||
aclocal | ||
libtoolize --force --copy | ||
autoheader | ||
automake --foreign --copy --add-missing | ||
autoconf | ||
# Determine if Autoconf tools are the correct version, needed to re-generate configure | ||
AC_VER=`head ./configure | grep -i autoconf | sed -e 's/.*toconf //' -e 's/ .*//' -e 's/\.$//'` | ||
AM_VER=`head ./Makefile.in | grep -i automake | sed -e 's/.*tomake //' -e 's/ .*//' -e 's/\.$//'` | ||
LT_VER="1.4.3" | ||
|
||
# deps="autoconf-$AC_VER automake-$AM_VER libtoolize-$LT_VER" | ||
deps="autoconf-$AC_VER automake-$AM_VER" | ||
|
||
AC_PATH="$1" | ||
if [ ! "$AC_PATH" ]; then AC_PATH="$PWD/autotools"; fi | ||
if [ ! -d "$AC_PATH" ]; then ./generate-autotools; fi | ||
|
||
if [ ! "`basename $AC_PATH`" = "bin" ]; then AC_PATH="$AC_PATH/bin"; fi | ||
|
||
if [ ! "$AC_PATH" ]; then | ||
printf "Buildconf requires autoconf, automake and libtool. See autoconf.markdown for details.\n" | ||
printf "Usage: ./buildconf \"/path/to/autotools\".\n" | ||
exit 1 | ||
fi | ||
|
||
for prg_ver in $deps; do | ||
prg=`echo "$prg_ver" | sed -e 's/-.*$//'` | ||
if [ ! -x "$AC_PATH/$prg" ]; then | ||
printf "Error: $prg not found. Searched for executable '$prg' in $AC_PATH.\n" | ||
exit 1 | ||
fi | ||
ver=`echo "$prg_ver" | sed -e 's/^.*-//'` | ||
INSTALLED_VER=`$AC_PATH/$prg --version | grep -i $prg | sed -e 's/.* //'` | ||
if [ ! "$INSTALLED_VER" = "$ver" ]; then | ||
printf "Error: Autoconf version mismatch. Buildconf requires $prg version $ver.\n" | ||
printf "You have $prg version $INSTALLED_VER. See autoconf.markdown for details.\n" | ||
exit 1 | ||
fi | ||
done | ||
|
||
# Checks passed, regenerate ./configure and associcated files | ||
$AC_PATH/aclocal | ||
$AC_PATH/libtoolize --force --copy | ||
$AC_PATH/autoheader | ||
$AC_PATH/automake --foreign --copy --add-missing | ||
$AC_PATH/autoconf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /bin/sh | ||
# | ||
# generate-autotools - Determine the correct versions for autoconf, automake, libtool. | ||
# Download and install them into ./autotools | ||
# | ||
# Usage: ./generate-autotools | ||
# | ||
|
||
BASEDIR="$PWD" | ||
AUTOTOOLS="$BASEDIR/autotools" | ||
|
||
# Create autotools directory | ||
mkdir -p "$AUTOTOOLS" | ||
|
||
## Install autoconf | ||
AC_VER=`head ./configure | grep -i autoconf | sed -e 's/.*toconf //' -e 's/ .*//' -e 's/\.$//'` | ||
wget http://ftp.gnu.org/gnu/autoconf/autoconf-$AC_VER.tar.gz | ||
tar -zxvf autoconf-$AC_VER.tar.gz | ||
cd autoconf-$AC_VER/ | ||
./configure --prefix="$AUTOTOOLS" | ||
make && make install | ||
cd .. | ||
rm -Rf autoconf-$AC_VER* | ||
|
||
## Install automake | ||
AM_VER=`head ./Makefile.in | grep -i automake | sed -e 's/.*tomake //' -e 's/ .*//' -e 's/\.$//'` | ||
wget http://ftp.gnu.org/gnu/automake/automake-$AM_VER.tar.gz | ||
tar -zxvf automake-$AM_VER.tar.gz | ||
cd automake-$AM_VER/ | ||
./configure --prefix="$AUTOTOOLS" | ||
make && make install | ||
cd .. | ||
rm -Rf automake-$AM_VER* | ||
|
||
## Install libtool | ||
LT_VER=`head -50 ./ltmain.sh | grep "VERSION=" | sed -e 's/^VERSION=//'` | ||
wget http://ftp.gnu.org/gnu/libtool/libtool-$LT_VER.tar.gz | ||
tar -zxvf libtool-$LT_VER.tar.gz | ||
cd libtool-$LT_VER/ | ||
./configure --prefix="$AUTOTOOLS" | ||
make && make install | ||
cd .. | ||
rm -Rf libtool-$LT_VER* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters