hooks.m4 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. dnl This Source Code Form is subject to the terms of the Mozilla Public
  2. dnl License, v. 2.0. If a copy of the MPL was not distributed with this
  3. dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. dnl Wrap AC_INIT_PREPARE to add the above trap.
  5. define([_MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
  6. define([AC_INIT_PREPARE],
  7. [_MOZ_AC_INIT_PREPARE($1)
  8. test "x$prefix" = xNONE && prefix=$ac_default_prefix
  9. # Let make expand exec_prefix.
  10. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  11. > subconfigures
  12. > skip_subconfigures
  13. ])
  14. define([AC_OUTPUT_SUBDIRS],
  15. [for moz_config_dir in $1; do
  16. _CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
  17. case "$moz_config_dir" in
  18. *:*)
  19. objdir=$(echo $moz_config_dir | awk -F: '{print [$]2}')
  20. ;;
  21. *)
  22. objdir=$moz_config_dir
  23. ;;
  24. esac
  25. dnl Because config.status, storing AC_SUBSTs, is written before any
  26. dnl subconfigure runs, we need to use a file. Moreover, some subconfigures
  27. dnl are started from a subshell, and variable modifications from a subshell
  28. dnl wouldn't be preserved.
  29. echo $objdir >> subconfigures
  30. dumpenv="true | "
  31. case "$host" in
  32. *-mingw*)
  33. _CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL)
  34. if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then
  35. _CONFIG_SHELL="${_CONFIG_SHELL}.exe"
  36. fi
  37. dnl Yes, this is horrible. But since msys doesn't preserve environment
  38. dnl variables and command line arguments as they are when transitioning
  39. dnl from msys (this script) to python (below), we have to resort to hacks,
  40. dnl storing the environment and command line arguments from a msys process
  41. dnl (perl), and reading it from python.
  42. dumpenv="$PERL $_topsrcdir/build/win32/dumpenv4python.pl $ac_configure_args | "
  43. ;;
  44. esac
  45. eval $dumpenv $PYTHON $_topsrcdir/build/subconfigure.py --prepare "$srcdir" "$moz_config_dir" "$_CONFIG_SHELL" $ac_configure_args ifelse($2,,,--cache-file="$2")
  46. dnl Actual subconfigure execution happens in MOZ_RUN_CONFIG_STATUS
  47. done
  48. ])
  49. define([AC_OUTPUT_SUBDIRS_NOW],
  50. [
  51. for moz_config_dir_ in $1; do
  52. AC_OUTPUT_SUBDIRS($moz_config_dir_,$2)
  53. tail -1 subconfigures >> skip_subconfigures
  54. MOZ_RUN_SUBCONFIGURES(`tail -1 skip_subconfigures`)
  55. done
  56. ])
  57. define([MOZ_RUN_SUBCONFIGURES],
  58. [dnl Execute subconfigure, unless --no-recursion was passed to configure.
  59. if test "$no_recursion" != yes; then
  60. trap '' EXIT
  61. if ! $PYTHON $_topsrcdir/build/subconfigure.py $1; then
  62. exit 1
  63. fi
  64. fi
  65. ])
  66. define([MOZ_RUN_ALL_SUBCONFIGURES],[
  67. MOZ_RUN_SUBCONFIGURES([--list subconfigures --skip skip_subconfigures])
  68. ])
  69. dnl Print error messages in config.log as well as stderr
  70. define([AC_MSG_ERROR],
  71. [{ echo "configure: error: $1" 1>&2; echo "configure: error: $1" 1>&5; exit 1; }])