cameo.m4 2.52 KB
Newer Older
legoc's avatar
legoc committed
1
###############################################################################
legoc's avatar
legoc committed
2
# Version 11/07/2016
legoc's avatar
legoc committed
3
4
5
6
7
8
9
10
11
12
13
# defines CAMEO_CFLAGS, CAMEO_LDFLAGS, CAMEO_LIBS
#
AC_DEFUN([AC_CAMEO],
[ 
  AC_ARG_WITH([cameo],
         AS_HELP_STRING([--with-cameo=PREFIX],[Specify cameo library location]),
         [],
              [with_cameo=yes])

    AC_LIBZMQ
    AC_LIBPROTOBUF_LITE
legoc's avatar
legoc committed
14
15
16
17
    AX_BOOST_DATE_TIME
	AX_BOOST_THREAD
	AX_BOOST_SYSTEM
    
legoc's avatar
legoc committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    CAMEO_CFLAGS=
    CAMEO_LIBS=
    if test $with_cameo != no; then
        if test $with_cameo != yes; then
            cameo_possible_path="$with_cameo"
        else
            cameo_possible_path="/usr/local /usr /opt /var"
        fi
        AC_MSG_CHECKING([for cameo headers])
        cameo_save_CXXFLAGS="$CXXFLAGS"
        cameo_found=no
        for cameo_path_tmp in $cameo_possible_path ; do
            # test include
            CXXFLAGS="$CXXFLAGS -I$cameo_path_tmp/include"
            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <cameo/cameo.h>]],[[]])],
                        [CAMEO_CFLAGS="-I$cameo_path_tmp/include"
                         CAMEO_LIBS="-L$cameo_path_tmp/lib"
                         cameo_found=yes]
                        [])
            CXXFLAGS="$cameo_save_CXXFLAGS"
            if test $cameo_found = yes; then
                break;
            fi
        done

        AC_MSG_RESULT($cameo_found)
        if test $cameo_found = yes; then
            AC_MSG_CHECKING([for cameo -lcameo])
            cameo_save_LIBS="$LIBS"
            CXXFLAGS="$CXXFLAGS $CAMEO_CFLAGS"

            # search for library
            LIBS="$LIBS $CAMEO_LIBS $LIBZMQ_LDFLAGS $LIBPROTOBUF_LDFLAGS $BOOST_LDFLAGS $LIBZMQ_LIB $LIBPROTOBUF_LIB $BOOST_THREAD_LIB -lcameo"

            AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
                                     [[]])],
                     [ cameo_found=yes],
                     [ cameo_found=no])
            CXXFLAGS="$cameo_save_CXXFLAGS"
            LIBS="$cameo_save_LIBS"
            if test $cameo_found = yes; then
                    
                HAVE_CAMEO=1
                LIBS="$cameo_save_LIBS"
                CAMEO_LDFLAGS="$LIBZMQ_LDFLAGS $LIBPROTOBUF_LDFLAGS $CAMEO_LIBS"
                CAMEO_LIBS="$LIBZMQ_LIB $LIBPROTOBUF_LIB $BOOST_THREAD_LIB -lcameo"
            fi

            if test $cameo_found = yes; then
                AC_MSG_RESULT(yes)
                AC_SUBST(CAMEO_CFLAGS)
                AC_SUBST(CAMEO_LDFLAGS)
                AC_SUBST(CAMEO_LIBS)
            else
                AC_MSG_RESULT(no)
            fi
        fi
    fi
])