| 1 |
################################################################################# |
| 2 |
## Utility functions for testing the availability of generic libraries |
| 3 |
## on a list of paths |
| 4 |
################################################################################# |
| 5 |
# HDF_CHECK_LIB_PATH([lib],[func],[path1,path2,path3]) |
| 6 |
|
| 7 |
AC_DEFUN( |
| 8 |
[HDF_CHECK_LIB_PATH], |
| 9 |
[ |
| 10 |
m4_foreach([path], [$3], [ |
| 11 |
lib_path=path |
| 12 |
AS_IF( |
| 13 |
[test "x$AS_TR_SH([ac_cv_lib_$1_$2])" != "xyes"], |
| 14 |
[ |
| 15 |
unset AS_TR_SH([ac_cv_lib_$1_$2]) |
| 16 |
saved_LDFLAGS="$LDFLAGS" |
| 17 |
|
| 18 |
AS_IF([test -n "$lib_path"], [LDFLAGS="$LDFLAGS -L$lib_path"]) |
| 19 |
|
| 20 |
AC_CHECK_LIB( |
| 21 |
[$1],[$2], |
| 22 |
[ |
| 23 |
AS_TR_SH([ac_cv_lib_$1_$2])="yes" |
| 24 |
AS_TR_SH([AS_TR_SH([m4_toupper([HAVE_LIB$1])])])="yes" |
| 25 |
lib_name=AS_TR_SH([m4_toupper([HAVE_LIB$1])]) |
| 26 |
AC_DEFINE_UNQUOTED([$lib_name],[1],[something here]) |
| 27 |
LIBS="-l$1 $LIBS" |
| 28 |
],[ |
| 29 |
LDFLAGS="$saved_LDFLAGS" |
| 30 |
AS_TR_SH([ac_cv_lib_$1_$2])="no" |
| 31 |
]) |
| 32 |
]) |
| 33 |
]) |
| 34 |
]) |
| 35 |
|
| 36 |
|
| 37 |
################################################################################# |
| 38 |
## Utility functions for testing the availability of generic libraries |
| 39 |
################################################################################# |
| 40 |
# HDF_CHECK_LIB([zlib],[z],[compress2],[path]) |
| 41 |
AC_DEFUN( |
| 42 |
[HDF_CHECK_LIB], |
| 43 |
[ |
| 44 |
AC_ARG_WITH([$1], |
| 45 |
[AC_HELP_STRING([--with-$1=DIR], |
| 46 |
[Specify path to external $1 library. |
| 47 |
Linker must be able to find $1 if HDF4 |
| 48 |
was built with $1. |
| 49 |
[default=yes]])],, |
| 50 |
withval=yes) |
| 51 |
|
| 52 |
AS_IF( |
| 53 |
|
| 54 |
## --with-<lib> with no directory. We must find it. |
| 55 |
## |
| 56 |
[test "x$withval" == "xyes"], |
| 57 |
[ |
| 58 |
HDF_CHECK_LIB_PATH([$2],[$3],[$4]) |
| 59 |
], |
| 60 |
|
| 61 |
|
| 62 |
## --without-<lib> |
| 63 |
## Nothing to do - library just does not get added. |
| 64 |
## |
| 65 |
[test "x$withval" == "xno"],, |
| 66 |
|
| 67 |
|
| 68 |
## All other cases |
| 69 |
## |
| 70 |
[ |
| 71 |
AS_IF( |
| 72 |
[test -z "$withval"],[ |
| 73 |
AC_MSG_ERROR([no $1 library path provided]) |
| 74 |
], |
| 75 |
[ |
| 76 |
LDFLAGS="$LDFLAGS -L$withval" |
| 77 |
AC_CHECK_LIB( |
| 78 |
[$2],[$3],, |
| 79 |
[ |
| 80 |
AC_MSG_ERROR([couldn't find $1 library]) |
| 81 |
]) |
| 82 |
]) |
| 83 |
] |
| 84 |
) |
| 85 |
]) |
| 86 |
|
| 87 |
|