]>
Commit | Line | Data |
---|---|---|
1 | dnl Process this file with autoconf to produce a configure script. | |
2 | AC_INIT(Include/swig.h) | |
3 | AC_PREREQ(2.0) | |
4 | ||
5 | # Set name for machine-dependent library files | |
6 | AC_SUBST(MACHDEP) | |
7 | AC_MSG_CHECKING(MACHDEP) | |
8 | if test -z "$MACHDEP" | |
9 | then | |
10 | if test -f /usr/lib/NextStep/software_version; then | |
11 | set X `hostinfo | grep 'NeXT Mach.*:' | \ | |
12 | sed -e 's/://' -e 's/\./_/'` && \ | |
13 | ac_sys_system=next && ac_sys_release=$4 | |
14 | MACHDEP="$ac_sys_system$ac_sys_release$ac_sys_cpu" | |
15 | else | |
16 | ac_sys_system=`uname -s` | |
17 | if test "$ac_sys_system" = "AIX" ; then | |
18 | ac_sys_release=`uname -v` | |
19 | else | |
20 | ac_sys_release=`uname -r` | |
21 | fi | |
22 | ac_md_system=`echo $ac_sys_system | | |
23 | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` | |
24 | ac_md_release=`echo $ac_sys_release | | |
25 | tr -d '[/ ]' | sed 's/\..*//'` | |
26 | MACHDEP="$ac_md_system$ac_md_release" | |
27 | fi | |
28 | case MACHDEP in | |
29 | '') MACHDEP=unknown;; | |
30 | esac | |
31 | fi | |
32 | AC_MSG_RESULT($MACHDEP) | |
33 | ||
34 | AC_LANG_CPLUSPLUS | |
35 | ||
36 | dnl Checks for programs. | |
37 | AC_PROG_CXX | |
38 | AC_PROG_CC | |
39 | AC_PROG_RANLIB | |
40 | ||
41 | AC_SUBST(AR) | |
42 | AC_CHECK_PROGS(AR, ar aal, ar) | |
43 | ||
44 | dnl Checks for header files. | |
45 | AC_HEADER_STDC | |
46 | dnl Checks for library functions. | |
47 | ||
48 | AC_FUNC_ALLOCA | |
49 | AC_ARG_WITH(lang,[ --with-lang=LANG Set SWIG target language (TCL,TCL8,PYTHON,PERL5,PERL4,GUILE)],[ | |
50 | AC_DEFINE_UNQUOTED(SWIG_LANG,$withval)], [AC_DEFINE(SWIG_LANG,PYTHON)]) | |
51 | ||
52 | AC_ARG_WITH(doc,[ --with-doc=DOC Set SWIG target documentation method (ASCII,LATEX,HTML,NODOC)], [ | |
53 | AC_DEFINE_UNQUOTED(SWIG_DOC,$withval)], [AC_DEFINE(SWIG_DOC,ASCII)]) | |
54 | ||
55 | AC_ARG_WITH(yacc,[ --without-yacc Try to compile without yacc/bison], [ | |
56 | YACC="cp parser.cxx.no y.tab.c; cp parser.h.no y.tab.h" | |
57 | AC_SUBST(YACC) | |
58 | YACCFLAGS="" | |
59 | AC_SUBST(YACCFLAGS) | |
60 | ], [ AC_PROG_YACC | |
61 | YACCFLAGS="-d parser.y" | |
62 | AC_SUBST(YACCFLAGS) ]) | |
63 | ||
64 | # This borrowed from the Python configuration file | |
65 | # Set info about shared libraries. | |
66 | ||
67 | AC_SUBST(SO) | |
68 | AC_SUBST(LDSHARED) | |
69 | AC_SUBST(CCSHARED) | |
70 | AC_SUBST(LINKFORSHARED) | |
71 | # SO is the extension of shared libraries `(including the dot!) | |
72 | # -- usually .so, .sl on HP-UX | |
73 | AC_MSG_CHECKING(SO) | |
74 | if test -z "$SO" | |
75 | then | |
76 | case $ac_sys_system in | |
77 | hp*|HP*) SO=.sl;; | |
78 | NeXT|next) SO=.a;; # no shared libs on NeXT 3.3 and less | |
79 | *) SO=.so;; | |
80 | esac | |
81 | fi | |
82 | AC_MSG_RESULT($SO) | |
83 | # LDSHARED is the ld *command* used to create shared library | |
84 | # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5 | |
85 | AC_MSG_CHECKING(LDSHARED) | |
86 | if test -z "$LDSHARED" | |
87 | then | |
88 | case $ac_sys_system/$ac_sys_release in | |
89 | AIX*) LDSHARED="ld_so_aix";; | |
90 | IRIX*) LDSHARED="ld -shared";; | |
91 | SunOS/4*) LDSHARED="ld";; | |
92 | SunOS/5*) LDSHARED="ld -G";; | |
93 | hp*|HP*) LDSHARED="ld -b";; | |
94 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; | |
95 | DYNIX/ptx*) LDSHARED="ld -G";; | |
96 | Linux*) LDSHARED="gcc -shared";; | |
97 | FreeBSD*) LDSHARED="ld -Bshareable";; | |
98 | NeXT|next/3*) LDSHARED="ld -u libsys_s";; | |
99 | *) LDSHARED="ld";; | |
100 | esac | |
101 | fi | |
102 | AC_MSG_RESULT($LDSHARED) | |
103 | # CCSHARED are the C *flags* used to create objects to go into a shared | |
104 | # library -- this is only needed for a few systems | |
105 | AC_MSG_CHECKING(CCSHARED) | |
106 | if test -z "$CCSHARED" | |
107 | then | |
108 | case $ac_sys_system in | |
109 | hp*|HP*) if test "$GCC" = yes; | |
110 | then CCSHARED="-fpic"; | |
111 | else CCSHARED="+z"; | |
112 | fi;; | |
113 | Linux*) CCSHARED="-fpic";; | |
114 | FreeBSD*) CCSHARED="-fpic";; | |
115 | esac | |
116 | fi | |
117 | AC_MSG_RESULT($CCSHARED) | |
118 | ||
119 | # LINKFORSHARED are the flags passed to the $(CC) command that links | |
120 | # the a few executables -- this is only needed for a few systems | |
121 | ||
122 | AC_MSG_CHECKING(LINKFORSHARED) | |
123 | if test -z "$LINKFORSHARED" | |
124 | then | |
125 | case $ac_sys_system/$ac_sys_release in | |
126 | AIX*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';; | |
127 | hp*|HP*) | |
128 | LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; | |
129 | Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; | |
130 | next/*) LINKFORSHARED="-u libsys_s";; | |
131 | SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; | |
132 | IRIX*/6*) LINKFORSHARED="-all";; | |
133 | esac | |
134 | fi | |
135 | AC_MSG_RESULT($LINKFORSHARED) | |
136 | ||
137 | echo "" | |
138 | echo "Checking for installed packages." | |
139 | echo "Note : None of the following packages are required to compile SWIG" | |
140 | echo "" | |
141 | ||
142 | # Check for specific libraries. Used for SWIG examples | |
143 | AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV | |
144 | AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX | |
145 | ||
146 | # The following three (nsl,inet,socket) are needed on Sequent; | |
147 | # the order of checking must be this. Most SVR4 platforms will | |
148 | # need -lsocket and -lnsl. However on SGI IRIX 5, these exist but | |
149 | # broken. I see no elegant solution (probably CHECK_LIB should be | |
150 | # fixed to only add the library if the given entry point is not | |
151 | # satisfied without it). | |
152 | if test "`uname -s`" != IRIX | |
153 | then | |
154 | AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 | |
155 | AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent | |
156 | AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets | |
157 | fi | |
158 | ||
159 | # check for --with-libm=... | |
160 | AC_SUBST(LIBM) | |
161 | LIBM=-lm | |
162 | AC_ARG_WITH(libm, [ --with-libm=STRING math library], [ | |
163 | if test "$withval" != yes | |
164 | then LIBM=$withval | |
165 | else AC_ERROR(proper usage is --with-libm=STRING) | |
166 | fi]) | |
167 | AC_CHECK_LIB(ieee, main, [LIBM="-lieee $LIBM"]) | |
168 | AC_CHECK_LIB(crypt,crypt, [LIBCRYPT="-lcrypt"]) | |
169 | AC_SUBST(LIBCRYPT) | |
170 | ||
171 | # check for --with-libc=... | |
172 | AC_SUBST(LIBC) | |
173 | AC_ARG_WITH(libc, [ --with-libc=STRING C library], [ | |
174 | if test "$withval" != yes | |
175 | then LIBC=$withval | |
176 | else AC_ERROR(proper usage is --with-libc=STRING) | |
177 | fi]) | |
178 | ||
179 | #-------------------------------------------------------------------- | |
180 | # Locate the X11 header files and the X11 library archive. Try | |
181 | # the ac_path_x macro first, but if it doesn't find the X stuff | |
182 | # (e.g. because there's no xmkmf program) then check through | |
183 | # a list of possible directories. Under some conditions the | |
184 | # autoconf macro will return an include directory that contains | |
185 | # no include files, so double-check its result just to be safe. | |
186 | #-------------------------------------------------------------------- | |
187 | ||
188 | AC_PATH_X | |
189 | not_really_there="" | |
190 | if test "$no_x" = ""; then | |
191 | if test "$x_includes" = ""; then | |
192 | AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes") | |
193 | else | |
194 | if test ! -r $x_includes/X11/Intrinsic.h; then | |
195 | not_really_there="yes" | |
196 | fi | |
197 | fi | |
198 | fi | |
199 | if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then | |
200 | AC_MSG_CHECKING(for X11 header files) | |
201 | XINCLUDES="# no special path needed" | |
202 | AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope") | |
203 | if test "$XINCLUDES" = nope; then | |
204 | dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include /usr/sww/include /usr/X11R6/include /usr/include/X11R6" | |
205 | for i in $dirs ; do | |
206 | if test -r $i/X11/Intrinsic.h; then | |
207 | AC_MSG_RESULT($i) | |
208 | XINCLUDES=" -I$i" | |
209 | break | |
210 | fi | |
211 | done | |
212 | fi | |
213 | else | |
214 | if test "$x_includes" != ""; then | |
215 | XINCLUDES=-I$x_includes | |
216 | else | |
217 | XINCLUDES="# no special path needed" | |
218 | fi | |
219 | fi | |
220 | if test "$XINCLUDES" = nope; then | |
221 | AC_MSG_RESULT(couldn't find any!) | |
222 | XINCLUDES="# no include files found" | |
223 | fi | |
224 | ||
225 | if test "$no_x" = yes; then | |
226 | AC_MSG_CHECKING(for X11 libraries) | |
227 | XLIBSW=nope | |
228 | dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/X11R6/lib /usr/lib/X11R6 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" | |
229 | for i in $dirs ; do | |
230 | if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then | |
231 | AC_MSG_RESULT($i) | |
232 | XLIBSW="-L$i -lX11" | |
233 | break | |
234 | fi | |
235 | done | |
236 | else | |
237 | if test "$x_libraries" = ""; then | |
238 | XLIBSW=-lX11 | |
239 | else | |
240 | XLIBSW="-L$x_libraries -lX11" | |
241 | fi | |
242 | fi | |
243 | if test "$XLIBSW" = nope ; then | |
244 | AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) | |
245 | fi | |
246 | if test "$XLIBSW" = nope ; then | |
247 | AC_MSG_RESULT(couldn't find any! Using -lX11.) | |
248 | XLIBSW=-lX11 | |
249 | fi | |
250 | ||
251 | AC_SUBST(XINCLUDES) | |
252 | AC_SUBST(XLIBSW) | |
253 | ||
254 | #-------------------------------------------------------------------- | |
255 | # Try to locate the Tcl package | |
256 | #-------------------------------------------------------------------- | |
257 | ||
258 | TCLINCLUDE=nope | |
259 | TCLLIB=nope | |
260 | TCLPACKAGE=nope | |
261 | ||
262 | AC_ARG_WITH(tcl,[ --with-tcl=path Set location of Tcl package],[ | |
263 | TCLPACKAGE="$withval"], [TCLPACKAGE=nope]) | |
264 | AC_ARG_WITH(tclincl,[ --with-tclincl=path Set location of Tcl include directory],[ | |
265 | TCLINCLUDE="-I$withval"], [TCLINCLUDE=nope]) | |
266 | AC_ARG_WITH(tcllib,[ --with-tcllib=path Set location of Tcl library directory],[ | |
267 | TCLLIB="-L$withval"], [TCLLIB=nope]) | |
268 | ||
269 | if test "$TCLINCLUDE" = nope; then | |
270 | if test "$TCLPACKAGE" != nope; then | |
271 | TCLINCLUDE="-I$TCLPACKAGE/include" | |
272 | fi | |
273 | fi | |
274 | ||
275 | if test "$TCLLIB" = nope; then | |
276 | if test "$TCLPACKAGE" != nope; then | |
277 | TCLLIB="-L$TCLPACKAGE/lib" | |
278 | fi | |
279 | fi | |
280 | ||
281 | AC_MSG_CHECKING(for Tcl header files) | |
282 | if test "$TCLINCLUDE" = nope; then | |
283 | AC_TRY_CPP([#include <tcl.h>], , TCLINCLUDE="nope") | |
284 | if test "$TCLINCLUDE" = nope; then | |
285 | dirs="$prefix/include /usr/local/include /usr/include /opt/local/include /home/sci/local/include" | |
286 | for i in $dirs ; do | |
287 | if test -r $i/tcl.h; then | |
288 | AC_MSG_RESULT($i) | |
289 | TCLINCLUDE="-I$i" | |
290 | break | |
291 | fi | |
292 | done | |
293 | fi | |
294 | if test "$TCLINCLUDE" = nope; then | |
295 | TCLINCLUDE="-I/usr/local/include" | |
296 | AC_MSG_RESULT(not found) | |
297 | fi | |
298 | else | |
299 | AC_MSG_RESULT($TCLINCLUDE) | |
300 | fi | |
301 | ||
302 | AC_MSG_CHECKING(for Tcl library) | |
303 | if test "$TCLLIB" = nope; then | |
304 | dirs="$prefix/lib /usr/local/lib /usr/lib /opt/local/lib /home/sci/local/lib" | |
305 | for i in $dirs ; do | |
306 | if test -r $i/libtcl.a; then | |
307 | AC_MSG_RESULT($i) | |
308 | TCLLIB="-L$i" | |
309 | break | |
310 | fi | |
311 | done | |
312 | if test "$TCLLIB" = nope; then | |
313 | AC_MSG_RESULT(not found) | |
314 | TCLLIB="-L/usr/local/lib" | |
315 | fi | |
316 | else | |
317 | AC_MSG_RESULT($TCLLIB) | |
318 | fi | |
319 | ||
320 | AC_SUBST(TCLINCLUDE) | |
321 | AC_SUBST(TCLLIB) | |
322 | ||
323 | #---------------------------------------------------------------- | |
324 | # Look for Python | |
325 | #---------------------------------------------------------------- | |
326 | ||
327 | PYINCLUDE=nope | |
328 | PYLIB=nope | |
329 | PYPACKAGE=nope | |
330 | PYLINK="-lModules -lPython -lObjects -lParser" | |
331 | ||
332 | AC_ARG_WITH(py,[ --with-py=path Set location of Python],[ | |
333 | PYPACKAGE="$withval"], [PYPACKAGE=nope]) | |
334 | AC_ARG_WITH(pyincl,[ --with-pyincl=path Set location of Python include directory],[ | |
335 | PYINCLUDE="$withval"], [PYINCLUDE=nope]) | |
336 | AC_ARG_WITH(pylib,[ --with-pylib=path Set location of Python library directory],[ | |
337 | PYLIB="$withval"], [PYLIB=nope]) | |
338 | ||
339 | if test "$PYINCLUDE" = nope; then | |
340 | if test "$PYPACKAGE" != nope; then | |
341 | PYINCLUDE="$PYPACKAGE/include" | |
342 | fi | |
343 | fi | |
344 | ||
345 | if test "$PYLIB" = nope; then | |
346 | if test "$PYPACKAGE" != nope; then | |
347 | PYLIB="$PYPACKAGE/lib" | |
348 | fi | |
349 | fi | |
350 | ||
351 | ||
352 | AC_MSG_CHECKING(for Python header files) | |
353 | ||
354 | dirs="$PYINCLUDE $PYINCLUDE/python1.5 $PYINCLUDE/python1.4 $PYINCLUDE/Py $prefix/include/python1.5 $prefix/include/python1.4 /usr/local/include/python1.5 /usr/include/python1.5 /usr/local/include/python1.4 /usr/include/python1.4 $prefix/include/Py /usr/local/include/Py /usr/include/Py" | |
355 | for i in $dirs ; do | |
356 | if test -r $i/Python.h; then | |
357 | AC_MSG_RESULT($i) | |
358 | PYINCLUDE="-I$i" | |
359 | break | |
360 | fi | |
361 | done | |
362 | if test "$PYINCLUDE" = nope; then | |
363 | PYINCLUDE="-I/usr/local/include/Py" | |
364 | AC_MSG_RESULT(not found) | |
365 | fi | |
366 | ||
367 | AC_MSG_CHECKING(for Python library) | |
368 | dirs="$PYLIB $PYLIB/config $PYLIB/lib $PYLIB/python1.5/config $PYLIB/python1.4/config $PYLIB/python/lib $prefix/lib/python1.5/config $prefix/lib/python1.4/config /usr/local/lib/python1.5/config /usr/lib/python1.5 /usr/local/lib/python1.4/config /usr/lib/python1.4 $prefix/lib/python/lib /usr/local/lib/python/lib /usr/lib/python/lib /home/sci/local/lib/python" | |
369 | ||
370 | for i in $dirs ; do | |
371 | if test -r $i/libpython1.5.a; then | |
372 | AC_MSG_RESULT($i) | |
373 | PYLIB="$i" | |
374 | PYINCLUDE="$PYINCLUDE -I$i" | |
375 | PYLINK="-lpython1.5" | |
376 | break | |
377 | fi | |
378 | if test -r $i/libPython.a; then | |
379 | AC_MSG_RESULT($i) | |
380 | PYLIB="$i" | |
381 | PYINCLUDE="$PYINCLUDE -I$i" | |
382 | break | |
383 | fi | |
384 | done | |
385 | if test "$PYLIB" = nope; then | |
386 | AC_MSG_RESULT(not found) | |
387 | PYLIB="/usr/local/lib/python/lib" | |
388 | PYINCLUDE="$PYINCLUDE -I$PYLIB" | |
389 | fi | |
390 | ||
391 | AC_SUBST(PYINCLUDE) | |
392 | AC_SUBST(PYLIB) | |
393 | AC_SUBST(PYLINK) | |
394 | ||
395 | #---------------------------------------------------------------- | |
396 | # Look for Perl5 | |
397 | #---------------------------------------------------------------- | |
398 | ||
399 | PERLBIN=nope | |
400 | ||
401 | AC_ARG_WITH(perl5,[ --with-perl5=path Set location of Perl5 executable],[ | |
402 | PERLBIN="$withval"], [PERLBIN=nope]) | |
403 | ||
404 | # First figure out what the name of Perl5 is | |
405 | ||
406 | if test "$PERLBIN" = nope; then | |
407 | AC_CHECK_PROGS(PERL, perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl,nope) | |
408 | else | |
409 | PERL="$PERLBIN" | |
410 | fi | |
411 | AC_MSG_CHECKING(for Perl5 header files) | |
412 | if test "$PERL" != nope; then | |
413 | PERL5DIR=`($PERL -e 'use Config; print $Config{archlib};') 2>/dev/null` | |
414 | if test "$PERL5DIR" != ""; then | |
415 | dirs="$PERL5DIR $PERL5DIR/CORE" | |
416 | PERL5EXT=none | |
417 | for i in $dirs; do | |
418 | if test -r $i/perl.h; then | |
419 | AC_MSG_RESULT($i) | |
420 | PERL5EXT="$i" | |
421 | break; | |
422 | fi | |
423 | done | |
424 | if test "$PERL5EXT" = none; then | |
425 | PERL5EXT="$PERL5DIR/CORE" | |
426 | AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT) | |
427 | fi | |
428 | else | |
429 | AC_MSG_RESULT(unable to determine perl5 configuration) | |
430 | PERL5EXT=$PERL5DIR | |
431 | fi | |
432 | else | |
433 | AC_MSG_RESULT(could not figure out how to run perl5) | |
434 | PERL5EXT="/usr/local/lib/perl/archname/5.003/CORE" | |
435 | fi | |
436 | ||
437 | AC_SUBST(PERL5EXT) | |
438 | ||
439 | AC_OUTPUT(Makefile SWIG/Makefile Modules/Makefile Runtime/Makefile swig_lib/tcl/Makefile swig_lib/python/Makefile swig_lib/perl5/Makefile) | |
440 | ||
441 | ||
442 | ||
443 | ||
444 | ||
445 |