Bug 1251210 - In configure.py, take AUTOCONF from the environment, if set there. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 26 Feb 2016 02:08:29 +0900
changeset 286108 5069f5724e096916b540aabe2d0c7b5ed00ccbef
parent 286107 29e1faddbf53b86bf94f7554fe30c3f03f715cfe
child 286109 0a02f7974084fb93344dab6f2d00d1e8edd55cf6
push id17909
push usercbook@mozilla.com
push dateTue, 01 Mar 2016 14:26:33 +0000
treeherderfx-team@5e6d66db9b05 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1251210
milestone47.0a1
Bug 1251210 - In configure.py, take AUTOCONF from the environment, if set there. r=ted At the same time, remove the (useless and wrong) check for AUTOCONF in old-configure.in (wrong because it very likely is picking autoconf > 2.5).
configure.py
js/src/old-configure.in
old-configure.in
--- a/configure.py
+++ b/configure.py
@@ -19,17 +19,25 @@ from which import which, WhichError
 # but the end goal being that the configure script would go away...
 shell = 'sh'
 if 'MOZILLABUILD' in os.environ:
     shell = os.environ['MOZILLABUILD'] + '/msys/bin/sh'
 if sys.platform == 'win32':
     shell = shell + '.exe'
 
 
+def is_absolute_or_relative(path):
+    if os.altsep and os.altsep in path:
+        return True
+    return os.sep in path
+
+
 def find_program(file):
+    if is_absolute_or_relative(file):
+        return os.path.abspath(file) if os.path.isfile(file) else None
     try:
         return which(file)
     except WhichError:
         return None
 
 
 def autoconf_refresh(configure):
     if os.path.exists(configure):
@@ -40,29 +48,34 @@ def autoconf_refresh(configure):
              os.path.join(os.path.dirname(configure), 'aclocal.m4')),
             glob.iglob(aclocal),
         ):
             if os.path.getmtime(input) > mtime:
                 break
         else:
             return
 
-    for ac in ('autoconf-2.13', 'autoconf2.13', 'autoconf213'):
-        autoconf = find_program(ac)
-        if autoconf:
-            break
+    for ac in (os.environ.get('AUTOCONF'), 'autoconf-2.13', 'autoconf2.13',
+               'autoconf213'):
+        if ac:
+            autoconf = find_program(ac)
+            if autoconf:
+                break
     else:
         fink = find_program('fink')
         if fink:
             autoconf = os.path.normpath(os.path.join(
                 fink, '..', '..', 'lib', 'autoconf2.13', 'bin', 'autoconf'))
 
     if not autoconf:
         raise RuntimeError('Could not find autoconf 2.13')
 
+    # Add or adjust AUTOCONF for subprocesses, especially the js/src configure
+    os.environ['AUTOCONF'] = autoconf
+
     print('Refreshing %s' % configure, file=sys.stderr)
 
     with open(configure, 'wb') as fh:
         subprocess.check_call([
             shell, autoconf, '--localdir=%s' % os.path.dirname(configure),
             configure + '.in'], stdout=fh)
 
 
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -565,17 +565,16 @@ fi
 MOZ_PYTHON
 
 if test -z "$COMPILE_ENVIRONMENT"; then
     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
 fi
 AC_SUBST(NSINSTALL_BIN)
 
 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
-MOZ_PATH_PROG(AUTOCONF, autoconf, :)
 MOZ_PATH_PROG(XARGS, xargs)
 if test -z "$XARGS" -o "$XARGS" = ":"; then
     AC_MSG_ERROR([xargs not found in \$PATH .])
 fi
 
 if test "$COMPILE_ENVIRONMENT"; then
 
 dnl ========================================================
--- a/old-configure.in
+++ b/old-configure.in
@@ -777,17 +777,16 @@ else
 fi
 
 if test -z "$COMPILE_ENVIRONMENT"; then
     NSINSTALL_BIN='$(PYTHON) $(MOZILLA_DIR)/config/nsinstall.py'
 fi
 AC_SUBST(NSINSTALL_BIN)
 
 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
-MOZ_PATH_PROG(AUTOCONF, autoconf, :)
 MOZ_PATH_PROGS(UNZIP, unzip)
 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
     AC_MSG_ERROR([unzip not found in \$PATH])
 fi
 MOZ_PATH_PROGS(ZIP, zip)
 if test -z "$ZIP" -o "$ZIP" = ":"; then
     AC_MSG_ERROR([zip not found in \$PATH])
 fi