Build on macosx.
[platform/upstream/rpm.git] / autogen.sh
1 #!/bin/sh
2
3 export CFLAGS
4 export LDFLAGS
5
6 LTV="libtoolize (GNU libtool) 1.5.10"
7 ACV="autoconf (GNU Autoconf) 2.59"
8 AMV="automake (GNU automake) 1.9.3"
9 USAGE="
10 This script documents the versions of the tools I'm using to build rpm:
11         libtool-1.5.10
12         autoconf-2.59
13         automake-1.9.3
14 Simply edit this script to change the libtool/autoconf/automake versions
15 checked if you need to, as rpm should build (and has built) with all
16 recent versions of libtool/autoconf/automake.
17 "
18
19 libtoolize=`which glibtoolize 2>/dev/null`
20 case $libtoolize in
21 /*) ;;
22 *)  libtoolize=`which libtoolize 2>/dev/null`
23     case $libtoolize in
24     /*) ;;
25     *)  libtoolize=libtoolize
26     esac
27 esac
28
29 [ "`$libtoolize --version | head -1`" != "$LTV" ] && echo "$USAGE" && exit 1
30 [ "`autoconf --version | head -1`" != "$ACV" ] && echo "$USAGE" && exit 1
31 [ "`automake --version | head -1 | sed -e 's/1\.4[a-z]/1.4/'`" != "$AMV" ] && echo "$USAGE" # && exit 1
32
33 if [ X"$@" = X  -a "X`uname -s`" = "XDarwin" -a -d /opt/local ]; then
34     export myprefix=/opt/local
35     export CPPFLAGS="-I${myprefix}/include"
36 fi
37
38 if [ -d popt ]; then
39     (echo "--- popt"; cd popt; ./autogen.sh --noconfigure "$@")
40 fi
41 if [ -d zlib ]; then
42     (echo "--- zlib"; cd zlib; ./autogen.sh --noconfigure "$@")
43 fi
44 if [ -d beecrypt ]; then
45     (echo "--- beecrypt"; cd beecrypt; ./autogen.sh --noconfigure "$@")
46 fi
47 if [ -d elfutils ]; then
48     (echo "--- elfutils"; cd elfutils; ./autogen.sh --noconfigure "$@")
49 fi
50 if [ -d file ]; then
51     (echo "--- file"; cd file; ./autogen.sh --noconfigure "$@")
52 fi
53
54 echo "--- rpm"
55 $libtoolize --copy --force
56 aclocal
57 autoheader
58 automake -a -c
59 autoconf
60
61 if [ "$1" = "--noconfigure" ]; then 
62     exit 0;
63 fi
64
65 if [ X"$@" = X  -a "X`uname -s`" = "XLinux" ]; then
66     if [ -d /usr/share/man ]; then
67         mandir=/usr/share/man
68         infodir=/usr/share/info
69     else
70         mandir=/usr/man
71         infodir=/usr/info
72     fi
73     if [ -d /usr/lib/nptl ]; then
74         enable_posixmutexes="--enable-posixmutexes"
75     else
76         enable_posixmutexes=
77     fi
78     ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=${infodir} --mandir=${mandir} ${enable_posixmutexes} "$@"
79 else
80     ./configure --prefix=${myprefix} "$@"
81 fi