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], [5.0rcbuild106])
6
7 # code start
8
9 AC_INIT([tinatool],[TINATOOLVERSION],[bugs@tina-vision.net])
10 AM_INIT_AUTOMAKE(tinatool, 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 AC_PROG_RANLIB
42
43 AC_DEFINE([__EXTENSIONS__], ,
44 [Define to get various extensions in headers on Solaris, for instance]) dnl might cause trouble elsewhere....
45
46 AC_C_BIGENDIAN(AC_DEFINE([BIG_ENDIAN_ARCHITECTURE], 1,
47 [Define to 1 on a big-endian system.]),
48 AC_DEFINE([LITTLE_ENDIAN_ARCHITECTURE], 1,
49 [Define to 1 on a little-endian system.]))
50
51 # Checks for libraries.
52 AC_CHECK_LIB(m, pow)
53
54 # Checks for header files.
55 AC_HEADER_STDC
56 AC_HEADER_DIRENT
57 AC_PATH_X
58 AC_PATH_XTRA
59 AC_FIND_MOTIF
60 AC_FIND_XVIEW
61
62 #
63 # flags returned as GTK so we copy them to
64 # GTK2 flags
65 dnl AM_PATH_GTK_2_0(,,)
66 GTK2_CFLAGS=${GTK_CFLAGS}
67 GTK2_LIBS=${GTK_LIBS}
68 no_gtk2=${no_gtk}
69 PKG_CHECK_MODULES([GTK2], [gtk+-2.0 >= 2.0], , [no_gtk2=yes])
70 # extra compile flag for GTK2 on MinGW
71 if test x${no_gtk2} != xyes; then
72 if test x${MINGW32} == xyes; then
73 GTK2_CFLAGS="${GTK2_CFLAGS} -mms-bitfields"
74 fi
75 fi
76
77 AM_PATH_GTK(,,)
78 AC_FIND_TINA
79 SC_PATH_TCLCONFIG
80 if test x${no_tcl} != xtrue; then
81 SC_LOAD_TCLCONFIG
82 fi
83 SC_PATH_TKCONFIG
84 if test x${no_tk} != xtrue; then
85 SC_LOAD_TKCONFIG
86 fi
87 AC_CHECK_HEADERS([memory.h errno.h stdlib.h string.h limits.h \
88 sys/param.h stdarg.h varargs.h])
89
90 # Checks for typedefs, structures, and compiler characteristics.
91 AC_C_CONST
92 AC_TYPE_MODE_T
93 AC_TYPE_SIZE_T
94 AC_STRUCT_TM
95 AC_HEADER_TIME
96 AC_TYPE_UID_T
97
98 # Checks for library functions.
99 AC_FUNC_ERROR_AT_LINE
100 AC_FUNC_FNMATCH
101 AC_FUNC_MALLOC
102 AC_FUNC_STAT
103 AC_FUNC_VPRINTF
104 AC_CHECK_FUNCS([floor memcpy memset strchr pow sqrt scandir])
105 AC_TYPE_SIGNAL
106
107 #
108 # Checks for how the system handles va_list
109 # paul.bromiley@man.ac.uk
110 #
111 dnl **** Check for va_copy ****
112 AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
113 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[va_list ap1, ap2;
114 va_copy(ap1,ap2);
115 ]])],[ac_cv_c_va_copy="yes"],[ac_cv_c_va_copy="no"])
116 )
117 if test "$ac_cv_c_va_copy" = "yes"
118 then
119 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
120 fi
121 AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
122 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[va_list ap1, ap2;
123 __va_copy(ap1,ap2);
124 ]])],[ac_cv_c___va_copy="yes"],[ac_cv_c___va_copy="no"])
125 )
126 if test "$ac_cv_c___va_copy" = "yes"
127 then
128 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
129 fi
130
131 #
132 # Does this platform require array notation to assign to a va_list?
133 #
134 AC_MSG_CHECKING(va_list assignments need array notation)
135 AC_CACHE_VAL(ac_cv_valistisarray,
136 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
137 #include <stdarg.h>
138 void foo(int i, ...) {
139 va_list ap1, ap2;
140 va_start(ap1, i);
141 ap2 = ap1;
142 if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123) { exit(1); }
143 va_end(ap1); va_end(ap2);
144 }
145 int main()
146 { foo(0, 123); return(0); }]])],[ac_cv_valistisarray=false],[ac_cv_valistisarray=true],[ac_cv_valistisarray=false])])
147
148 if test "$ac_cv_valistisarray" = true ; then
149 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY, 1, [Define if we have va_copy])
150 AC_MSG_RESULT(yes)
151 else
152 AC_MSG_RESULT(no)
153 fi
154
155 # expose variables
156 AC_SUBST(x_includes)
157 AC_SUBST(x_libraries)
158 AC_SUBST(X_CFLAGS)
159 AC_SUBST(X_LIBS)
160 AC_SUBST(include_xview)
161 AC_SUBST(XVIEW_LIBS)
162 AC_SUBST(include_motif)
163 AC_SUBST(MOTIF_LIBS)
164 AC_SUBST(GTK2_CFLAGS)
165 AC_SUBST(GTK2_LIBS)
166 AC_SUBST(GTK_CFLAGS)
167 AC_SUBST(GTK_LIBS)
168 AC_SUBST(tina_includes)
169 AC_SUBST(tina_libraries)
170 AC_SUBST(TCL_INCLUDE_SPEC)
171 AC_SUBST(TK_XINCLUDES)
172 AC_SUBST(TCL_LIB_SPEC)
173 AC_SUBST(TK_LIB_SPEC)
174
175 # build conditionals
176 if test -n "$TCL_VERSION"; then
177 if test "$TCL_MAJOR_VERSION" = 8; then
178 with_tcl="yes"
179 AC_DEFINE([HAVE_TCL_H], [1], [Define to 1 if <tcl.h> is found])
180 fi
181 fi
182
183 # build conditionals
184 if test -n "$TK_VERSION"; then
185 if test "$TK_MAJOR_VERSION" = 8; then
186 with_tk="yes"
187 AC_DEFINE([HAVE_TK_H], [1], [Define to 1 if <tk.h> is found])
188 fi
189 fi
190
191
192 AM_CONDITIONAL(BUILD_X11_LIBS, test x$no_x != xno)
193 AM_CONDITIONAL(BUILD_XVIEW_LIBS, test x$with_xview = xyes)
194 AM_CONDITIONAL(BUILD_MOTIF_LIBS, test x$with_motif = xyes)
195 AM_CONDITIONAL(BUILD_GTK_LIBS, test x$no_gtk != xyes)
196 AM_CONDITIONAL(BUILD_GTK2_LIBS, test x$no_gtk2 != xyes)
197 AM_CONDITIONAL(BUILD_TCL_LIBS, test x$with_tcl = xyes)
198
199 # doings
200 # NOTE: do not break the following lines with '\' ans this causes problems under Cygwin (ipoole,28/1/03)
201 AC_CONFIG_FILES(Makefile tinatool/Makefile tinatool/draw/Makefile tinatool/gphx/Makefile tinatool/gphx/null/Makefile tinatool/gphx/x11/Makefile tinatool/gphx/gdk/Makefile tinatool/gphx/gdk2/Makefile tinatool/wdgts/Makefile tinatool/wdgts/null/Makefile tinatool/wdgts/xv/Makefile tinatool/wdgts/xm/Makefile tinatool/wdgts/tcl/Makefile tinatool/wdgts/gtk/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)
202 AC_OUTPUT
203
204 # finale
205 AC_MSG_RESULT([
206
207 tinatool configuration complete for ${host}.
208
209 Source directory: ${srcdir}
210 Installation directory: ${prefix}
211 C compiler: ${CC} ])
212
213 AC_MSG_RESULT([
214 tina-libs headers: ${tina_includes}
215 tina-libs libraries: ${tina_libraries}])
216
217 if test "$no_x" != yes; then
218 AC_MSG_RESULT([
219 X11 headers: ${X_CFLAGS}
220 X11 libraries: ${X_LIBS}])
221 else
222 AC_MSG_RESULT([
223 X11 NOT FOUND Error])
224 failed="yes"
225 fi
226
227 if test "$no_gtk2" != no; then
228 AC_MSG_RESULT([
229 GTK2 flags: ${GTK2_CFLAGS}
230 GTK2 libraries: ${GTK2_LIBS} ])
231 else
232 AC_MSG_RESULT([
233 GTK2 NOT FOUND Warning])
234 fi
235
236 if test "$no_gtk" != no; then
237 AC_MSG_RESULT([
238 GTK flags: ${GTK_CFLAGS}
239 GTK libraries: ${GTK_LIBS} ])
240 else
241 AC_MSG_RESULT([
242 GTK NOT FOUND Warning])
243 fi
244
245 if test "$with_xview" = yes; then
246 AC_MSG_RESULT([
247 Xview headers: ${include_xview}
248 Xview libraries: ${XVIEW_LIBS} ])
249 else
250 AC_MSG_RESULT([
251 Xview NOT FOUND Warning])
252 fi
253
254 if test "$with_motif" = yes; then
255 AC_MSG_RESULT([
256 Motif headers: ${include_motif}
257 Motif libraries: ${MOTIF_LIBS} ])
258 else
259 AC_MSG_RESULT([
260 Motif NOT FOUND Warning])
261 fi
262
263 if test "$with_tcl" = yes; then
264 AC_MSG_RESULT([
265 Tcl headers: ${TCL_INCLUDE_SPEC}
266 Tcl libraries: ${TCL_LIB_SPEC}
267 Tk headers: ${TK_XINCLUDES}
268 Tk libraries: ${TK_LIB_SPEC}])
269 else
270 AC_MSG_RESULT([
271 Tcl (>= Version 8) NOT FOUND Warning])
272 fi
273
274 if test "$no_gtk" = no; then
275 if test "$no_gtk2" = no; then
276 if test "$with_xview" != yes; then
277 if test "$with_motif" != yes; then
278 if test "$with_tcl" != yes; then
279 AC_MSG_RESULT([
280 No widget set available Error])
281 failed="yes"
282 fi
283 fi
284 fi
285 fi
286 fi
287
288 if test "$failed" = yes; then
289 AC_MSG_RESULT([
290 The configuration has failed. Please attend to the messages marked 'Error'
291 above and try again. Note that messages marked 'Warning' are not necessarily
292 a problem.
293
294 Do not bother typing 'make' as the build will fail!])
295 else
296 AC_MSG_RESULT([
297 Configuration sucessful! Now type 'make' to build the libraries and then
298 'make install' to install the libraries into the prefix location.
299 ])
300 fi
301
302 # I thank you!
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.