| 1 | #!/bin/sh |
| 2 | # |
| 3 | #set -x |
| 4 | acdir="" |
| 5 | |
| 6 | # can't be made default - some automake will fail here - using only privately |
| 7 | # for snapshot creation |
| 8 | #use_copy="--copy" |
| 9 | use_copy="" |
| 10 | forceon="" |
| 11 | removeconf="" |
| 12 | |
| 13 | while [ $# -gt 0 ]; do |
| 14 | case "$1" in |
| 15 | --acdir) |
| 16 | acdir=$2 |
| 17 | shift |
| 18 | ;; |
| 19 | --force) |
| 20 | forceon="force" |
| 21 | shift |
| 22 | ;; |
| 23 | --copy) |
| 24 | use_copy="--copy" |
| 25 | shift |
| 26 | ;; |
| 27 | --linkac) |
| 28 | test -h configure.ac || ln -sf configure.in configure.ac |
| 29 | ;; |
| 30 | --remconf) |
| 31 | removeconf="yes" |
| 32 | ;; |
| 33 | -h|--help) |
| 34 | echo "Usage: $0 [OPTIONS]" |
| 35 | echo |
| 36 | echo "Run all necesary programs to create configure files" |
| 37 | echo |
| 38 | echo "Options:" |
| 39 | echo " --help print this help, then exit" |
| 40 | echo " --acdir pass this parameter to aclocal (see aclocal --help for more details)" |
| 41 | echo " --force ignore FATAL error message" |
| 42 | echo " --linkac create symbolic link configure.in ->configure.ac" |
| 43 | echo " --copy use option --copy with automake and libtoolize" |
| 44 | echo " --remconf remove configure script (forcing its recreation)" |
| 45 | exit 0 |
| 46 | ;; |
| 47 | *) |
| 48 | echo "WARNING: unrecognized option: $1 (see --help)" |
| 49 | ;; |
| 50 | esac |
| 51 | shift |
| 52 | done |
| 53 | |
| 54 | echo "Generating build information..." |
| 55 | |
| 56 | # Touch the timestamps on all the files since CVS messes them up |
| 57 | #directory=`dirname $0` |
| 58 | #touch $directory/configure.in |
| 59 | #touch configure.in |
| 60 | |
| 61 | |
| 62 | # Debian unstable allows to have several different versions of autoconf |
| 63 | # in the one system |
| 64 | |
| 65 | use_automake=automake |
| 66 | use_aclocal=aclocal |
| 67 | use_libtool=libtool |
| 68 | use_autoconf=autoconf |
| 69 | use_autoheader=autoheader |
| 70 | |
| 71 | # some freebsd compatibility lookups for prefered versions |
| 72 | findver=14 |
| 73 | export findver |
| 74 | ( which automake${findver} 2>/dev/null | grep -q "^/" ) && use_automake=`which automake${findver}` |
| 75 | ( which aclocal${findver} 2>/dev/null | grep -q "^/" ) && use_aclocal=`which aclocal${findver}` |
| 76 | findver=213 |
| 77 | ( which autoconf${findver} 2>/dev/null | grep -q "^/" ) && use_autoconf=`which autoconf${findver}` |
| 78 | ( which autoheader${findver} 2>/dev/null | grep -q "^/" ) && use_autoheader=`which autoheader${findver}` |
| 79 | unset findver |
| 80 | |
| 81 | # I think links are now OK |
| 82 | # Debian will use 2.50 for configure.ac files automaticaly |
| 83 | #( which autoconf2.50 2>/dev/null | grep -q "^/" ) && use_autoconf=autoconf2.50 |
| 84 | #( which autoheader2.50 2>/dev/null | grep -q "^/" ) && use_autoheader=autoheader2.50 |
| 85 | |
| 86 | DIE=0 |
| 87 | |
| 88 | ($use_autoconf --version) < /dev/null > /dev/null 2>&1 || { |
| 89 | echo |
| 90 | echo "**Error**: You must have \`autoconf' installed ." |
| 91 | DIE=1 |
| 92 | } |
| 93 | |
| 94 | ($use_automake --version) < /dev/null > /dev/null 2>&1 || { |
| 95 | echo |
| 96 | echo "**Error**: You must have \`automake' installed." |
| 97 | DIE=1 |
| 98 | NO_AUTOMAKE=yes |
| 99 | } |
| 100 | |
| 101 | ($use_aclocal --version) < /dev/null > /dev/null 2>&1 || { |
| 102 | echo |
| 103 | echo "**Error**: Missing \`aclocal'." |
| 104 | DIE=1 |
| 105 | } |
| 106 | |
| 107 | ($use_libtool --version) < /dev/null > /dev/null 2>&1 || { |
| 108 | echo |
| 109 | echo "**Error**: You must have \`libtool' installed." |
| 110 | DIE=1 |
| 111 | } |
| 112 | |
| 113 | if test -z "$acdir" -a -d /usr/local/share/aclocal ; then |
| 114 | if !(ls -ld /usr/local/share | grep /usr/share > /dev/null 2>/dev/null ); then |
| 115 | if test "`$use_aclocal --print-ac-dir`" != "/usr/local/share/aclocal" ; then |
| 116 | INCLUDESTRING="-I /usr/local/share/aclocal" |
| 117 | # ACLOCAL_FLAGS=`echo $ACLOCAL_FLAGS | sed s/-I\ \/z//` |
| 118 | ACLOCAL_FLAGS="-I /usr/local/share/aclocal $ACLOCAL_FLAGS" |
| 119 | ACLOCAL_MAINDIR=`$use_aclocal --print-ac-dir` |
| 120 | for FILENAME in `ls $ACLOCAL_MAINDIR`; do |
| 121 | if test -e /usr/local/share/aclocal/$FILENAME ; then |
| 122 | echo "FATAL: both $ACLOCAL_MAINDIR/$FILENAME and /usr/local/share/aclocal/$FILENAME exist; you must manually delete one of them" |
| 123 | echo "or use: autogen.sh --acdir /usr/share/aclocal" |
| 124 | if test -z "$forceon" ; then |
| 125 | echo "if you still want to continue - use force option" |
| 126 | echo "but do not expect it will work! - fix the problem" |
| 127 | exit 0; |
| 128 | fi |
| 129 | fi |
| 130 | done |
| 131 | fi |
| 132 | else |
| 133 | echo /usr/local/share is link to /usr/share |
| 134 | fi |
| 135 | fi |
| 136 | |
| 137 | # Regenerate configuration files |
| 138 | ok=0 |
| 139 | |
| 140 | rm -f aclocal.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh |
| 141 | |
| 142 | # test if configure.in is newer the created configure script |
| 143 | testfornewer() |
| 144 | { |
| 145 | test $1.in -nt $1 -o -n "$removeconf" && rm -f $1; |
| 146 | } |
| 147 | |
| 148 | testfornewer libmmxnow/configure |
| 149 | testfornewer plugins/libmad/libmad/configure |
| 150 | |
| 151 | echo "Running libtoolize..." |
| 152 | libtoolize --force $use_copy > /dev/null || ok=1 |
| 153 | if test -z "$acdir" ; then |
| 154 | echo "Running aclocal $ACLOCAL_FLAGS..." |
| 155 | $use_aclocal $ACLOCAL_FLAGS || ok=1 |
| 156 | else |
| 157 | echo "Running aclocal with forced acdir: $acdir" |
| 158 | $use_aclocal --acdir=$acdir || ok=1 |
| 159 | fi |
| 160 | # echo "Running autoupdate..." |
| 161 | # autoupdate || ok=1 |
| 162 | echo "Running autoheader..." |
| 163 | $use_autoheader || ok=1 |
| 164 | echo "Running autoconf..." |
| 165 | $use_autoconf || ok=1 |
| 166 | echo "Running automake..." |
| 167 | $use_automake $use_copy --add-missing --foreign || ok=1 |
| 168 | |
| 169 | if [ "${ok}" -eq 0 ]; then |
| 170 | echo "Now you are ready to run ./configure" |
| 171 | #echo " for optimal performance use with this option --cache-file=config.cache" |
| 172 | else |
| 173 | echo "Problems detected. Please investigate." |
| 174 | echo "Suggested version of used programs (try to use them)" |
| 175 | echo " libtool 1.4.1 or better" |
| 176 | echo " automake 1.4 or better" |
| 177 | echo " autoconf 2.52 or better" |
| 178 | echo "Your installed version:" |
| 179 | $use_libtool --version | head -1 |
| 180 | $use_automake --version | head -1 |
| 181 | $use_autoconf --version | head -1 |
| 182 | echo "Report aclocal = " |
| 183 | $use_aclocal --print-ac-dir |
| 184 | echo "Please report your problem on [email protected]" |
| 185 | echo "with this log of build process together with system description." |
| 186 | fi |