|
1 dnl |
|
2 dnl Autoconf support for LTP convergence layer based on TCD's LTPLib |
|
3 dnl |
|
4 |
|
5 AC_DEFUN(AC_CONFIG_LTP, [ |
|
6 |
|
7 AC_ARG_WITH(ltp, |
|
8 [AC_HELP_STRING([--with-ltp], |
|
9 [enable LTP convergence layer support using TCD's LTPlib (EXPERIMENTAL)])], |
|
10 [ac_use_ltp=$withval], |
|
11 [ac_use_ltp="no"]) |
|
12 |
|
13 AC_MSG_CHECKING([whether to enable LTP convergence layer support]) |
|
14 |
|
15 dnl |
|
16 dnl Disable LTP if requested |
|
17 dnl |
|
18 if test "$ac_use_ltp" = "no"; then |
|
19 AC_MSG_RESULT(no) |
|
20 LTP_ENABLED=0 |
|
21 else |
|
22 |
|
23 dnl |
|
24 dnl Find the LTPlib installation |
|
25 dnl |
|
26 if test "$ac_use_ltp" = try \ |
|
27 -o "$ac_use_ltp" = yes \ |
|
28 -o "$ac_use_ltp" = "" ; then |
|
29 AC_MSG_RESULT([try]) |
|
30 ac_ltp_inst_dirs="$ac_pwd/../LTPlib /usr /usr/local" |
|
31 else |
|
32 AC_MSG_RESULT([yes (dir $ac_use_ltp)]) |
|
33 ac_ltp_inst_dirs="$ac_use_ltp" |
|
34 fi |
|
35 |
|
36 ac_save_EXTLIB_CFLAGS="$EXTLIB_CFLAGS" |
|
37 ac_save_EXTLIB_LDFLAGS="$EXTLIB_LDFLAGS" |
|
38 |
|
39 AC_MSG_CHECKING([whether ltp libraries are available]) |
|
40 AC_CACHE_VAL(dtn_cv_path_ltp, |
|
41 [ |
|
42 for ac_ltp_inst_dir in $ac_ltp_inst_dirs; do |
|
43 if test -d "$ac_ltp_inst_dir"; then |
|
44 AC_LANG([C++]) |
|
45 EXTLIB_CFLAGS="-DFILE_OFFSET_BITS=64" |
|
46 EXTLIB_LDFLAGS="-L$ac_pwd/../LTPlib/lib \ |
|
47 -lltp -lpthread -lcrypto -lm" |
|
48 |
|
49 AC_COMPILE_IFELSE( |
|
50 AC_LANG_PROGRAM( |
|
51 [ |
|
52 #include "$ac_ltp_inst_dir/include/ltp.h" |
|
53 ], |
|
54 |
|
55 [ |
|
56 ltpaddr la; |
|
57 ]), |
|
58 [ |
|
59 dtn_cv_path_ltp="$ac_ltp_inst_dir" |
|
60 break |
|
61 ], |
|
62 [ |
|
63 dtn_cv_path_ltp= |
|
64 ] |
|
65 ) |
|
66 fi |
|
67 done |
|
68 ]) |
|
69 |
|
70 EXTLIB_CFLAGS="$ac_save_EXTLIB_CFLAGS" |
|
71 EXTLIB_LDFLAGS="$ac_save_EXTLIB_LDFLAGS" |
|
72 |
|
73 if test -z "$dtn_cv_path_ltp"; then |
|
74 AC_MSG_RESULT([no]) |
|
75 LTP_ENABLED=0 |
|
76 else |
|
77 AC_MSG_RESULT([yes]) |
|
78 LTP_ENABLED=1 |
|
79 AC_DEFINE(LTP_ENABLED, 1, [whether LTP support is enabled]) |
|
80 if test ! "$dtn_cv_path_ltp" = /usr && test ! "$dtn_cv_path_ltp" = /usr/local; then |
|
81 EXTLIB_CFLAGS="$EXTLIB_CFLAGS -I$dtn_cv_path_ltp/include" |
|
82 EXTLIB_LDFLAGS="$EXTLIB_LDFLAGS -L$dtn_cv_path_ltp/lib" |
|
83 fi |
|
84 EXTLIB_LDFLAGS="$EXTLIB_LDFLAGS -lltp -lpthread -lcrypto -lm" |
|
85 fi |
|
86 |
|
87 fi |
|
88 ]) |
|
89 |
|
90 |