Merge branch 'dyninst_proccontrol' of ssh://git.dyninst.org/pub/dyninst into dyninst_...
[dyninst.git] / aclocal.m4
1
2 dnl: macro simply checks for existence of header file "$2" in dir "$1"
3 AC_DEFUN(PD_CHECK_INC_DIR,[
4   CXXFLAGS_HOLD=$CXXFLAGS
5   if test "$1" != "" ; then
6     AC_MSG_CHECKING([for $2 in $1])
7     CXXFLAGS="$CXXFLAGS -I$1"
8   else
9     AC_MSG_CHECKING([for $2])
10   fi
11   AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([#include "$2"],[])],
12                      [AC_MSG_RESULT(yes)],
13                      [AC_MSG_ERROR([$2 not found in $1])] )
14   CXXFLAGS=$CXXFLAGS_HOLD
15 ])
16
17 AC_DEFUN(PD_CHECK_LIB_TYPE,[
18   LIB_TYPE_DYNAMIC=`ls -H -1 $1 | grep $2 | grep '\.so' | wc | awk '{if($'2' > 0){print "true"} else {print ""}}'`
19   if test "$LIB_TYPE_DYNAMIC" = "true"; then
20         LIB_TYPE_STATIC=        
21   else
22         LIB_TYPE_STATIC=`ls -H -1 $1 | grep $2 | grep '\.a' | wc | awk '{if($'2' > 0){print "true"} else {print ""}}'`
23   fi
24 ])
25
26 AC_DEFUN(PD_SOFT_CHECK_INC_DIR,[
27   CXXFLAGS_HOLD=$CXXFLAGS
28   if test "$1" != "" ; then
29     AC_MSG_CHECKING([for $2 in $1])
30     CXXFLAGS="$CXXFLAGS -I$1"
31   else
32     AC_MSG_CHECKING([for $2])
33   fi
34   AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([#include "$2"],[])],
35                      [AC_DEFINE([cap_have_$3], 1, [...yes])],
36                      [AC_MSG_RESULT([$2 not found in $1])] )
37   CXXFLAGS=$CXXFLAGS_HOLD
38 ])
39
40 dnl: if first argument not set, check for function symbol $3 in lib $2
41 dnl: otherwise, set lib to -L$1 before check 
42 dnl: if $4 and $5 are set, they are additional libdirs and libs needed
43 dnl: for linking to resolve all references properly and test to pass
44 AC_DEFUN(PD_CHECK_LIB_DIR,[
45   if test "$1" = "" ; then
46     FIRST_LIBPARAM=""
47   else
48     FIRST_LIBPARAM="-L$1"
49   fi
50   if test "$4" = "" ; then
51     FOURTH_LIBPARAM=""
52   else
53     FOURTH_LIBPARAM="-L$4"
54   fi
55   LIBS_HOLD=$LIBS
56   LIBS="$LIBS $FIRST_LIBPARAM $FOURTH_LIBPARAM"
57   AC_CHECK_LIB($2, $3, [], [AC_MSG_ERROR(Cant find lib$2.)], $5)
58   LIBS=$LIBS_HOLD
59 ])
60
61 AC_DEFUN(PD_CHECK_LIB_DIR_WERR,[
62   if test "$1" = "" ; then
63     FIRST_LIBPARAM=""
64   else
65     FIRST_LIBPARAM="-L$1"
66   fi
67   if test "$4" = "" ; then
68     FOURTH_LIBPARAM=""
69   else
70     FOURTH_LIBPARAM="-L$4"
71   fi
72   LIBS_HOLD=$LIBS
73   LIBS="$LIBS $FIRST_LIBPARAM $FOURTH_LIBPARAM"
74   AC_CHECK_LIB($2, $3, [], $6, $5)
75   LIBS=$LIBS_HOLD
76 ])
77
78 AC_DEFUN(PD_SOFT_CHECK_LIB_DIR,[
79   if test "$1" = "" ; then
80     FIRST_LIBPARAM=""
81   else
82     FIRST_LIBPARAM="-L$1"
83   fi
84   if test "$4" = "" ; then
85     FOURTH_LIBPARAM=""
86   else
87     FOURTH_LIBPARAM="-L$4"
88   fi
89   LIBS_HOLD=$LIBS
90   LIBS="$LIBS $FIRST_LIBPARAM $FOURTH_LIBPARAM"
91   AC_CHECK_LIB($2, $3, [], [AC_MSG_RESULT(Cant find lib$2.)], $5)
92   LIBS=$LIBS_HOLD
93 ])
94
95 AC_DEFUN(PD_CHECK_LIB_FEATURE,[
96   if test "$1" = "" ; then
97     FIRST_LIBPARAM=""
98   else
99     FIRST_LIBPARAM="-L$1"
100   fi
101   if test "$4" = "" ; then
102     FOURTH_LIBPARAM=""
103   else
104     FOURTH_LIBPARAM="-L$4"
105   fi
106   LIBS_HOLD=$LIBS
107   LIBS="$LIBS $FIRST_LIBPARAM $FOURTH_LIBPARAM"
108   AC_CHECK_LIB($2, $3, [HAS_FEATURE="true"], [], $5)
109   LIBS=$LIBS_HOLD
110 ])