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 | |
---|
19 | # Check to see if the install program supports -C |
---|
20 | # If so, use "install -C" for the headers. Otherwise, every install |
---|
21 | # updates the timestamps on the installed headers, which causes a recompilation |
---|
22 | # of any downstream libraries. |
---|
23 | AC_DEFUN([CHECK_INSTALL_CFLAG],[ |
---|
24 | AC_REQUIRE([AC_PROG_INSTALL]) |
---|
25 | touch foo |
---|
26 | if $INSTALL -C foo bar; then |
---|
27 | INSTALL_DATA="$INSTALL_DATA -C" |
---|
28 | fi |
---|
29 | rm -f foo bar |
---|
30 | ]) |
---|
31 | |
---|
32 | # Set up the things we need for compiling hadoop utils |
---|
33 | AC_DEFUN([HADOOP_UTILS_SETUP],[ |
---|
34 | AC_REQUIRE([AC_GNU_SOURCE]) |
---|
35 | AC_REQUIRE([AC_SYS_LARGEFILE]) |
---|
36 | ]) |
---|
37 | |
---|
38 | # define a macro for using hadoop utils |
---|
39 | AC_DEFUN([USE_HADOOP_UTILS],[ |
---|
40 | AC_REQUIRE([HADOOP_UTILS_SETUP]) |
---|
41 | AC_ARG_WITH([hadoop-utils], |
---|
42 | AS_HELP_STRING([--with-hadoop-utils=<dir>], |
---|
43 | [directory to get hadoop_utils from]), |
---|
44 | [HADOOP_UTILS_PREFIX="$withval"], |
---|
45 | [HADOOP_UTILS_PREFIX="\${prefix}"]) |
---|
46 | AC_SUBST(HADOOP_UTILS_PREFIX) |
---|
47 | ]) |
---|
48 | |
---|
49 | AC_DEFUN([HADOOP_PIPES_SETUP],[ |
---|
50 | AC_CHECK_HEADERS([pthread.h], [], |
---|
51 | AC_MSG_ERROR(Please check if you have installed the pthread library)) |
---|
52 | AC_CHECK_LIB([pthread], [pthread_create], [], |
---|
53 | AC_MSG_ERROR(Cannot find libpthread.so, please check)) |
---|
54 | ]) |
---|
55 | |
---|
56 | # define a macro for using hadoop pipes |
---|
57 | AC_DEFUN([USE_HADOOP_PIPES],[ |
---|
58 | AC_REQUIRE([USE_HADOOP_UTILS]) |
---|
59 | AC_REQUIRE([HADOOP_PIPES_SETUP]) |
---|
60 | AC_ARG_WITH([hadoop-pipes], |
---|
61 | AS_HELP_STRING([--with-hadoop-pipes=<dir>], |
---|
62 | [directory to get hadoop pipes from]), |
---|
63 | [HADOOP_PIPES_PREFIX="$withval"], |
---|
64 | [HADOOP_PIPES_PREFIX="\${prefix}"]) |
---|
65 | AC_SUBST(HADOOP_PIPES_PREFIX) |
---|
66 | ]) |
---|