@@ -9,57 +9,66 @@ AC_ARG_WITH([doca-gpunetio],
99 [ with_doca_gpunetio=$withval] ,
1010 [ with_doca_gpunetio=guess] )
1111
12- AS_IF ( [ test "x$cuda_happy" = "xyes"] , [
1312
14- # Default value
15- GPUNETIO_CFLAGS=""
16- GPUNETIO_LDFLAGS=""
17- GPUNETIO_LIBS="-ldoca_gpunetio"
13+ AS_IF ( [ test "x$cuda_happy" = "xyes"] ,
14+ [
15+ # Default value
16+ GPUNETIO_CFLAGS=""
17+ GPUNETIO_LDFLAGS=""
18+ GPUNETIO_LIBS="-ldoca_gpunetio"
19+ AS_IF ( [ test "x$with_doca_gpunetio" != "xno"] ,
20+ [
21+ AS_IF ( [ test "x$with_doca_gpunetio" = "xguess"] ,
22+ [
23+ AS_IF ( [ $PKG_CONFIG --exists doca-gpunetio] ,
24+ [ GPUNETIO_CFLAGS=$(pkg-config --cflags doca-gpunetio)
25+ GPUNETIO_LDFLAGS=$(pkg-config --libs-only-L doca-gpunetio)
26+ GPUNETIO_LIBS=$(pkg-config --libs-only-l doca-gpunetio)] )
27+ ] ,
28+ [
29+ GPUNETIO_CFLAGS="-I${with_doca_gpunetio}/include"
30+ for doca_libdir in lib/x86_64-linux-gnu lib64; do
31+ if test -d "${with_doca_gpunetio}/${doca_libdir}"; then
32+ GPUNETIO_LDFLAGS="$GPUNETIO_LDFLAGS -L${with_doca_gpunetio}/${doca_libdir} "
33+ # Add rpath-link to search for doca_gpunetio dependencies
34+ GPUNETIO_LDFLAGS="$GPUNETIO_LDFLAGS -Wl,-rpath-link,${with_doca_gpunetio}/${doca_libdir}"
35+ fi
36+ done
37+ # Add CUDA lib dirs to rpath-link for gpunetio
38+ for cuda_libdir in $CUDA_LIB_DIRS; do
39+ GPUNETIO_LDFLAGS="$GPUNETIO_LDFLAGS -Wl,-rpath-link,${cuda_libdir}"
40+ done
41+ ] ) # "x$with_doca_gpunetio" != "xguess"
42+ ] ) # "x$with_doca_gpunetio" != "xno"
1843
19- AS_IF ( [ test x$with_doca_gpunetio != xno] , [
20- AS_IF ( [ test x$with_doca_gpunetio = xguess] ,
21- [
22- AS_IF ( [ $PKG_CONFIG --exists doca-gpunetio] ,
23- [
24- # Guess from pkg-config
25- GPUNETIO_CFLAGS=$(pkg-config --cflags doca-gpunetio)
26- GPUNETIO_LDFLAGS=$(pkg-config --libs-only-L doca-gpunetio)
27- GPUNETIO_LIBS=$(pkg-config --libs-only-l doca-gpunetio)
28- ] )
29- ] ,
30- [
31- # User provided path
32- GPUNETIO_CFLAGS="-I${with_doca_gpunetio}/include"
33- for dir in lib lib64 lib/x86_64-linux-gnu; do
34- if test -d "${with_doca_gpunetio}/${dir}"; then
35- GPUNETIO_LDFLAGS="$GPUNETIO_LDFLAGS -L${with_doca_gpunetio}/${dir} "
36- # Add rpath-link to search for doca_gpunetio dependencies
37- GPUNETIO_LDFLAGS="$GPUNETIO_LDFLAGS -Wl,-rpath-link,${with_doca_gpunetio}/${dir}"
38- fi
39- done
40- ] )
41- ] )
44+ save_CPPFLAGS="$CPPFLAGS"
45+ save_LDFLAGS="$LDFLAGS"
46+ CPPFLAGS="$CPPFLAGS $CUDA_CFLAGS $GPUNETIO_CFLAGS"
47+ LDFLAGS="$LDFLAGS $CUDA_LDFLAGS $GPUNETIO_LDFLAGS"
4248
43- save_CPPFLAGS="$CPPFLAGS"
44- save_LDFLAGS="$LDFLAGS"
45- CPPFLAGS="$CPPFLAGS $CUDA_CFLAGS $GPUNETIO_CFLAGS"
46- LDFLAGS="$LDFLAGS $CUDA_LDFLAGS $GPUNETIO_LDFLAGS -Wl,-rpath-link,$CUDA_LIB_DIR"
49+ gpunetio_happy=yes
50+ AC_CHECK_HEADERS ( [ doca_gpunetio.h ] , [ ] , [ gpunetio_happy=no ] )
51+ AC_CHECK_LIB ( [ doca_gpunetio ] , [ doca_gpu_verbs_bridge_export_qp ] ,
52+ [ true ] , [ gpunetio_happy=no ] , [ $GPUNETIO_LIBS ] )
4753
48- AC_CHECK_HEADERS ( [ doca_gpunetio.h] , [ have_gpunetio=yes] , [ have_gpunetio=no] )
49- AC_CHECK_LIB ( [ doca_gpunetio] , [ doca_gpu_verbs_bridge_export_qp] ,
50- [ true] , [ have_gpunetio=no] , [ $GPUNETIO_LIBS] )
54+ CPPFLAGS="$save_CPPFLAGS"
55+ LDFLAGS="$save_LDFLAGS"
56+ ] ,
57+ [ gpunetio_happy=no] )
5158
52- CPPFLAGS="$save_CPPFLAGS"
53- LDFLAGS="$save_LDFLAGS"
59+ AS_IF ( [ test "x$gpunetio_happy" = "xyes"] ,
60+ [
61+ uct_ib_mlx5_modules="${uct_ib_mlx5_modules}:gda"
62+ AC_SUBST ( GPUNETIO_CFLAGS )
63+ AC_SUBST ( GPUNETIO_LDFLAGS )
64+ AC_SUBST ( GPUNETIO_LIBS )
65+ ] ,
66+ [
67+ # gpunetio was requested but not found
68+ AS_IF ( [ test "x$with_doca_gpunetio" != "xno" -a "x$with_doca_gpunetio" != "xguess"] ,
69+ [ AC_MSG_ERROR ( [ doca_gpunetio not found] ) ] )
70+ ] )
5471
55- AS_IF ( [ test x$have_gpunetio = xyes] , [
56- uct_ib_mlx5_modules="${uct_ib_mlx5_modules}:gda"
57- AC_SUBST ( GPUNETIO_CFLAGS )
58- AC_SUBST ( GPUNETIO_LDFLAGS )
59- AC_SUBST ( GPUNETIO_LIBS )
60- ] )
61- ] )
62-
63- AM_CONDITIONAL([ HAVE_GPUNETIO] , [ test x$have_gpunetio = xyes] )
72+ AM_CONDITIONAL([ HAVE_GPUNETIO] , [ test x$gpunetio_happy = xyes] )
6473AC_CONFIG_FILES ( [ src/uct/ib/mlx5/gdaki/Makefile
6574 src/uct/ib/mlx5/gdaki/ucx-ib-mlx5-gda.pc] )
0 commit comments