Skip to content

Commit

Permalink
Handle lib64 correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rstub committed Jun 27, 2019
1 parent 64f2314 commit cdbf5ef
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 24 deletions.
45 changes: 32 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2914,32 +2914,51 @@ if test "${with_arrayfire+set}" = set; then :
fi
if test -z "${AF_PATH}"
if test -n "${AF_PATH}"
then
AF_INCLUDE="-I${AF_PATH}/include"
AF_LIBS="-L${AF_PATH}/lib -laf -Wl,-rpath,${AF_PATH}/lib"
else
# let's look around -- code inspiered by RPostgreSQL
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ArrayFire installation" >&5
$as_echo "$as_me: checking for ArrayFire installation" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ArrayFire header" >&5
$as_echo "$as_me: checking for ArrayFire header" >&6;}
for dir in \
/usr/include \
/usr/local/include \
/opt/arrayfire/include
do
{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking directory ${dir}." >&5
$as_echo "$as_me: Checking directory ${dir}." >&6;}
if test -f ${dir}/arrayfire.h
then
AF_INCLUDE="-I${dir}"
break
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ArrayFire library" >&5
$as_echo "$as_me: checking for ArrayFire library" >&6;}
for dir in \
/usr \
/usr/local \
/opt/arrayfire
/usr/lib \
/usr/lib64 \
/usr/local/lib \
/usr/local/lib64 \
/opt/arrayfire/lib \
/opt/arrayfire/lib64
do
{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking prefix ${dir}." >&5
$as_echo "$as_me: Checking prefix ${dir}." >&6;}
if test -f ${dir}/include/arrayfire.h && test -r ${dir}/lib/libaf.so -o -r ${dir}/lib64/libaf.so -o -r ${dir}/lib/libaf.dylib
{ $as_echo "$as_me:${as_lineno-$LINENO}: Checking directory ${dir}." >&5
$as_echo "$as_me: Checking directory ${dir}." >&6;}
if test -r ${dir}/libaf.so -o -r ${dir}/libaf.dylib
then
AF_PATH=${dir}
AF_LIBS="-L${dir}/lib -laf -Wl,-rpath,${dir}/lib"
break
fi
done
fi
if test -z "${AF_PATH}"; then :
if test -z "${AF_INCLUDE}" -o -z "${AF_LIBS}"; then :
as_fn_error $? "Cannot find ArrayFire installation." "$LINENO" 5
fi
AF_INCLUDE="-I${AF_PATH}/include"
AF_LIBS="-L${AF_PATH}/lib -laf -Wl,-rpath,${AF_PATH}/lib"
CPPFLAGS="${CPPFLAGS} ${AF_INCLUDE}"
LDFLAGS="${LDFLAGS} ${AF_LIBS}"
Expand Down
39 changes: 28 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,45 @@ AC_ARG_WITH([arrayfire],
[AF_PATH = ${with_arrayfire}],
[])

if test -z "${AF_PATH}"
if test -n "${AF_PATH}"
then
AF_INCLUDE="-I${AF_PATH}/include"
AF_LIBS="-L${AF_PATH}/lib -laf -Wl,-rpath,${AF_PATH}/lib"
else
# let's look around -- code inspiered by RPostgreSQL
AC_MSG_NOTICE([checking for ArrayFire installation])
AC_MSG_NOTICE([checking for ArrayFire header])
for dir in \
/usr/include \
/usr/local/include \
/opt/arrayfire/include
do
AC_MSG_NOTICE([Checking directory ${dir}.])
if test -f ${dir}/arrayfire.h
then
AF_INCLUDE="-I${dir}"
break
fi
done
AC_MSG_NOTICE([checking for ArrayFire library])
for dir in \
/usr \
/usr/local \
/opt/arrayfire
/usr/lib \
/usr/lib64 \
/usr/local/lib \
/usr/local/lib64 \
/opt/arrayfire/lib \
/opt/arrayfire/lib64
do
AC_MSG_NOTICE([Checking prefix ${dir}.])
if test -f ${dir}/include/arrayfire.h && test -r ${dir}/lib/libaf.so -o -r ${dir}/lib64/libaf.so -o -r ${dir}/lib/libaf.dylib
AC_MSG_NOTICE([Checking directory ${dir}.])
if test -r ${dir}/libaf.so -o -r ${dir}/libaf.dylib
then
AF_PATH=${dir}
AF_LIBS="-L${dir}/lib -laf -Wl,-rpath,${dir}/lib"
break
fi
done
fi

AS_IF([test -z "${AF_PATH}"], [AC_MSG_ERROR([Cannot find ArrayFire installation.])])
AS_IF([test -z "${AF_INCLUDE}" -o -z "${AF_LIBS}"], [AC_MSG_ERROR([Cannot find ArrayFire installation.])])

AF_INCLUDE="-I${AF_PATH}/include"
AF_LIBS="-L${AF_PATH}/lib -laf -Wl,-rpath,${AF_PATH}/lib"

CPPFLAGS="${CPPFLAGS} ${AF_INCLUDE}"
LDFLAGS="${LDFLAGS} ${AF_LIBS}"
Expand Down

0 comments on commit cdbf5ef

Please sign in to comment.