hadoop_utils.m4 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # hadoop_utils.m4
  18. # Check to see if the install program supports -C
  19. # If so, use "install -C" for the headers. Otherwise, every install
  20. # updates the timestamps on the installed headers, which causes a recompilation
  21. # of any downstream libraries.
  22. AC_DEFUN([CHECK_INSTALL_CFLAG],[
  23. AC_REQUIRE([AC_PROG_INSTALL])
  24. touch foo
  25. if $INSTALL -C foo bar; then
  26. INSTALL_DATA="$INSTALL_DATA -C"
  27. fi
  28. rm -f foo bar
  29. ])
  30. # Set up the things we need for compiling hadoop utils
  31. AC_DEFUN([HADOOP_UTILS_SETUP],[
  32. AC_REQUIRE([AC_GNU_SOURCE])
  33. AC_REQUIRE([AC_SYS_LARGEFILE])
  34. ])
  35. # define a macro for using hadoop utils
  36. AC_DEFUN([USE_HADOOP_UTILS],[
  37. AC_REQUIRE([HADOOP_UTILS_SETUP])
  38. AC_ARG_WITH([hadoop-utils],
  39. AS_HELP_STRING([--with-hadoop-utils=<dir>],
  40. [directory to get hadoop_utils from]),
  41. [HADOOP_UTILS_PREFIX="$withval"],
  42. [HADOOP_UTILS_PREFIX="\${prefix}"])
  43. AC_SUBST(HADOOP_UTILS_PREFIX)
  44. ])
  45. AC_DEFUN([HADOOP_PIPES_SETUP],[
  46. AC_CHECK_HEADERS([pthread.h], [],
  47. AC_MSG_ERROR(Please check if you have installed the pthread library))
  48. AC_CHECK_LIB([pthread], [pthread_create], [],
  49. AC_MSG_ERROR(Cannot find libpthread.so, please check))
  50. AC_CHECK_LIB([crypto], [HMAC_Init], [],
  51. AC_MSG_ERROR(Cannot find libcrypto.so, please check))
  52. ])
  53. # define a macro for using hadoop pipes
  54. AC_DEFUN([USE_HADOOP_PIPES],[
  55. AC_REQUIRE([USE_HADOOP_UTILS])
  56. AC_REQUIRE([HADOOP_PIPES_SETUP])
  57. AC_ARG_WITH([hadoop-pipes],
  58. AS_HELP_STRING([--with-hadoop-pipes=<dir>],
  59. [directory to get hadoop pipes from]),
  60. [HADOOP_PIPES_PREFIX="$withval"],
  61. [HADOOP_PIPES_PREFIX="\${prefix}"])
  62. AC_SUBST(HADOOP_PIPES_PREFIX)
  63. ])