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

Last change on this file since 718 was 718, checked in by dkearney, 17 years ago

after the core rappture library (librappture.so) is created the include
files necessary to compile all other bindings are copied to the top level
include directory. python, perl, matlab, octave and tcl bindings now refer
to this top level include directory to find header files.

fortran and c examples are only compiled if we find a compiler, this check
helps prevent builds from failing before the libraries are installed.

added more checks to the configure script

removed rappture search paths from perl's unix build because perl could find
an older version of rappture and compile against it. I would rather the build
fail and have the person enter a valid prefix.

addrd the -fPIC flag to CFLAGS in src2's makefile

File size: 12.7 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.0])
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
40# AC_ARG_WITH(rappture, [  --with-rappture=DIR          Find include/rappture.h in DIR],
41#   rappture_dir=$withval)
42
43# AC_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
86#TEA_ADD_SOURCES([Rappture_Init.cc RpLibraryTclInterface.cc RpUnitsTclInterface.cc ])
87TEA_ADD_SOURCES([Rappture_Init.cc RpUnitsTclInterface.cc RpEncodeTclInterface.cc RpUtilsTclInterface.cc])
88TEA_ADD_HEADERS([])
89TEA_ADD_INCLUDES([])
90TEA_ADD_CFLAGS([])
91TEA_ADD_STUB_SOURCES([])
92# uncomment this and mkindex.tcl line in makefile when you are ready to
93# install tcl rappture library bindings
94#TEA_ADD_TCL_SOURCES([scripts/exec.tcl scripts/value.tcl init.tcl ../../tcl/scripts/library.tcl ../../tcl/scripts/result.tcl])
95TEA_ADD_TCL_SOURCES([])
96
97#--------------------------------------------------------------------
98# __CHANGE__
99# A few miscellaneous platform-specific items:
100#
101# Define a special symbol for Windows (BUILD_sample in this case) so
102# that we create the export library with the dll.
103#
104# Windows creates a few extra files that need to be cleaned up.
105# You can add more files to clean if your extension creates any extra
106# files.
107#
108# TEA_ADD_* any platform specific compiler/build info here.
109#--------------------------------------------------------------------
110
111if test "${TEA_PLATFORM}" = "windows" ; then
112    AC_DEFINE(BUILD_rappture, 1, [Build windows export dll])
113    CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc*.pch"
114    TEA_ADD_LIBS(/LIBPATH:C:/opt/lib /LIBPATH:C:/Tcl/lib scew_s.lib)
115    TEA_ADD_LIBS(BLT24.lib libexpat.lib ../librappture.lib)
116    #TEA_ADD_SOURCES([win/winFile.c])
117    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
118else
119    # CLEANFILES="*core *.o *.so *.a"
120    CLEANFILES=""
121    #TEA_ADD_SOURCES([unix/unixFile.c])
122    TEA_ADD_LIBS([-L${prefix}/lib])
123    if test "${libdir}" != "${prefix}/lib" ; then
124        TEA_ADD_LIBS([-L${libdir}])
125    fi
126    TEA_ADD_LIBS([-lrappture -lexpat])
127fi
128AC_SUBST(CLEANFILES)
129
130#--------------------------------------------------------------------
131# __CHANGE__
132# Choose which headers you need.  Extension authors should try very
133# hard to only rely on the Tcl public header files.  Internal headers
134# contain private data structures and are subject to change without
135# notice.
136# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
137#--------------------------------------------------------------------
138
139TEA_PUBLIC_TCL_HEADERS
140#TEA_PRIVATE_TCL_HEADERS
141
142#TEA_PUBLIC_TK_HEADERS
143#TEA_PRIVATE_TK_HEADERS
144#TEA_PATH_X
145
146#--------------------------------------------------------------------
147# Check whether --enable-threads or --disable-threads was given.
148# This auto-enables if Tcl was compiled threaded.
149#--------------------------------------------------------------------
150
151TEA_ENABLE_THREADS
152
153#--------------------------------------------------------------------
154# The statement below defines a collection of symbols related to
155# building as a shared library instead of a static library.
156#--------------------------------------------------------------------
157
158TEA_ENABLE_SHARED
159
160#--------------------------------------------------------------------
161# This macro figures out what flags to use with the compiler/linker
162# when building shared/static debug/optimized objects.  This information
163# can be taken from the tclConfig.sh file, but this figures it all out.
164#--------------------------------------------------------------------
165
166TEA_CONFIG_CFLAGS
167
168#--------------------------------------------------------------------
169# Set the default compiler switches based on the --enable-symbols option.
170#--------------------------------------------------------------------
171
172TEA_ENABLE_SYMBOLS
173
174#--------------------------------------------------------------------
175# Everyone should be linking against the Tcl stub library.  If you
176# can't for some reason, remove this definition.  If you aren't using
177# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
178# link against the non-stubbed Tcl library.  Add Tk too if necessary.
179#--------------------------------------------------------------------
180
181AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
182#AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
183
184#--------------------------------------------------------------------
185# This macro generates a line to use when building a library.  It
186# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
187# and TEA_LOAD_TCLCONFIG macros above.
188#--------------------------------------------------------------------
189
190TEA_MAKE_LIB
191
192#--------------------------------------------------------------------
193# Determine the name of the tclsh and/or wish executables in the
194# Tcl and Tk build directories or the location they were installed
195# into. These paths are used to support running test cases only,
196# the Makefile should not be making use of these paths to generate
197# a pkgIndex.tcl file or anything else at extension build time.
198#--------------------------------------------------------------------
199
200TEA_PROG_TCLSH
201#TEA_PROG_WISH
202
203
204#--------------------------------------------------------------------
205# Look for bltInt.h on the normal include path.  If not found, look
206# for it in the --with-blt directory.
207#--------------------------------------------------------------------
208AC_MSG_CHECKING([for bltInt.h])
209BLT_SRC_DIR=""
210if test "x$blt_source_dir" != "x" ; then
211  #
212  # Verify that a tclConfig.sh file exists in the directory specified
213  # by --with-blt.
214  #
215  if test -r "$blt_source_dir/bltInt.h" ; then
216    BLT_SRC_DIR="$blt_source_dir"
217  elif test -r "$blt_source_dir/src/bltInt.h" ; then
218    BLT_SRC_DIR="$blt_source_dir/src"
219  fi
220else
221  #
222  # Otherwise, search for the bltInt.h include file...
223  # 1. Search previously named locations.
224  #
225  for dir in \
226   $prefix \
227   $exec_prefix
228  do
229    if test -r "$dir/bltInt.h" ; then
230      BLT_SRC_DIR="$dir"
231      break
232    elif test -r "$dir/include/bltInt.h" ; then
233      BLT_SRC_DIR="$dir/include"
234      break
235    fi
236  done
237  #
238  #  2. Search source directories.
239  #
240  if test "x$BLT_SRC_DIR" = "x" ; then
241    for dir in \
242     `ls -dr ../blt[[2-3]].[[0-9]]* 2>/dev/null` \
243     ../blt \
244     `ls -dr ../../blt[[2-3]].[[0-9]]* 2>/dev/null` \
245     ../../blt \
246     `ls -dr ../../../blt[[2-3]].[[0-9]]* 2>/dev/null` \
247     ../../../blt \
248     `ls -dr c:/opt/blt[[2-3]].[[0-9]]* 2>/dev/null` \
249     c\:/opt/blt
250    do
251      if test -r "$dir/src/bltInt.h" ; then
252        BLT_SRC_DIR="$dir/src"
253        break
254      fi
255    done
256  fi
257fi
258AC_MSG_RESULT([${BLT_SRC_DIR}])
259
260if test "x$BLT_SRC_DIR" = "x" ; then
261  echo "can't find BLT include file \"bltInt.h\""
262  echo "use --with-blt=DIR to specify the location of the BLT sources"
263  exit 1
264fi
265
266AC_SUBST(BLT_SRC_DIR)
267#--------------------------------------------------------------------
268# Look for rappture.h on the normal include path.  If not found, look
269# for it in the --with-rappture directory.
270#--------------------------------------------------------------------
271RAPPTURE_DIR=$prefix
272#AC_MSG_CHECKING([for rappture.h])
273#RAPPTURE_DIR=""
274#if test "x$rappture_dir" != "x" ; then
275#  #
276#  # Verify that a rappture.h file exists in the directory specified
277#  # by --with-rappture.
278#  #
279#  if test -r "$rappture_dir/include/rappture.h" ; then
280#    RAPPTURE_DIR="$rappture_dir"
281#  fi
282#else
283#  #
284#  # Otherwise, search for the rappture.h include file...
285#  # 1. Search previously named locations.
286#  #
287#  for dir in \
288#   $prefix \
289#   $exec_prefix
290#  do
291#    if test -r "$dir/include/rappture.h" ; then
292#      RAPPTURE_DIR="$dir"
293#      break
294#    fi
295#  done
296#  #
297#  #  2. Search source directories.
298#  #
299#  if test "x$RAPPTURE_DIR" = "x" ; then
300#    for dir in \
301#     `ls -dr ../rappture 2>/dev/null` \
302#     `ls -dr ../../rappture 2>/dev/null` \
303#     `ls -dr ../../../rappture 2>/dev/null` \
304#     `ls -dr C\:/opt/rappture 2>/dev/null` \
305#     `ls -dr /opt/rappture 2>/dev/null`
306#    do
307#      if test -r "$dir/include/rappture.h" ; then
308#        RAPPTURE_DIR="$dir"
309#        break
310#      fi
311#    done
312#  fi
313#fi
314#AC_MSG_RESULT([${RAPPTURE_DIR}])
315#
316#if test "x$RAPPTURE_DIR" = "x" ; then
317#  echo "can't find RAPPTURE include file \"rappture.h\""
318#  echo "use --with-rappture=DIR to specify the location of rappture"
319#  exit 1
320#fi
321
322AC_SUBST(RAPPTURE_DIR)
323
324#--------------------------------------------------------------------
325# Default Rappture include path.
326#--------------------------------------------------------------------
327ALT_DIR="../../"
328# AC_MSG_CHECKING([for alternate paths])
329# ALT_DIR=""
330# if test "x$alt_dir" != "x" ; then
331#   #
332#   # Verify that a include and lib directories exist in the directory specified
333#   # by --with-altpath.
334#   #
335#   if test -d "$alt_dir/include" -a -d "$alt_dir/lib" ; then
336#     ALT_DIR="$rappture_dir"
337#   fi
338# else
339#   if test "x$ALT_DIR" = "x" ; then
340#     for dir in \
341#      C\:/opt /opt
342#     do
343#       if test -r "$dir/include" -a -d "$dir/lib" ; then
344#         ALT_DIR="$dir"
345#         break
346#       fi
347#     done
348#   fi
349# fi
350# if test "x$ALT_DIR" = "x" ; then
351#     AC_MSG_RESULT(none)
352#   else
353#     AC_MSG_RESULT([${ALT_DIR}])
354# fi
355#
356AC_SUBST(ALT_DIR)
357
358PATCHLEVEL=`${TCLSH_PROG} tclconfig/patchlevel.tcl`
359EXACT_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}-${PATCHLEVEL}
360NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}
361
362AC_SUBST(PATCHLEVEL)
363AC_SUBST(EXACT_VERSION)
364AC_SUBST(NODOT_VERSION)
365
366#--------------------------------------------------------------------
367# Finally, substitute all of the various values into the Makefile.
368# You may alternatively have a special pkgIndex.tcl.in or other files
369# which require substituting th AC variables in.  Include these here.
370#--------------------------------------------------------------------
371
372AC_OUTPUT([Makefile pkgIndex.tcl init.tcl])
373
374
Note: See TracBrowser for help on using the repository browser.