| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | rm -fr autom4te.cache |
|---|
| 4 | |
|---|
| 5 | PACKAGE_RELEASE="" |
|---|
| 6 | NEXUS_VERSION="" |
|---|
| 7 | NEXUS_RELEASE="" |
|---|
| 8 | while getopts "p:r:v:" opt; do |
|---|
| 9 | case $opt in |
|---|
| 10 | p) |
|---|
| 11 | PACKAGE_RELEASE="$OPTARG" |
|---|
| 12 | ;; |
|---|
| 13 | v) |
|---|
| 14 | NEXUS_VERSION="$OPTARG" |
|---|
| 15 | ;; |
|---|
| 16 | r) |
|---|
| 17 | NEXUS_RELEASE="$OPTARG" |
|---|
| 18 | ;; |
|---|
| 19 | \?) |
|---|
| 20 | echo "Invalid option: -$OPTARG" >&2 |
|---|
| 21 | ;; |
|---|
| 22 | esac |
|---|
| 23 | done |
|---|
| 24 | if test ! -z "$PACKAGE_RELEASE"; then |
|---|
| 25 | echo "Setting package release to $PACKAGE_RELEASE" |
|---|
| 26 | mv configure.ac configure.ac.$$ |
|---|
| 27 | sed -e "s/^m4_define.*PACKAGE_RELEASE.*/m4_define\([PACKAGE_RELEASE],[$PACKAGE_RELEASE]\)/" < configure.ac.$$ > configure.ac |
|---|
| 28 | rm -f configure.ac.$$ |
|---|
| 29 | fi |
|---|
| 30 | if test ! -z "$NEXUS_VERSION"; then |
|---|
| 31 | echo "Setting NeXus version to $NEXUS_VERSION" |
|---|
| 32 | mv configure.ac configure.ac.$$ |
|---|
| 33 | sed -e "s/^m4_define.*NEXUS_VERSION.*/m4_define\([NEXUS_VERSION],[$NEXUS_VERSION]\)/" < configure.ac.$$ > configure.ac |
|---|
| 34 | rm -f configure.ac.$$ |
|---|
| 35 | fi |
|---|
| 36 | if test ! -z "$NEXUS_RELEASE"; then |
|---|
| 37 | echo "Setting NeXus release to $NEXUS_RELEASE" |
|---|
| 38 | mv configure.ac configure.ac.$$ |
|---|
| 39 | sed -e "s/^m4_define.*NEXUS_RELEASE.*/m4_define\([NEXUS_RELEASE],[$NEXUS_RELEASE]\)/" < configure.ac.$$ > configure.ac |
|---|
| 40 | rm -f configure.ac.$$ |
|---|
| 41 | fi |
|---|
| 42 | |
|---|
| 43 | for libtoolize in glibtoolize libtoolize ; do |
|---|
| 44 | LIBTOOLIZE=`which $libtoolize 2>/dev/null` |
|---|
| 45 | if test "$LIBTOOLIZE" ; then |
|---|
| 46 | break; |
|---|
| 47 | fi |
|---|
| 48 | done |
|---|
| 49 | LIBTOOLIZE="$libtoolize --force --copy --automake" |
|---|
| 50 | |
|---|
| 51 | # set up environment variables with the correct |
|---|
| 52 | # version of autoconf and automake - this also needs |
|---|
| 53 | # to be done in configure.ac to maintain consistancy |
|---|
| 54 | . ./autoversion.sh |
|---|
| 55 | |
|---|
| 56 | touch AUTHORS NEWS README |
|---|
| 57 | rm -f ChangeLog |
|---|
| 58 | |
|---|
| 59 | # Discover what version of autoconf we are using. |
|---|
| 60 | autoconfversion=`$AUTOCONF --version | head -n 1` |
|---|
| 61 | automakeversion=`$AUTOMAKE --version | head -n 1` |
|---|
| 62 | libtoolversion=`$LIBTOOLIZE --version | head -n 1` |
|---|
| 63 | |
|---|
| 64 | echo "Using $autoconfversion" |
|---|
| 65 | echo "Using $automakeversion" |
|---|
| 66 | echo "Using $libtoolversion" |
|---|
| 67 | case $autoconfversion in |
|---|
| 68 | *2.6*) |
|---|
| 69 | ;; |
|---|
| 70 | *2.7*) |
|---|
| 71 | ;; |
|---|
| 72 | *) |
|---|
| 73 | echo "This autoconf version is not supported by NeXus." |
|---|
| 74 | echo "NeXus only supports autoconf 2.61 and above" |
|---|
| 75 | echo "You may download it from ftp://ftp.gnu.org/gnu/autoconf" |
|---|
| 76 | exit |
|---|
| 77 | ;; |
|---|
| 78 | esac |
|---|
| 79 | |
|---|
| 80 | case $automakeversion in |
|---|
| 81 | *1.[4-9]*) |
|---|
| 82 | ;; |
|---|
| 83 | *1.1[0-9]*) |
|---|
| 84 | ;; |
|---|
| 85 | *) |
|---|
| 86 | echo "This automake version is not supported by NeXus." |
|---|
| 87 | echo "NeXus only supports automake 1.4 and above" |
|---|
| 88 | echo "You may download it from ftp://ftp.gnu.org/gnu/automake" |
|---|
| 89 | exit |
|---|
| 90 | ;; |
|---|
| 91 | esac |
|---|
| 92 | |
|---|
| 93 | case $libtoolversion in |
|---|
| 94 | *1.[456]*) |
|---|
| 95 | ;; |
|---|
| 96 | *[2-9].*) |
|---|
| 97 | ;; |
|---|
| 98 | *) |
|---|
| 99 | echo "This libtool version is not supported by NeXus." |
|---|
| 100 | echo "NeXus only supports libtool 1.4 and above" |
|---|
| 101 | echo "You may download it from ftp://ftp.gnu.org/gnu/libtool" |
|---|
| 102 | exit |
|---|
| 103 | ;; |
|---|
| 104 | esac |
|---|
| 105 | |
|---|
| 106 | echo -n "Locating GNU m4... " |
|---|
| 107 | GNUM4= |
|---|
| 108 | for prog in $M4 gm4 gnum4 m4; do |
|---|
| 109 | # continue if $prog generates error (e.g. does not exist) |
|---|
| 110 | ( $prog --version ) < /dev/null > /dev/null 2>&1 |
|---|
| 111 | if test $? -ne 0 ; then continue; fi |
|---|
| 112 | |
|---|
| 113 | # /dev/null input prevents a hang of the script for some m4 compilers (e.g. on FreeBSD) |
|---|
| 114 | case `$prog --version < /dev/null 2>&1` in |
|---|
| 115 | *GNU*) GNUM4=$prog |
|---|
| 116 | break ;; |
|---|
| 117 | esac |
|---|
| 118 | done |
|---|
| 119 | if test x$GNUM4 = x ; then |
|---|
| 120 | echo "not found." |
|---|
| 121 | exit |
|---|
| 122 | else |
|---|
| 123 | echo `which $GNUM4` |
|---|
| 124 | fi |
|---|
| 125 | |
|---|
| 126 | # |
|---|
| 127 | if { test ! -d config ; } ; then |
|---|
| 128 | mkdir config ; |
|---|
| 129 | else |
|---|
| 130 | rm -rf config/* ; |
|---|
| 131 | fi |
|---|
| 132 | |
|---|
| 133 | # Prepare the use of libtool |
|---|
| 134 | if ( $LIBTOOLIZE --version ) < /dev/null > /dev/null 2>&1 ; then |
|---|
| 135 | echo "Preparing the use of libtool ..." |
|---|
| 136 | $LIBTOOLIZE |
|---|
| 137 | if { test -r ltmain.sh ; } ; then mv ltmain.sh config/ ; fi |
|---|
| 138 | echo "done." |
|---|
| 139 | else |
|---|
| 140 | echo "libtoolize not found -- aborting" |
|---|
| 141 | exit |
|---|
| 142 | fi |
|---|
| 143 | |
|---|
| 144 | # Generate the Makefiles and configure files |
|---|
| 145 | if ( $ACLOCAL --version ) < /dev/null > /dev/null 2>&1; then |
|---|
| 146 | echo "Building macros..." |
|---|
| 147 | $ACLOCAL |
|---|
| 148 | echo "done." |
|---|
| 149 | else |
|---|
| 150 | echo "aclocal not found -- aborting" |
|---|
| 151 | exit |
|---|
| 152 | fi |
|---|
| 153 | |
|---|
| 154 | if ( $AUTOHEADER --version ) < /dev/null > /dev/null 2>&1; then |
|---|
| 155 | echo "Building config header template..." |
|---|
| 156 | $AUTOHEADER |
|---|
| 157 | echo "done." |
|---|
| 158 | else |
|---|
| 159 | echo "autoheader not found -- aborting" |
|---|
| 160 | exit |
|---|
| 161 | fi |
|---|
| 162 | |
|---|
| 163 | if ( $AUTOMAKE --version ) < /dev/null > /dev/null 2>&1; then |
|---|
| 164 | echo "Building Makefile templates..." |
|---|
| 165 | $AUTOMAKE |
|---|
| 166 | echo "done." |
|---|
| 167 | else |
|---|
| 168 | echo "automake not found -- aborting" |
|---|
| 169 | exit |
|---|
| 170 | fi |
|---|
| 171 | |
|---|
| 172 | if ( $AUTOCONF --version ) < /dev/null > /dev/null 2>&1; then |
|---|
| 173 | echo "Building configure..." |
|---|
| 174 | $AUTOCONF |
|---|
| 175 | echo "done." |
|---|
| 176 | else |
|---|
| 177 | echo "autoconf not found -- aborting" |
|---|
| 178 | exit |
|---|
| 179 | fi |
|---|
| 180 | |
|---|