-
Notifications
You must be signed in to change notification settings - Fork 0
/
simfqt.m4.in
130 lines (109 loc) · 4.78 KB
/
simfqt.m4.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#
# Configure paths and flags for the @PACKAGE_PRETTY_NAME@ library.
# Denis Arnaud <denis_arnaud at users dot sourceforge dot net>, July 2008
#
# Note: the @PACKAGE_NAME@ library depends upon BOOST to build.
# Your configure.ac must therefore define appropriately the BOOST
# variables (i.e., BOOST_CFLAGS, BOOST_LIBS, BOOST_DATE_TIME_LIB).
#
# Variables set by this macro:
# * @PACKAGE_NAME@_VERSION
# * @PACKAGE_NAME@_CFLAGS
# * @PACKAGE_NAME@_LIBS
# * @PACKAGE_NAME@_SAMPLE_DIR
#
AC_DEFUN([AM_PATH_@PACKAGE_NAME@],
[
AC_LANG_SAVE
AC_LANG([C++])
##
AC_ARG_WITH(@PACKAGE@,
[ --with-@PACKAGE@=PFX Prefix where @PACKAGE_PRETTY_NAME@ is installed (optional) ],
@PACKAGE@_dir="$withval",
@PACKAGE@_dir="")
if test "x${@PACKAGE_NAME@_CONFIG+set}" != xset ; then
if test "x$@PACKAGE@_dir" != x ; then
@PACKAGE_NAME@_CONFIG="$@PACKAGE@_dir/bin/@PACKAGE@-config"
fi
fi
AC_PATH_PROG(@PACKAGE_NAME@_CONFIG, @PACKAGE@-config, no)
## Check whether Boost flags and libraries are defined
# General Boost compilation flags
AC_MSG_CHECKING(for BOOST_CFLAGS environment variable)
if test x"${BOOST_CFLAGS}" = x; then
AC_MSG_RESULT([Warning: @PACKAGE_PRETTY_NAME@ needs Boost, and the BOOST_CFLAGS environment variable does not appear to be set. It may not be a problem, though, if your Unix distribution is standard, that is, if Boost is installed in /usr. Otherwise, the @PACKAGE_PRETTY_NAME@ will fail to compile.])
else
AC_MSG_RESULT([ok (set to ${BOOST_CFLAGS})])
fi
# Boost Date-Time library
AC_MSG_CHECKING(for BOOST_DATE_TIME_LIB environment variable)
if test x"${BOOST_DATE_TIME_LIB}" = x; then
AC_MSG_RESULT([Warning: @PACKAGE_PRETTY_NAME@ needs the Boost Date-Time library, and the BOOST_DATE_TIME_LIB environment variable does not appears to be set. The @PACKAGE_PRETTY_NAME@ may fail to link.])
else
AC_MSG_RESULT([ok (set to ${BOOST_DATE_TIME_LIB})])
fi
# Boost Program Options library
AC_MSG_CHECKING(for BOOST_PROGRAM_OPTIONS_LIB environment variable)
if test x"${BOOST_PROGRAM_OPTIONS_LIB}" = x; then
AC_MSG_RESULT([Warning: @PACKAGE_PRETTY_NAME@ needs the Boost Program Options library, and the BOOST_PROGRAM_OPTIONS_LIB environment variable does not appears to be set. The @PACKAGE_PRETTY_NAME@ may fail to link.])
else
AC_MSG_RESULT([ok (set to ${BOOST_PROGRAM_OPTIONS_LIB})])
fi
# Boost File System library
AC_MSG_CHECKING(for BOOST_FILESYSTEM_LIB environment variable)
if test x"${BOOST_FILESYSTEM_LIB}" = x; then
AC_MSG_RESULT([Warning: @PACKAGE_PRETTY_NAME@ needs the Boost Date-Time library, and the BOOST_FILESYSTEM_LIB environment variable does not appears to be set. The @PACKAGE_PRETTY_NAME@ may fail to link.])
else
AC_MSG_RESULT([ok (set to ${BOOST_FILESYSTEM_LIB})])
fi
## @PACKAGE_PRETTY_NAME@ version
min_@PACKAGE@_version=ifelse([$1], ,0.1.0,$1)
AC_MSG_CHECKING(for @PACKAGE_PRETTY_NAME@ - version >= $min_@PACKAGE@_version)
no_@PACKAGE@=""
if test "${@PACKAGE_NAME@_CONFIG}" = "no" ; then
no_@PACKAGE@=yes
AC_MSG_RESULT([no])
else
@PACKAGE_NAME@_VERSION=`${@PACKAGE_NAME@_CONFIG} --version`
@PACKAGE_NAME@_CFLAGS=`${@PACKAGE_NAME@_CONFIG} --cflags`
@PACKAGE_NAME@_CFLAGS="${BOOST_CFLAGS} ${@PACKAGE_NAME@_CFLAGS}"
@PACKAGE_NAME@_LIBS=`${@PACKAGE_NAME@_CONFIG} --libs`
@PACKAGE_NAME@_LIBS="${BOOST_LIBS} ${BOOST_DATE_TIME_LIB} ${@PACKAGE_NAME@_LIBS}"
@PACKAGE_NAME@_SAMPLE_DIR=`${@PACKAGE_NAME@_CONFIG} --sampledir`
AC_SUBST([@PACKAGE_NAME@_VERSION])
AC_SUBST([@PACKAGE_NAME@_CFLAGS])
AC_SUBST([@PACKAGE_NAME@_LIBS])
AC_SUBST([@PACKAGE_NAME@_SAMPLE_DIR])
@PACKAGE@_major_version=`echo ${@PACKAGE_NAME@_VERSION} | sed 's/^\([[0-9]]*\).*/\1/'`
if test "x${@PACKAGE@_major_version}" = "x" ; then
@PACKAGE@_major_version=0
fi
@PACKAGE@_minor_version=`echo ${@PACKAGE_NAME@_VERSION} | \
sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\2/'`
if test "x${@PACKAGE@_minor_version}" = "x" ; then
@PACKAGE@_minor_version=0
fi
@PACKAGE@_micro_version=`echo ${@PACKAGE_NAME@_VERSION} | \
sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\3/'`
if test "x${@PACKAGE@_micro_version}" = "x" ; then
@PACKAGE@_micro_version=0
fi
## Simple test of compilation and link
SAVED_CPPFLAGS="${CPPFLAGS}"
SAVED_LDFLAGS="${LDFLAGS}"
CPPFLAGS="${CPPFLAGS} ${BOOST_CFLAGS} ${@PACKAGE_NAME@_CFLAGS}"
LDFLAGS="${LDFLAGS} ${@PACKAGE_NAME@_LIBS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <@PACKAGE@/@PACKAGE_NAME@_Service.hpp>
]],
[[int i=0;]]
)]
,
[AC_MSG_RESULT([yes (${@PACKAGE_NAME@_VERSION})])],
[AC_MSG_ERROR([We could not compile a simple @PACKAGE_PRETTY_NAME@ example. See config.log.])]
)
CPPFLAGS="${SAVED_CPPFLAGS}"
LDFLAGS="${SAVED_LDFLAGS}"
fi
AC_LANG_RESTORE
])