source: trunk/src/tcl/configure.in @ 527

Last change on this file since 527 was 527, checked in by nkissebe, 18 years ago

TEA configuration support added (Windows support)

File size: 12.2 KB
Line 
1#!/bin/bash -norc
2dnl     This file is an input file used by the GNU "autoconf" program to
3dnl     generate the file "configure", which is run during Tcl installation
4dnl     to configure the system for the local environment.
5#
6# RCS: @(#) $Id: configure.in,v 1.46 2006/01/23 19:18:55 hobbs Exp $
7
8#-----------------------------------------------------------------------
9# Sample configure.in for Tcl Extensions.  The only places you should
10# need to modify this file are marked by the string __CHANGE__
11#-----------------------------------------------------------------------
12
13#-----------------------------------------------------------------------
14# __CHANGE__
15# Set your package name and version numbers here.
16#
17# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
18# set as provided.  These will also be added as -D defs in your Makefile
19# so you can encode the package version directly into the source files.
20#-----------------------------------------------------------------------
21
22AC_INIT([Rappture], [1.1])
23
24#--------------------------------------------------------------------
25# Call TEA_INIT as the first TEA_ macro to set up initial vars.
26# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
27# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
28#--------------------------------------------------------------------
29
30TEA_INIT([3.5])
31
32AC_CONFIG_AUX_DIR(tclconfig)
33
34#--------------------------------------------------------------------
35# Extra build options
36#--------------------------------------------------------------------
37AC_ARG_WITH(blt, [  --with-blt=DIR          Find bltInt.h in DIR],
38  blt_source_dir=$withval)
39
40AC_ARG_WITH(rappture, [  --with-rappture=DIR          Find include/core/rappture.h in DIR],
41  rappture_dir=$withval)
42
43AC_ARG_WITH(altpath, [  --with-altpath=DIR          Alternate path to search for required packages],
44  alt_dir=$withval)
45
46#--------------------------------------------------------------------
47# Load the tclConfig.sh file
48#--------------------------------------------------------------------
49
50TEA_PATH_TCLCONFIG
51TEA_LOAD_TCLCONFIG
52
53#--------------------------------------------------------------------
54# Load the tkConfig.sh file if necessary (Tk extension)
55#--------------------------------------------------------------------
56
57#TEA_PATH_TKCONFIG
58#TEA_LOAD_TKCONFIG
59
60#-----------------------------------------------------------------------
61# Handle the --prefix=... option by defaulting to what Tcl gave.
62# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
63#-----------------------------------------------------------------------
64
65TEA_PREFIX
66
67#-----------------------------------------------------------------------
68# Standard compiler checks.
69# This sets up CC by using the CC env var, or looks for gcc otherwise.
70# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
71# the basic setup necessary to compile executables.
72#-----------------------------------------------------------------------
73
74TEA_SETUP_COMPILER
75
76#-----------------------------------------------------------------------
77# __CHANGE__
78# Specify the C source files to compile in TEA_ADD_SOURCES,
79# public headers that need to be installed in TEA_ADD_HEADERS,
80# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
81# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
82# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
83# and PKG_TCL_SOURCES.
84#-----------------------------------------------------------------------
85
86TEA_ADD_SOURCES([Rappture_Init.cc RpLibraryTclInterface.cc RpUnitsTclInterface.cc ])
87TEA_ADD_HEADERS([])
88TEA_ADD_INCLUDES([])
89TEA_ADD_LIBS(BLT24.lib libexpat.lib ../librappture.lib)
90TEA_ADD_CFLAGS([])
91TEA_ADD_STUB_SOURCES([])
92TEA_ADD_TCL_SOURCES([scripts/exec.tcl scripts/value.tcl init.tcl ../../tcl/scripts/library.tcl ../../tcl/scripts/result.tcl])
93
94#--------------------------------------------------------------------
95# __CHANGE__
96# A few miscellaneous platform-specific items:
97#
98# Define a special symbol for Windows (BUILD_sample in this case) so
99# that we create the export library with the dll.
100#
101# Windows creates a few extra files that need to be cleaned up.
102# You can add more files to clean if your extension creates any extra
103# files.
104#
105# TEA_ADD_* any platform specific compiler/build info here.
106#--------------------------------------------------------------------
107
108if test "${TEA_PLATFORM}" = "windows" ; then
109    AC_DEFINE(BUILD_rappture, 1, [Build windows export dll])
110    CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc*.pch"
111    TEA_ADD_LIBS(/LIBPATH:C:/opt/lib /LIBPATH:C:/Tcl/lib scew_s.lib)
112    #TEA_ADD_SOURCES([win/winFile.c])
113    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
114else
115    CLEANFILES=""
116    #TEA_ADD_SOURCES([unix/unixFile.c])
117    TEA_ADD_LIBS([scew.lib])
118fi
119AC_SUBST(CLEANFILES)
120
121#--------------------------------------------------------------------
122# __CHANGE__
123# Choose which headers you need.  Extension authors should try very
124# hard to only rely on the Tcl public header files.  Internal headers
125# contain private data structures and are subject to change without
126# notice.
127# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
128#--------------------------------------------------------------------
129
130TEA_PUBLIC_TCL_HEADERS
131#TEA_PRIVATE_TCL_HEADERS
132
133#TEA_PUBLIC_TK_HEADERS
134#TEA_PRIVATE_TK_HEADERS
135#TEA_PATH_X
136
137#--------------------------------------------------------------------
138# Check whether --enable-threads or --disable-threads was given.
139# This auto-enables if Tcl was compiled threaded.
140#--------------------------------------------------------------------
141
142TEA_ENABLE_THREADS
143
144#--------------------------------------------------------------------
145# The statement below defines a collection of symbols related to
146# building as a shared library instead of a static library.
147#--------------------------------------------------------------------
148
149TEA_ENABLE_SHARED
150
151#--------------------------------------------------------------------
152# This macro figures out what flags to use with the compiler/linker
153# when building shared/static debug/optimized objects.  This information
154# can be taken from the tclConfig.sh file, but this figures it all out.
155#--------------------------------------------------------------------
156
157TEA_CONFIG_CFLAGS
158
159#--------------------------------------------------------------------
160# Set the default compiler switches based on the --enable-symbols option.
161#--------------------------------------------------------------------
162
163TEA_ENABLE_SYMBOLS
164
165#--------------------------------------------------------------------
166# Everyone should be linking against the Tcl stub library.  If you
167# can't for some reason, remove this definition.  If you aren't using
168# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
169# link against the non-stubbed Tcl library.  Add Tk too if necessary.
170#--------------------------------------------------------------------
171
172AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
173#AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
174
175#--------------------------------------------------------------------
176# This macro generates a line to use when building a library.  It
177# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
178# and TEA_LOAD_TCLCONFIG macros above.
179#--------------------------------------------------------------------
180
181TEA_MAKE_LIB
182
183#--------------------------------------------------------------------
184# Determine the name of the tclsh and/or wish executables in the
185# Tcl and Tk build directories or the location they were installed
186# into. These paths are used to support running test cases only,
187# the Makefile should not be making use of these paths to generate
188# a pkgIndex.tcl file or anything else at extension build time.
189#--------------------------------------------------------------------
190
191TEA_PROG_TCLSH
192#TEA_PROG_WISH
193
194
195#--------------------------------------------------------------------
196# Look for bltInt.h on the normal include path.  If not found, look
197# for it in the --with-blt directory.
198#--------------------------------------------------------------------
199AC_MSG_CHECKING([for bltInt.h])
200BLT_SRC_DIR=""
201if test "x$blt_source_dir" != "x" ; then
202  #
203  # Verify that a tclConfig.sh file exists in the directory specified
204  # by --with-blt.
205  #
206  if test -r "$blt_source_dir/bltInt.h" ; then
207    BLT_SRC_DIR="$blt_source_dir"
208  elif test -r "$blt_source_dir/src/bltInt.h" ; then
209    BLT_SRC_DIR="$blt_source_dir/src"
210  fi
211else
212  #
213  # Otherwise, search for the bltInt.h include file...
214  # 1. Search previously named locations.
215  #
216  for dir in \
217   $prefix \
218   $exec_prefix
219  do
220    if test -r "$dir/bltInt.h" ; then
221      BLT_SRC_DIR="$dir"
222      break
223    elif test -r "$dir/include/bltInt.h" ; then
224      BLT_SRC_DIR="$dir/include"
225      break
226    fi
227  done
228  #
229  #  2. Search source directories.
230  #
231  if test "x$BLT_SRC_DIR" = "x" ; then
232    for dir in \
233     `ls -dr ../blt[[2-3]].[[0-9]]* 2>/dev/null` \
234     ../blt \
235     `ls -dr ../../blt[[2-3]].[[0-9]]* 2>/dev/null` \
236     ../../blt \
237     `ls -dr ../../../blt[[2-3]].[[0-9]]* 2>/dev/null` \
238     ../../../blt \
239     `ls -dr c:/opt/blt[[2-3]].[[0-9]]* 2>/dev/null` \
240     c\:/opt/blt
241    do
242      if test -r "$dir/src/bltInt.h" ; then
243        BLT_SRC_DIR="$dir/src"
244        break
245      fi
246    done
247  fi
248fi
249AC_MSG_RESULT([${BLT_SRC_DIR}])
250
251if test "x$BLT_SRC_DIR" = "x" ; then
252  echo "can't find BLT include file \"bltInt.h\""
253  echo "use --with-blt=DIR to specify the location of the BLT sources"
254  exit 1
255fi
256
257AC_SUBST(BLT_SRC_DIR)
258#--------------------------------------------------------------------
259# Look for rappture.h on the normal include path.  If not found, look
260# for it in the --with-rappture directory.
261#--------------------------------------------------------------------
262AC_MSG_CHECKING([for rappture.h])
263RAPPTURE_DIR=""
264if test "x$rappture_source_dir" != "x" ; then
265  #
266  # Verify that a rappture.h file exists in the directory specified
267  # by --with-rappture.
268  #
269  if test -r "$rappture_dir/include/core/rappture.h" ; then
270    RAPPTURE_DIR="$rappture_dir"
271  fi
272else
273  #
274  # Otherwise, search for the rappture.h include file...
275  # 1. Search previously named locations.
276  #
277  for dir in \
278   $prefix \
279   $exec_prefix
280  do
281    if test -r "$dir/include/core/rappture.h" ; then
282      RAPPTURE_DIR="$dir"
283      break
284    fi
285  done
286  #
287  #  2. Search source directories.
288  #
289  if test "x$RAPPTURE_DIR" = "x" ; then
290    for dir in \
291     `ls -dr ../rappture 2>/dev/null` \
292     `ls -dr ../../rappture 2>/dev/null` \
293     `ls -dr ../../../rappture 2>/dev/null` \
294     `ls -dr C\:/opt/rappture 2>/dev/null` \
295     `ls -dr /opt/rappture 2>/dev/null`
296    do
297      if test -r "$dir/include/core/rappture.h" ; then
298        RAPPTURE_DIR="$dir"
299        break
300      fi
301    done
302  fi
303fi
304AC_MSG_RESULT([${RAPPTURE_DIR}])
305
306if test "x$RAPPTURE_DIR" = "x" ; then
307  echo "can't find RAPPTURE include file \"rappture.h\""
308  echo "use --with-rappture=DIR to specify the location of rappture"
309  exit 1
310fi
311
312AC_SUBST(RAPPTURE_DIR)
313
314#--------------------------------------------------------------------
315# Look for scew.h on the normal include path.  If not found, look
316# for it in the --with-scew directory.
317#--------------------------------------------------------------------
318AC_MSG_CHECKING([for alternate paths])
319ALT_DIR=""
320if test "x$alt_dir" != "x" ; then
321  #
322  # Verify that a include and lib directories exist in the directory specified
323  # by --with-altpath.
324  #
325  if test -d "$alt_dir/include" -a -d "$alt_dir/lib" ; then
326    ALT_DIR="$rappture_dir"
327  fi
328else
329  if test "x$ALT_DIR" = "x" ; then
330    for dir in \
331     C\:/opt /opt
332    do
333      if test -r "$dir/include" -a -d "$dir/lib" ; then
334        ALT_DIR="$dir"
335        break
336      fi
337    done
338  fi
339fi
340if test "x$ALT_DIR" = "x" ; then
341    AC_MSG_RESULT(none)
342  else
343    AC_MSG_RESULT([${ALT_DIR}])
344fi
345
346AC_SUBST(ALT_DIR)
347
348PATCHLEVEL=`${TCLSH_PROG} cf/patchlevel.tcl`
349EXACT_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}-${PATCHLEVEL}
350NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}
351
352AC_SUBST(PATCHLEVEL)
353AC_SUBST(EXACT_VERSION)
354AC_SUBST(NODOT_VERSION)
355
356#--------------------------------------------------------------------
357# Finally, substitute all of the various values into the Makefile.
358# You may alternatively have a special pkgIndex.tcl.in or other files
359# which require substituting th AC variables in.  Include these here.
360#--------------------------------------------------------------------
361
362AC_OUTPUT([Makefile pkgIndex.tcl init.tcl])
363
364
Note: See TracBrowser for help on using the repository browser.