@@ -13,7 +13,7 @@ dnl All rights reserved.
1313dnl Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved.
1414dnl Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
1515dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
16- dnl Copyright (c) 2015 Research Organization for Information Science
16+ dnl Copyright (c) 2015-2016 Research Organization for Information Science
1717dnl and Technology (RIST). All rights reserved.
1818dnl $COPYRIGHT $
1919dnl
@@ -31,15 +31,18 @@ AC_DEFUN([_OPAL_CHECK_PACKAGE_HEADER], [
3131 # cache variable for the library check. one should not copy this
3232 # code into other places unless you want much pain and suffering
3333 AS_VAR_PUSHDEF([opal_Header], [ac_cv_header_$2 ])
34+ OPAL_VAR_SCOPE_PUSH([dir_prefix])
3435
3536 # so this sucks, but there's no way to get through the progression
3637 # of header includes without killing off the cache variable and trying
3738 # again...
3839 unset opal_Header
3940
41+ # get rid of the trailing slash(es)
42+ dir_prefix= $( echo $3 | sed -e ' sX/*$XXg' )
4043 opal_check_package_header_happy= " no"
41- AS_IF([test " $3 " = " /usr" || \
42- test " $3 " = " /usr/local" ],
44+ AS_IF([test " $dir_prefix " = " /usr" || \
45+ test " $dir_prefix " = " /usr/local" ],
4346 [ # try as is...
4447 AC_VERBOSE([looking for header without includes])
4548 AC_CHECK_HEADERS([$2 ], [opal_check_package_header_happy= " yes" ], [])
@@ -48,14 +51,15 @@ AC_DEFUN([_OPAL_CHECK_PACKAGE_HEADER], [
4851 unset opal_Header])])
4952
5053 AS_IF([test " $opal_check_package_header_happy " = " no" ],
51- [AS_IF([test " $3 " != " " ],
52- [$1 _CPPFLAGS= " $$ 1_CPPFLAGS -I$3 /include"
53- CPPFLAGS= " $CPPFLAGS -I$3 /include" ])
54+ [AS_IF([test " $dir_prefix " != " " ],
55+ [$1 _CPPFLAGS= " $$ 1_CPPFLAGS -I$dir_prefix /include"
56+ CPPFLAGS= " $CPPFLAGS -I$dir_prefix /include" ])
5457 AC_CHECK_HEADERS([$2 ], [opal_check_package_header_happy= " yes" ], [], [$6 ])
5558 AS_IF([test " $opal_check_package_header_happy " = " yes" ], [$4 ], [$5 ])],
5659 [$4 ])
5760 unset opal_check_package_header_happy
5861
62+ OPAL_VAR_SCOPE_POP([dir_prefix])
5963 AS_VAR_POPDEF([opal_Header])dnl
6064])
6165
0 commit comments