1 # Process this file with autoconf to produce a configure script.
2 # $Id: configure.ac,v 1.49 2009/04/20 12:05:23 neil Exp $
3
4 # Update the variable below (left) with the new build/version number
5 m4_define([TINATOOLVERSION], [6.0rcbuild008])
6
7 # code start
8
9 AC_INIT([tina-tools],[TINATOOLVERSION],[bugs@tina-vision.net])
10 AM_INIT_AUTOMAKE(tina-tools, TINATOOLVERSION)
11 AC_CONFIG_SRCDIR([tinatool/tlbase/tlbaseDef.h])
12 AC_CONFIG_HEADERS([config.h])
13 # prefix location for libraries is within build directory
14 AC_PREFIX_DEFAULT([`pwd`]) dnl NB Can lose on automounted filesystem
15
16 AM_MAINTAINER_MODE
17
18 # Check system
19
20 # This used to use AC_CYGWIN, AC_MINGw32, which test the host,
21 # not the target.
22 CYGWIN=no; MINGW32=no
23 case $target_os in
24 *cygwin*) CYGWIN=yes;;
25 *mingw32*) MINGW32=yes;;
26 esac
27
28
29 if test x${MINGW32} == xyes; then
30 AC_DEFINE([_PCC], [1], [Define to 1 if MINGW32])
31 AC_DEFINE([MINGW], [1], [Define to 1 if MINGW32])
32 fi
33
34 # Checks for programs.
35 AC_PROG_CC
36 AC_GNU_SOURCE
37 AC_DISABLE_SHARED
38 AC_PROG_LIBTOOL
39 AC_PROG_INSTALL
40 AC_PROG_AWK
41
42 AC_DEFINE([__EXTENSIONS__], ,
43 [Define to get various extensions in headers on Solaris, for instance]) dnl might cause trouble elsewhere....
44
45 AC_C_BIGENDIAN(AC_DEFINE([BIG_ENDIAN_ARCHITECTURE], 1,
46 [Define to 1 on a big-endian system.]),
47 AC_DEFINE([LITTLE_ENDIAN_ARCHITECTURE], 1,
48 [Define to 1 on a little-endian system.]))
49
50 # Checks for libraries.
51 AC_CHECK_LIB(m, pow)
52
53 # Checks for header files.
54 AC_HEADER_STDC
55 AC_HEADER_DIRENT
56
57 #
58 # flags returned as GTK so we copy them to GTK2 flags
59 #
60 dnl AM_PATH_GTK_2_0(,,)
61 GTK2_CFLAGS=${GTK_CFLAGS}
62 GTK2_LIBS=${GTK_LIBS}
63 no_gtk2=${no_gtk}
64 PKG_CHECK_MODULES([GTK2], [gtk+-2.0 >= 2.0], , [no_gtk2=yes])
65 # extra compile flag for GTK2 on MinGW
66 if test x${no_gtk2} != xyes; then
67 if test x${MINGW32} == xyes; then
68 GTK2_CFLAGS="${GTK2_CFLAGS} -mms-bitfields"
69 fi
70 fi
71
72 #
73 # Find the location of the tina-libs includes and libraries. If they are not specified to the
74 # configure command, search in some likely places. Test the results by compiling one of the
75 # headers and linking to one of the libraries.
76 #
77
78 AC_ARG_WITH(tina-includes,
79 [ --with-tina-includes[=DIR] tina include files are in DIR],
80 [tina_includes="$withval"],
81 [tina_includes=])
82
83 AC_ARG_WITH(tina-libraries,
84 [ --with-tina-libraries[=DIR] tina libraries are in DIR],
85 [tina_libraries="$withval"],
86 [tina_libraries=])
87
88 #
89 # search for tina include files
90 #
91
92 if test "$tina_includes" = ""; then
93 AC_CACHE_VAL(ac_cv_tina_includes,
94 [
95 ac_tina_save_LIBS="$LIBS"
96 ac_tina_save_INCLUDES="$INCLUDES"
97 ac_tina_save_CPPFLAGS="$CPPFLAGS"
98 ac_tina_save_LDFLAGS="$LDFLAGS"
99 #
100 LIBS="$LIBS"
101 INCLUDES="$INCLUDES"
102 CPPFLAGS="$CPPFLAGS"
103 LDFLAGS="$LDFLAGS"
104 #
105 ac_cv_tina_includes="none"
106 AC_TRY_COMPILE([#include <tina/sys/sysDef.h>],[int a;],
107 [
108 # tina/sys/sysDef.h is in the standard search path.
109 ac_cv_tina_includes=
110 ],
111 [
112 # tina/sys/sysDef.h is not in the standard search path.
113 # Locate it and put its directory in `tina_includes'
114 #
115 # Lets guess where things might be
116 # Its usual to have tina-libs<version> alongside the tina-tools for instance
117 # or maybe the includes are in a standard place?
118 ac_tina_curdir=`pwd`
119 for dir in "${src}" "${src}"/* "${src}"/../tina-libs* \
120 "${ac_tina_curdir}" "${ac_tina_curdir}"/* "${ac_tina_curdir}"/../tina-libs* \
121 /usr/local/tina-libs* /usr/tina-libs* /usr/local/src/tina-libs* /usr/src/tina-libs* \
122 /usr/include /usr/local/include /usr/local/*/include \
123 /usr/include/* /usr/local/include/*; do
124 if test -f "$dir/tina/sys/sysDef.h"; then
125 ac_cv_tina_includes="$dir"
126 break
127 fi
128 done
129 ])
130 #
131 LIBS="$ac_tina_save_LIBS"
132 INCLUDES="$ac_tina_save_INCLUDES"
133 CPPFLAGS="$ac_tina_save_CPPFLAGS"
134 LDFLAGS="$ac_tina_save_LDFLAGS"
135 ])
136 tina_includes="$ac_cv_tina_includes"
137 fi
138
139
140 #
141 # Now for the libraries.
142 #
143 if test "$tina_libraries" = ""; then
144 AC_CACHE_VAL(ac_cv_tina_libraries,
145 [
146 ac_tina_save_LIBS="$LIBS"
147 ac_tina_save_INCLUDES="$INCLUDES"
148 ac_tina_save_CPPFLAGS="$CPPFLAGS"
149 ac_tina_save_LDFLAGS="$LDFLAGS"
150
151 #
152 # try and link to the tinaSys library
153 #
154 LIBS="-ltinaSys $LIBS"
155 INCLUDES="$INCLUDES $tina_includes"
156 CPPFLAGS="$CPPFLAGS"
157 LDFLAGS="$LDFLAGS"
158 #
159 ac_cv_tina_libraries="none"
160 AC_TRY_LINK([#include <tina/sys/sysPro.h>],[ralloc(2);],
161 [
162 # if this works libtinaSys is in the standard search path.
163 ac_cv_tina_libraries=
164 ],
165 [
166 # libtinaSys not in the standard search path.
167 # Locate it and put its directory in `tina_libraries'
168 #
169 # As with the includes we look in "that kind of place"!
170 #
171 for dir in "${src}"/lib "${src}"/*/lib "${src}"/../tina-libs*/lib \
172 "${ac_tina_curdir}"/lib "${ac_tina_curdir}"/*/lib "${ac_tina_curdir}"/../tina-libs*/lib \
173 /usr/local/tina-libs* /usr/tina-libs* /usr/local/src/tina-libs* /usr/src/tina-libs* \
174 /usr/lib /usr/local/lib /usr/local/*/lib \
175 /usr/lib/* /usr/local/*/lib; do
176 if test -d "$dir" && test "`ls $dir/libtinaSys.* 2> /dev/null`" != ""; then
177 ac_cv_tina_libraries="$dir"
178 break
179 fi
180 done
181 ])
182 #
183 LIBS="$ac_tina_save_LIBS"
184 INCLUDES="$ac_tina_save_INCLUDES"
185 CPPFLAGS="$ac_tina_save_CPPFLAGS"
186 LDFLAGS="$ac_tina_save_LDFLAGS"
187 ])
188 #
189 tina_libraries="$ac_cv_tina_libraries"
190 fi
191 #
192
193 AC_CHECK_HEADERS([memory.h errno.h stdlib.h string.h limits.h sys/param.h stdarg.h varargs.h])
194
195 # Checks for typedefs, structures, and compiler characteristics.
196 AC_C_CONST
197 AC_TYPE_MODE_T
198 AC_TYPE_SIZE_T
199 AC_STRUCT_TM
200 AC_HEADER_TIME
201 AC_TYPE_UID_T
202
203 # Checks for library functions.
204 AC_FUNC_ERROR_AT_LINE
205 AC_FUNC_FNMATCH
206 AC_FUNC_MALLOC
207 AC_FUNC_STAT
208 AC_FUNC_VPRINTF
209 AC_CHECK_FUNCS([floor memcpy memset strchr pow sqrt scandir])
210 AC_TYPE_SIGNAL
211
212 #
213 # Checks for how the system handles va_list
214 # paul.bromiley@man.ac.uk
215 #
216 dnl **** Check for va_copy ****
217 AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
218 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[va_list ap1, ap2;
219 va_copy(ap1,ap2);
220 ]])],[ac_cv_c_va_copy="yes"],[ac_cv_c_va_copy="no"])
221 )
222 if test "$ac_cv_c_va_copy" = "yes"
223 then
224 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
225 fi
226 AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
227 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[va_list ap1, ap2;
228 __va_copy(ap1,ap2);
229 ]])],[ac_cv_c___va_copy="yes"],[ac_cv_c___va_copy="no"])
230 )
231 if test "$ac_cv_c___va_copy" = "yes"
232 then
233 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
234 fi
235
236 #
237 # Does this platform require array notation to assign to a va_list?
238 #
239 AC_MSG_CHECKING(va_list assignments need array notation)
240 AC_CACHE_VAL(ac_cv_valistisarray,
241 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
242 #include <stdarg.h>
243 void foo(int i, ...) {
244 va_list ap1, ap2;
245 va_start(ap1, i);
246 ap2 = ap1;
247 if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123) { exit(1); }
248 va_end(ap1); va_end(ap2);
249 }
250 int main()
251 { foo(0, 123); return(0); }]])],[ac_cv_valistisarray=false],[ac_cv_valistisarray=true],[ac_cv_valistisarray=false])])
252
253 if test "$ac_cv_valistisarray" = true ; then
254 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY, 1, [Define if we have va_copy])
255 AC_MSG_RESULT(yes)
256 else
257 AC_MSG_RESULT(no)
258 fi
259
260 # expose variables
261 AC_SUBST(GTK2_CFLAGS)
262 AC_SUBST(GTK2_LIBS)
263 AC_SUBST(tina_includes)
264 AC_SUBST(tina_libraries)
265
266 AM_CONDITIONAL(BUILD_GTK2_LIBS, test x$no_gtk2 != xyes)
267
268 # doings
269 # NOTE: do not break the following lines with '\' as this causes problems under Cygwin (ipoole,28/1/03)
270 AC_CONFIG_FILES(Makefile tinatool/Makefile tinatool/draw/Makefile tinatool/gphx/Makefile tinatool/gphx/gdk2/Makefile tinatool/wdgts/Makefile tinatool/wdgts/gtk2/Makefile tinatool/tlbase/Makefile tinatool/tlmedical/Makefile tinatool/tlvision/Makefile toolkits/Makefile toolkits/example/Makefile toolkits/example2/Makefile toolkits/mri_analysis/Makefile)
271 AC_OUTPUT
272
273 # finale
274 AC_MSG_RESULT([
275
276 tinatool configuration complete for ${host}.
277
278 Source directory: ${srcdir}
279 Installation directory: ${prefix}
280 C compiler: ${CC} ])
281
282
283 if test "$tina_includes" = none || test "$tina_libraries" = none || test "$no_gtk2" = yes; then
284
285 if test "$tina_includes" = none; then
286 AC_MSG_NOTICE([tina-libs headers not found: see --with-tina-includes flag])
287 fi
288
289 if test "$tina_libraries" = none; then
290 AC_MSG_NOTICE([tina-libs libraries not found: see --with-tina-libraries flag])
291 fi
292
293 if test "$no_gtk2" = yes; then
294 AC_MSG_NOTICE([GTK2 not found: please install prior to installing TINA])
295 fi
296
297 AC_MSG_RESULT([
298 The configuration has failed. Please attend to the messages above and try again.
299 Do not bother typing 'make' as the build will fail!])
300
301 else
302
303 AC_MSG_RESULT([
304 tina-libs headers: ${tina_includes}
305 tina-libs libraries: ${tina_libraries}
306
307 GTK2 flags: ${GTK2_CFLAGS}
308 GTK2 libraries: ${GTK2_LIBS}])
309
310 AC_MSG_RESULT([
311 Configuration successful! Now type 'make' to build the libraries and then
312 'make install' to install the libraries into the prefix location.])
313 fi
314
315 # I thank you!
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.