File: configure.in

package info (click to toggle)
libtclobjc 1.4-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 316 kB
  • ctags: 78
  • sloc: objc: 2,116; makefile: 240; ansic: 186; sh: 175; tcl: 13
file content (416 lines) | stat: -rwxr-xr-x 13,560 bytes parent folder | download | duplicates (2)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
dnl configure.in for Tcl/Objective-C interface library
dnl Written by R. Andrew McCallum <mccallum@cs.rochester.edu>
dnl Process this file with autoconf to produce a configure script.
AC_INIT(TclInterp.m)

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB

# With a thread-safe gcc-2.8, -lobjc depends on -lpthread.
# This library will be needed to run the test programs below.
AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread")

# if the user didn't specify a prefix on the command line, set prefix
# same as used for tcl 
AC_PREFIX_PROGRAM(tclsh)
AC_SUBST(prefix)

#--------------------------------------------------------------------
# Find out if we're on a NeXT, 
# if not:
#   include implementations of List and HashTable objects 
#   check to make sure the gcc.patch has been applied and installed
#--------------------------------------------------------------------
echo checking for NeXT compiler
AC_TEST_CPP([#if defined(NeXT)
#error
#endif], NeXTCC=0, NeXTCC=1)
if test "$NeXTCC" = "1"; then
    NON_NeXT_EXTRA_OBJS=""
    NON_NeXT_EXTRA_SRCS=""
    NON_NeXT_ALL_OBJCFLAGS=""
else
    NON_NeXT_EXTRA_OBJS="List.o HashTable.o"
    NON_NeXT_EXTRA_SRCS="List.m HashTable.m"
    NON_NeXT_ALL_OBJCFLAGS="-Wno-protocol"
    # Find out if we have objc_next_class (due out in new version of gcc)
    AC_CHECK_LIB(objc, objc_next_class, have_ocn=1, have_ocn=0)
    if test "$have_ocn" = "0"; then
      echo You must apply the patch $srcdir/gcc.patch to the gcc source dir
      echo then recompile and install libobjc.a,
      echo then rerun this configure script.
      exit 1
    fi
	
fi

AC_SUBST(NON_NeXT_EXTRA_OBJS)
AC_SUBST(NON_NeXT_EXTRA_SRCS)
AC_SUBST(NON_NeXT_ALL_OBJCFLAGS)

AC_CHECK_LIB(objc,objc_malloc)
AC_CHECK_FUNCS(objc_malloc)

#--------------------------------------------------------------------
# (This part is from the tk4.0 distribution, modified by nelson)
#	Locate the X11 header files and the X11 library archive.  Try
#	the ac_path_x macro first, but if it doesn't find the X stuff
#	(e.g. because there's no xmkmf program) then check through
#	a list of possible directories.  Under some conditions the
#	autoconf macro will return an include directory that contains
#	no include files, so double-check its result just to be safe.
#--------------------------------------------------------------------

AC_PATH_X
not_really_there=""
if test "$no_x" = ""; then
    if test "$x_includes" = ""; then
	AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
    else
	if test ! -r $x_includes/X11/Intrinsic.h; then
	    not_really_there="yes"
	fi
    fi
fi
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
    echo checking for X11 header files
    XINCLUDES="# no special path needed"
    AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
    if test "$XINCLUDES" = nope; then
        dirs="/usr/unsupported/include /usr/local/include
	/usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/X11R6/include /usr/openwin/include /usr/X11/include /usr/sww/include"
        for i in $dirs ; do
	    if test -r $i/X11/Intrinsic.h; then
	        XINCLUDES=" -I$i"
                x_includes="$i"
	    fi
        done
    fi
else
    if test "$x_includes" != ""; then
	XINCLUDES=-I$x_includes
    else
	XINCLUDES="# no special path needed"
    fi
fi
if test "$XINCLUDES" = nope; then
  echo "Warning:  couldn't find any X11 include files."
  XINCLUDES="# no include files found"
fi
AC_SUBST(XINCLUDES)

if test "$no_x" = yes; then
    XLIBSW=nope
    if test "$XLIBSW" = nope; then
	dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/X11R6/lib /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
	for i in $dirs ; do
	    if test -r $i/libX11.a; then
		XLIBSW="-L$i -lX11"
	        x_libraries="$i"
	    fi
	done
    fi
else
    if test "$x_libraries" = ""; then
	XLIBSW=-lX11
    else
	XLIBSW="-L$x_libraries -lX11"
    fi
fi
if test "$XLIBSW" = nope ; then
    AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
fi
if test "$XLIBSW" = nope ; then
    echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
    XLIBSW=-lX11
fi
AC_SUBST(XLIBSW)

#--------------------------------------------------------------------
# Locate the Tcl/Tk include files
#   A hybrid of BLT's approach of looking in lots of places and, if
#   that fails, just believing what "echo [info library] | tclsh" says.
#   We play a bit of a trick here piping commands into tclsh
#   Extra set of brackets hides the Tcl brackets from autoconf m4.
#--------------------------------------------------------------------

# First, if tclsh is around execute it to make a guess as to where Tcl
# is installed, and also to find out if we're using tcl > 7.3.

# (nelson 12/11/95) - removed the check for the tcl version, we just
# assume they have 7.4. There was a small problem when the version of
# tcl from tclsh in the PATH didn't agree with libtcl.a
# we used to invoke ["puts [expr [info tclversion] < 7.4]"]
# in the tclsh to guess the version number.
AC_CHECK_PROG(tclsh_found, tclsh, 1, 0)
if test "$tclsh_found" = "1"; then
  tclLibrary=`echo ["puts [info library]"] | tclsh`
  tclInstalledDir=`dirname "$tclLibrary"`
  tclInstalledDir=`dirname "$tclInstalledDir"`
fi

# Second, if TCL_LIBRARY or TK_LIBRARY are set, work from there.
if test -n "$TCL_LIBRARY"; then
  USER_TCL_INCLUDE=`dirname $TCL_LIBRARY`
  USER_TCL_INCLUDE=`dirname $USER_TCL_INCLUDE`/include
  USER_TCL_LIB=`dirname $TCL_LIBRARY`
else
  USER_TCL_INCLUDE=""
  USER_TCL_LIB=""
fi
if test -n "$TK_LIBRARY"; then
  USER_TK_INCLUDE=`dirname $TK_LIBRARY`
  USER_TK_INCLUDE=`dirname $USER_TK_INCLUDE`/include
  USER_TK_LIB=`dirname $TK_LIBRARY`
else
  USER_TK_INCLUDE=""
  USER_TK_LIB=""
fi


# now define INCPLACES to be those directories where tcl.h and tk.h could be.
# We look in lots of "standard" places as well as where [info version]
# tells us to look. Note that this list is both for tcl.h and tk.h: they
# are often installed in the same directory.

INCPLACES=" \
           $prefix/include $prefix/include/tcl $prefix/include/tk \
           /usr/local/include /usr/local/include/tcl /usr/local/include/tk \
           /usr/include /usr/include/tcl /usr/include/tk \
           $x_includes $x_includes/tcl $x_includes/tk \
          ../tcl8.0 ../tcl7.6 ../tcl7.5 ../tcl7.4 ../tk8.0 ../tk4.2 ../tk4.1 ../tk4.0"
if test -n "$tclInstalledDir"; then
  INCPLACES="$tclInstalledDir/include $INCPLACES"
fi
INCPLACES="$USER_TCL_INCLUDE $USER_TK_INCLUDE $INCPLACES"

echo $ac_n "Looking for tcl.h... "
TCLINCDIR=""
for dir in "$TCL_INCLUDE_DIR" $INCPLACES; do
  if test -r $dir/tcl.h; then
    TCLINCDIR=$dir
    break;
  fi
done

if test -z "$TCLINCDIR"; then
  echo
  echo "Couldn't find tcl.h, please type in the directory where it is located."
  read TCLINCDIR
else
  echo "found $TCLINCDIR/tcl.h"
fi

if test "$TCLINCDIR" = "/usr/include" ; then
  TCLINCLUDES=""
else
  TCLINCLUDES="-I$TCLINCDIR"
fi
AC_SUBST(TCLINCLUDES)

# phew. Now look for libtcl.a. These are the generic places, we'll also look
# where we found tcl.h or tk.h

LIBPLACES="$prefix/lib $prefix/lib/tcl $prefix/lib/tk \
           /usr/local/lib /usr/local/lib/tcl /usr/local/lib/tk \
           /usr/lib /usr/lib/tcl /usr/lib/tk \
           $x_libraries $x_libraries/tcl $x_libraries/tk \
	   ../tcl8.0 ../tcl7.6 ../tcl7.5 ../tcl7.4 ../tk8.0 ../tk4.2 ../tk4.1 ../tk4.0"

if test -n "$tclInstalledDir"; then
  LIBPLACES="$tclInstalledDir/lib $LIBPLACES"
fi
LIBPLACES="$USER_TCL_LIB $USER_TK_LIB $LIBPLACES"
LIBPLACES="`dirname $TCLINCDIR`/lib $LIBPLACES"

TCLLIBDIR=""
TCLLIBNAME=""
for suffix in .so .a; do
  echo $ac_n "Looking for libtcl$suffix... "
  for dir in "$TCL_LIB_DIR" $LIBPLACES; do
    for version in 80 8.0 76 7.6 7.5 7.4 ''; do
      if test -r $dir/libtcl${version}${suffix}; then
        TCLLIBDIR=$dir  
        TCLLIBNAME=tcl$version
        break;
      fi        
    done        
    test -z "$TCLLIBDIR" || break;
  done
  test -z "$TCLLIBDIR" || break;
done

if test -z "$TCLLIBDIR"; then
  echo
  echo "Couldn't find libtcl.{a,so}, libtcl8.0.{a,so} or libtcl7.[456].{a,so}. Please tell me where it is located"
  read TCLLIBDIR
  for version in 80 8.0 76 7.6 7.5 7.4 ''; do
    for suffix in .so .a; do
      if test -r $TCLLIBDIR/libtcl${version}${suffix}; then
        TCLLIBNAME=tcl$version
        break;
      fi
    done
    test -z "$TCLLIBNAME" || break;
  done
  test -z "$TCLLIBNAME" || break;
else
  echo "found $TCLLIBDIR/lib$TCLLIBNAME$suffix"
fi
if test "$TCLLIBDIR" = "/usr/lib" ; then
  TCLLIBS="-l$TCLLIBNAME"
else
  TCLLIBS="-L$TCLLIBDIR -l$TCLLIBNAME"
fi
AC_SUBST(TCLLIBS)

#--------------------------------------------------------------------
# Locate the Tk include and library files, if we've been asked to.
#--------------------------------------------------------------------

# default is to turn tk support on.
AC_ARG_WITH(tk, [  --with-tk		  install Tk support as well as Tcl (default is on)], ,with_tk=yes )
if test "$with_tk" != "no"; then
  doCheckTk="doCheckTk"
  TkInterp_o="TkInterp.o"
  TkInterp_h="TkInterp.h"

  POTENTIALINCDIR=`dirname $TCLINCDIR`
  POTENTIALINCDIR=`dirname $POTENTIALINCDIR`
  INCPLACES="$INCPLACES \
         $TCLINCDIR \ 
         $POTENTIALINCDIR/tk8.0/include \
         $POTENTIALINCDIR/tk4.2/include \
         $POTENTIALINCDIR/tk4.1/include \
	 $POTENTIALINCDIR/tk4.0/include \
         $POTENTIALINCDIR/tk/include"
  echo $ac_n "Looking for tk.h... "
  TKINCDIR=""
  for dir in "$TK_INCLUDE_DIR" $INCPLACES; do
    if test -r $dir/tk.h; then
      TKINCDIR=$dir
      break;
    fi
  done
  if test -z "$TKINCDIR"; then
    echo
    echo "Couldn't find tk.h, please tell me where it is located."
    read TKINCDIR
  else
    echo "found $TKINCDIR/tk.h"
  fi
  if test "$TKINCDIR" = "/usr/include" ; then
    TKINCLUDES=""
  else
    TKINCLUDES="-I$TKINCDIR"
  fi
  AC_SUBST(TKINCLUDES)

  POTENTIALLIBDIR=`dirname $TCLLIBDIR`
  POTENTIALLIBDIR=`dirname $POTENTIALLIBDIR`
  LIBPLACES="`dirname $TKINCDIR`/lib $TCLLIBDIR $POTENTIALLIBDIR/tk/lib \
	     $POTENTIALLIBDIR/tk8.0/lib \
	     $POTENTIALLIBDIR/tk4.2/lib \
	     $POTENTIALLIBDIR/tk4.1/lib \
             $POTENTIALLIBDIR/tk4.0/lib \
             $LIBPLACES"
  TKLLIBDIR=""
  TKLIBNAME=""
  for suffix in .so .a; do
    echo $ac_n "Looking for libtk${suffix}... "
    for dir in "$TK_LIB_DIR" $LIBPLACES; do
      for version in 80 8.0 42 4.2 4.1 4.0 ''; do
        if test -r $dir/libtk${version}${suffix}; then
          TKLIBDIR=$dir
          TKLIBNAME=tk${version}
          break;
        fi
      done
      test -z "$TKLIBDIR" || break;
     done
     test -z "$TKLIBDIR" || break;
  done

  if test -z "$TKLIBDIR"; then
    echo
    echo "Couldn't find libtk.{a,so}, libtk8.0.{a,so}, or libtk4.[012].{a,so}. Please tell me where it is located"
    read TKLIBDIR
    for suffix in .so .a; do
      for version in 80 8.0 42 4.2 4.1 4.0 '' ; do
        if test -r $TKLIBDIR/libtk${version}${suffix}; then
          TKLIBNAME=tk$version
          break;
        fi
      done
      test -z "$TKLIBDIR" || break;
    done
  else
    echo "found $TKLIBDIR/lib$TKLIBNAME$suffix"
  fi
  if test "$TKLIBDIR" = "/usr/lib" ; then
    TKLIBS="-l$TKLIBNAME"
  else
    TKLIBS="-L$TKLIBDIR -l$TKLIBNAME"
  fi
else
  TKLIBS=" # configured not to use tk/X"
  doCheckTk=""
  TkInterp_h=""
  TkInterp_o=""
fi
AC_SUBST(TKLIBS)
AC_SUBST(doCheckTk)
AC_SUBST(TkInterp_o)
AC_SUBST(TkInterp_h)

#--------------------------------------------------------------------
# Locate the Readline include and library files
#--------------------------------------------------------------------

AC_ARG_WITH(readline, [  --with-readline		  Use GNU readline when prompting (default is off)])
found_readline_inc_and_lib=0
if test "$with_readline" = yes; then
    echo "        configuring to use readline"
    if test "$READLINE_INCLUDE_DIR" != ""; then
      READLINEINCLUDES="-I$READLINE_INCLUDE_DIR"
      # Add some code to look in standard places
      if test "$READLINE_LIBRARY_DIR" != ""; then
        READLINELIBS="-L$READLINE_LIBRARY_DIR -lreadline -lncurses"
        found_readline_inc_and_lib=1
        AC_DEFINE(HAVE_READLINE)
        # This .o file contains xmalloc,xrealloc.  They are needed by readline
        # Normally they would be provided in libiberty; we include them here
        # in case you don't already have libiberty
        READLINE_O_EXTRAS=xmalloc.o
      # Add some code to look in standard places
      else
        echo "Warning: Could not find the readline library archive."
        echo "         In order to get the readline functionality you must"
        echo "         set the environment variable READLINE_LIBRARY_DIR"
        echo "         and rerun configure.  See INSTALL for more details."
      fi
    else
      echo "Warning: Could not find the readline include files."
      echo "         In order to get the readline functionality you must"
      echo "         set the environment variable READLINE_INCLUDE_DIR"
      echo "         and rerun configure.  See INSTALL for more details."
    fi
fi
if test "$found_readline_inc_and_lib" = "0"; then
    READLINEINCLUDES=" # configured to not use readline"
    READLINELIBS=" # configured to not use readline"
    READLINE_O_EXTRAS=""
fi

AC_SUBST(READLINEINCLUDES)
AC_SUBST(READLINELIBS)
AC_SUBST(READLINE_O_EXTRAS)

# This is needed to link up during `make check'.
AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")

### Now output the Makefile

AC_OUTPUT(Makefile)