-rw-r--r-- | acinclude.m4 | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..14b6de7 --- a/dev/null +++ b/acinclude.m4 | |||
@@ -0,0 +1,211 @@ | |||
1 | dnl AC_WITH_PKGCONFIG([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]) | ||
2 | dnl Outputs: | ||
3 | dnl AC_SUBST: PKGCONFIG_PKGCONFIG PKGCONFIG_DIR | ||
4 | dnl AM_CONDTIONAL: HAVE_PKGCONFIG | ||
5 | AC_DEFUN([AC_WITH_PKGCONFIG],[ | ||
6 | PKGCONFIG_PKGCONFIG="" | ||
7 | PKGCONFIG_DIR="" | ||
8 | HAVE_PKGCONFIG="no" | ||
9 | EXPLICIT_PKGCONFIGDIR="no" | ||
10 | test -z "${WANT_PKGCONFIG}" && WANT_PKGCONFIG="" | ||
11 | AC_PATH_PROG([PKGCONFIG_PKGCONFIG],[pkg-config],[false]) | ||
12 | if test "${PKGCONFIG_PKGCONFIG}" != "false" ; then | ||
13 | AC_ARG_WITH([pkgconfigdir], | ||
14 | AC_HELP_STRING([--with-pkgconfigdir=dir],[Specify pkgconfig directory]), | ||
15 | [ | ||
16 | if test "${withval}" = "no" ; then | ||
17 | WANT_PKGCONFIG="no" | ||
18 | else | ||
19 | PKGCONFIG_DIR="${withval}" | ||
20 | EXPLICIT_PKGCONFIGDIR="yes" | ||
21 | fi | ||
22 | ],[ | ||
23 | AC_MSG_CHECKING([for pkgconfig directory]) | ||
24 | PKGCONFIG_DIR="`${PKGCONFIG_PKGCONFIG} --debug 2>&1 | grep '^Scanning'| head -n 1 | cut -d\' -f2-|cut -d\' -f1`" | ||
25 | AC_MSG_RESULT([${PKGCONFIG_DIR}]) | ||
26 | ] | ||
27 | ) | ||
28 | if test -d "${PKGCONFIG_DIR}" ; then | ||
29 | HAVE_PKGCONFIG=yes | ||
30 | AC_SUBST([PKGCONFIG_PKGCONFIG]) | ||
31 | AC_SUBST([PKGCONFIG_DIR]) | ||
32 | else | ||
33 | AC_MSG_NOTICE([unexistent pkgconfig directory: ${PKGCONFIG_DIR}]) | ||
34 | if test "${EXPLICIT_PKGCONFIGDIR}" = "yes" ; then | ||
35 | HAVE_PKGCONFIG=yes | ||
36 | AC_SUBST([PKGCONFIG_PKGCONFIG]) | ||
37 | AC_SUBST([PKGCONFIG_DIR]) | ||
38 | else | ||
39 | ifelse([$2], , :, [$2]) | ||
40 | fi | ||
41 | fi | ||
42 | fi | ||
43 | AM_CONDITIONAL([HAVE_PKGCONFIG],[test "${HAVE_PKGCONFIG}" = "yes"]) | ||
44 | ]) | ||
45 | |||
46 | dnl AC_WITH_DOXYGEN([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]) | ||
47 | dnl Outputs: | ||
48 | dnl AC_SUBST: DOXYGEN HAVE_DOXYGEN | ||
49 | dnl AM_CONDTIONAL: HAVE_DOXYGEN | ||
50 | AC_DEFUN([AC_WITH_DOXYGEN],[ | ||
51 | HAVE_DOXYGEN="no" | ||
52 | AC_PATH_PROG([DOXYGEN],[doxygen],[false]) | ||
53 | if test "${DOXYGEN}" = "false" ; then | ||
54 | ifelse([$2], , :, [$2]) | ||
55 | else | ||
56 | HAVE_DOXYGEN="yes" | ||
57 | AC_SUBST([DOXYGEN]) | ||
58 | $1 | ||
59 | fi | ||
60 | AC_SUBST([HAVE_DOXYGEN]) | ||
61 | AM_CONDITIONAL([HAVE_DOXYGEN],[test "${HAVE_DOXYGEN}" = "yes"]) | ||
62 | ]) | ||
63 | |||
64 | dnl AC_WITH_DOT([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]) | ||
65 | dnl Outputs: | ||
66 | dnl AC_SUBST: DOT HAVE_DOT | ||
67 | dnl AM_CONDITIONAL: HAVE_DOT | ||
68 | AC_DEFUN([AC_WITH_DOT],[ | ||
69 | HAVE_DOT="no" | ||
70 | AC_PATH_PROG([DOT],[dot],[false]) | ||
71 | if test "${DOT}" = "false" ; then | ||
72 | ifelse([$2], , :, [$2]) | ||
73 | else | ||
74 | HAVE_DOT="yes" | ||
75 | AC_SUBST([DOT]) | ||
76 | $1 | ||
77 | fi | ||
78 | AC_SUBST([HAVE_DOT]) | ||
79 | AM_CONDITIONAL([HAVE_DOT],[test "${HAVE_DOT}" = "yes"]) | ||
80 | ]) | ||
81 | |||
82 | dnl AC_WITH_PCRE([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]) | ||
83 | dnl Outputs: | ||
84 | dnl AC_SUBST: PCRE_CONFIG PCRE_PREFIX PCRE_EXEC_PREFIX | ||
85 | dnl PCRE_VERSION PCRE_CFLAGS PCRE_LIBS | ||
86 | dnl PCRE_LIBS_POSIX PCRE_CFLAGS_POSIX | ||
87 | dnl AM_CONDITIONAL: HAVE_PCRE | ||
88 | dnl AC_DEFINE: HAVE_PCRE PCRE_VERSION | ||
89 | AC_DEFUN([AC_WITH_PCRE],[ | ||
90 | HAVE_PCRE="no" | ||
91 | PCRE_CONFIG="" | ||
92 | PCRE_PREFIX="" | ||
93 | PCRE_EXEC_PREFIX="" | ||
94 | PCRE_VERSION="" | ||
95 | PCRE_CFLAGS="" | ||
96 | PCRE_LIBS="" | ||
97 | PCRE_LOCATIONS="${PATH}:/usr/local/bin:/usr/bin" | ||
98 | test -z "$WANT_PCRE" && WANT_PCRE="" | ||
99 | AC_ARG_WITH([pcre], | ||
100 | AC_HELP_STRING([--with-pcre=location],[Look for pcre in specified locations]), | ||
101 | [ | ||
102 | if test "${withval}" = "no" ; then | ||
103 | WANT_PCRE="no" | ||
104 | else | ||
105 | if test -x "${withval}" ; then | ||
106 | PCRE_CONFIG="${withval}" | ||
107 | elif test -x "${withval}/pcre-config" ; then | ||
108 | PCRE_CONFIG="${withval}/pcre-config" | ||
109 | elif test -x "${withval}/bin/pcre-config" ; then | ||
110 | PCRE_CONFIG="${withval}/bin/pcre-config" | ||
111 | fi | ||
112 | fi | ||
113 | ] | ||
114 | ) | ||
115 | if test "${WANT_PCRE}" = "no" ; then | ||
116 | ifelse([$2], , :, [$2]) | ||
117 | else | ||
118 | if test -z "${PCRE_CONFIG}" ; then | ||
119 | AC_PATH_PROG(PCRE_CONFIG,[pcre-config],false,[${PCRE_LOCATIONS}]) | ||
120 | if test "${PCRE_CONFIG}" = "false" ; then | ||
121 | ifelse([$2], , :, [$2]) | ||
122 | else | ||
123 | HAVE_PCRE="yes" | ||
124 | PCRE_PREFIX="`${PCRE_CONFIG} --prefix`" | ||
125 | PCRE_EXEC_PREFIX="`${PCRE_CONFIG} --exec-prefix`" | ||
126 | PCRE_VERSION="`${PCRE_CONFIG} --version`" | ||
127 | PCRE_CFLAGS="`${PCRE_CONFIG} --cflags`" | ||
128 | PCRE_LIBS="`${PCRE_CONFIG} --libs`" | ||
129 | PCRE_CFLAGS_POSIX="`${PCRE_CONFIG} --cflags-posix`" | ||
130 | PCRE_LIBS_POSIX="`${PCRE_CONFIG} --libs-posix`" | ||
131 | AC_SUBST([PCRE_CONFIG]) | ||
132 | AC_SUBST([PCRE_PREFIX]) | ||
133 | AC_SUBST([PCRE_EXEC_PREFIX]) | ||
134 | AC_SUBST([PCRE_VERSION]) | ||
135 | AC_SUBST([PCRE_CFLAGS]) | ||
136 | AC_SUBST([PCRE_LIBS]) | ||
137 | AC_SUBST([PCRE_CFLAGS_POSIX]) | ||
138 | AC_SUBST([PCRE_LIBS_POSIX]) | ||
139 | AC_DEFINE([HAVE_PCRE],,[pcre support]) | ||
140 | AC_DEFINE_UNQUOTED([PCRE_VERSION],["${PCRE_VERSION}"],[pcre version]) | ||
141 | $1 | ||
142 | fi | ||
143 | fi | ||
144 | fi | ||
145 | AM_CONDITIONAL([HAVE_PCRE],[test "${HAVE_PCRE}" = "yes"]) | ||
146 | ]) | ||
147 | |||
148 | dnl AC_WITH_PCREPP([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]) | ||
149 | dnl Outputs: | ||
150 | dnl AC_SUBST: PCREPP_CONFIG PCREPP_PREFIX PCREPP_EXEC_PREFIX | ||
151 | dnl PCREPP_VERSION PCREPP_CFLAGS PCREPP_LIBS | ||
152 | dnl AM_CONDITIONAL: HAVE_PCREPP | ||
153 | dnl AC_DEFINE: HAVE_PCREPP PCREPP_VERSION | ||
154 | AC_DEFUN([AC_WITH_PCREPP],[ | ||
155 | HAVE_PCREPP="no" | ||
156 | PCREPP_CONFIG="" | ||
157 | PCREPP_PREFIX="" | ||
158 | PCREPP_EXEC_PREFIX="" | ||
159 | PCREPP_VERSION="" | ||
160 | PCREPP_CFLAGS="" | ||
161 | PCREPP_LIBS="" | ||
162 | PCREPP_LOCATIONS="${PATH}:/usr/local/bin:/usr/bin" | ||
163 | test -z "$WANT_PCREPP" && WANT_PCREPP="" | ||
164 | AC_ARG_WITH([pcre++], | ||
165 | AC_HELP_STRING([--with-pcre++=location],[Look for pcre++ in specified locations]), | ||
166 | [ | ||
167 | if test "${withval}" = "no" ; then | ||
168 | WANT_PCREPP="no" | ||
169 | else | ||
170 | if test -x "${withval}" ; then | ||
171 | PCREPP_CONFIG="${withval}" | ||
172 | elif test -x "${withval}/pcre++-config" ; then | ||
173 | PCREPP_CONFIG="${withval}/pcre++-config" | ||
174 | elif test -x "${withval}/bin/pcre++-config" ; then | ||
175 | PCREPP_CONFIG="${withval}/bin/pcre++-config" | ||
176 | fi | ||
177 | fi | ||
178 | ] | ||
179 | ) | ||
180 | if test "${WANT_PCREPP}" = "no" ; then | ||
181 | ifelse([$2], , :, [$2]) | ||
182 | else | ||
183 | if test "${HAVE_PCRE}" != "yes" ; then | ||
184 | ifelse([$2], , :, [$2]) | ||
185 | else | ||
186 | if test -z "${PCREPP_CONFIG}" ; then | ||
187 | AC_PATH_PROG([PCREPP_CONFIG],[pcre++-config],false,[${PCREPP_LOCATIONS}]) | ||
188 | if test "${PCREPP_CONFIG}" = "false" ; then | ||
189 | ifelse([$2], , :, [$2]) | ||
190 | else | ||
191 | HAVE_PCREPP="yes" | ||
192 | PCREPP_PREFIX="`${PCREPP_CONFIG} --prefix`" | ||
193 | PCREPP_EXEC_PREFIX="`${PCREPP_CONFIG} --exec-prefix`" | ||
194 | PCREPP_VERSION="`${PCREPP_CONFIG} --version`" | ||
195 | PCREPP_CFLAGS="`${PCREPP_CONFIG} --cflags` ${PCRE_CFLAGS}" | ||
196 | PCREPP_LIBS="`${PCREPP_CONFIG} --libs` ${PCRE_LIBS}" | ||
197 | AC_SUBST([PCREPP_CONFIG]) | ||
198 | AC_SUBST([PCREPP_PREFIX]) | ||
199 | AC_SUBST([PCREPP_EXEC_PREFIX]) | ||
200 | AC_SUBST([PCREPP_VERSION]) | ||
201 | AC_SUBST([PCREPP_CFLAGS]) | ||
202 | AC_SUBST([PCREPP_LIBS]) | ||
203 | AC_DEFINE([HAVE_PCREPP],,[pcre++ support]) | ||
204 | AC_DEFINE_UNQUOTED([PCREPP_VERSION],["${PCREPP_VERSION}"],[pcre++ version]) | ||
205 | $1 | ||
206 | fi | ||
207 | fi | ||
208 | fi | ||
209 | fi | ||
210 | AM_CONDITIONAL([HAVE_PCREPP],[test "${HAVE_PCREPP}" = "yes"]) | ||
211 | ]) | ||