- AC_HELP_STRING([--with-mx=path],
- [build mxlnd against path]),
- [
- case $with_mx in
- yes) ENABLEMX=2
- ;;
- no) ENABLEMX=0
- ;;
- *) MXPATH=$with_mx
- ENABLEMX=3
- ;;
- esac
- ],[
- ENABLEMX=1
- ])
-if test $ENABLEMX -eq 0; then
- AC_MSG_RESULT([disabled])
-elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
- -f ${MXPATH}/include/mx_kernel_api.h -a \
- -f ${MXPATH}/include/mx_pin.h \); then
- AC_MSG_RESULT([no])
- case $ENABLEMX in
- 1) ;;
- 2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
- 3) AC_MSG_ERROR([bad --with-mx path]);;
- *) AC_MSG_ERROR([internal error]);;
- esac
-else
- MXCPPFLAGS="-I$MXPATH/include"
- EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
- EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
- MXLIBS="-L$MXPATH/lib"
- LB_LINUX_TRY_COMPILE([
- #define MX_KERNEL 1
- #include <mx_extensions.h>
- #include <myriexpress.h>
- ],[
- mx_endpoint_t end;
- mx_status_t status;
- mx_request_t request;
- int result;
-
- mx_init();
- mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
- mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
- mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
- mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
- return 0;
- ],[
- AC_MSG_RESULT([yes])
- MXLND="mxlnd"
- ],[
- AC_MSG_RESULT([no])
- case $ENABLEMX in
- 1) ;;
- 2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
- 3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
- *) AC_MSG_ERROR([internal error]);;
- esac
- MXLND=""
- MXCPPFLAGS=""
- ])
- EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
+ AC_HELP_STRING([--with-mx=path],
+ [build mxlnd against path]),
+ [
+ case $with_mx in
+ yes) ENABLEMX=2 ;;
+ no) ENABLEMX=0 ;;
+ *) ENABLEMX=3; MXPATH=$with_mx ;;
+ esac
+ ],[
+ ENABLEMX=1
+ ])
+AS_IF([test $ENABLEMX -eq 0], [
+ AC_MSG_RESULT([disabled])
+], [test ! \( -f ${MXPATH}/include/myriexpress.h -a \
+ -f ${MXPATH}/include/mx_kernel_api.h -a \
+ -f ${MXPATH}/include/mx_pin.h \)], [
+ AC_MSG_RESULT([no])
+ case $ENABLEMX in
+ 1) ;;
+ 2) AC_MSG_ERROR([Myrinet MX kernel headers not present]) ;;
+ 3) AC_MSG_ERROR([bad --with-mx path]) ;;
+ *) AC_MSG_ERROR([internal error]) ;;
+ esac
+], [
+ AC_MSG_RESULT([check])
+ MXPATH=$(readlink --canonicalize $MXPATH)
+ MXCPPFLAGS="-I$MXPATH/include"
+ MXLIBS="-L$MXPATH/lib"
+ EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
+ EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
+ LB_CHECK_COMPILE([if have Myrinet MX support],
+ myrinet_mx_support, [
+ #define MX_KERNEL 1
+ #include <mx_extensions.h>
+ #include <myriexpress.h>
+ ],[
+ mx_endpoint_t end;
+ mx_status_t status;
+ mx_request_t request;
+ int result;
+ mx_init();
+ mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
+ mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
+ mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
+ mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
+ return 0;
+ ],[
+ MXLND="mxlnd"
+ ],[
+ case $ENABLEMX in
+ 1) ;;
+ 2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]) ;;
+ 3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]) ;;
+ *) AC_MSG_ERROR([internal error]) ;;
+ esac
+ MXCPPFLAGS=""
+ MXLIBS=""
+ MXLND=""
+ ])
+ EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
+])