~ubuntu-branches/ubuntu/raring/ibutils/raring-proposed

« back to all changes in this revision

Viewing changes to ibis/config/tcl.m4

  • Committer: Bazaar Package Importer
  • Author(s): Benoit Mortier
  • Date: 2010-01-11 22:22:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100111222200-53kum2et5nh13rv3
Tags: upstream-1.2-OFED-1.4.2
ImportĀ upstreamĀ versionĀ 1.2-OFED-1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
dnl tcl.m4: an autoconf Tcl locator
 
3
dnl
 
4
dnl
 
5
dnl BUGS
 
6
dnl   The command-line arguments are overcomplicated.
 
7
dnl   There are doubtlessly others...
 
8
 
 
9
dnl To use this macro, just do MLX_LANG_TCL.  It outputs
 
10
dnl TCL_LIBS, TCL_CPPFLAGS, and TCL_DEFS and SUBSTs them.
 
11
dnl If successful, these have stuff in them.  If not, they're empty.
 
12
dnl If not successful, with_tcl has the value "no".
 
13
 
 
14
AC_DEFUN([MLX_LANG_TCL], [
 
15
# --- BEGIN MLX_LANG_TCL ---
 
16
dnl To link against Tcl, configure does several things to make my life
 
17
dnl "easier".
 
18
dnl
 
19
dnl * maybe ask the user where they think Tcl lives, and try to find it
 
20
dnl * maybe ask the user what "tclsh" is called this week (i.e., "tclsh8.0")
 
21
dnl * run tclsh, ask it for a path, then run that path through sed
 
22
dnl * sanity check its result (many installs are a little broken)
 
23
dnl * try to figure out where Tcl is based on this result
 
24
dnl * try to guess where the Tcl include files are
 
25
dnl
 
26
dnl Notes from previous incarnations:
 
27
dnl > XXX MUST CHECK FOR TCL BEFORE KERBEROS V4 XXX
 
28
dnl > This is because some genius at MIT named one of the Kerberos v4
 
29
dnl > library functions log().  This of course conflicts with the
 
30
dnl > logarithm function in the standard math library, used by Tcl.
 
31
dnl
 
32
dnl > Checking for Tcl first puts -lm before -lkrb on the library list.
 
33
dnl
 
34
 
 
35
dnl do not do anything if we are in disabled libcheck mode...
 
36
if test "x$libcheck" = "xtrue"; then
 
37
 
 
38
   dnl Check for some information from the user on what the world looks like
 
39
   AC_ARG_WITH(tclconfig,[  --with-tclconfig=PATH   use tclConfig.sh from PATH
 
40
                             (configure gets Tcl configuration from here)],
 
41
           dnl trim tclConfig.sh off the end so we can add it back on later.
 
42
        TclLibBase=`echo ${withval} | sed s/tclConfig.sh\$//`)
 
43
   AC_ARG_WITH(tcl,      [  --with-tcl=PATH         use Tcl from PATH],
 
44
        TclLibBase="${withval}/lib")
 
45
   AC_ARG_WITH(tclsh,    [  --with-tclsh=TCLSH      use TCLSH as the tclsh program
 
46
                             (let configure find Tcl using this program)],
 
47
        TCLSH="${withval}")
 
48
 
 
49
   if test "x$TCLSH" = "xno" -o "x$with_tclconfig" = "xno" ; then
 
50
     AC_MSG_WARN([Tcl disabled because tclsh or tclconfig specified as "no"])
 
51
     with_tcl=no
 
52
   fi
 
53
 
 
54
   if test "x$with_tcl" != xno; then
 
55
     if test \! -z "$with_tclconfig" -a \! -d "$with_tclconfig" ; then
 
56
       AC_MSG_ERROR([--with-tclconfig requires a directory argument.])
 
57
     fi
 
58
 
 
59
     if test \! -z "$TCLSH" -a \! -x "$TCLSH" ; then
 
60
       AC_MSG_ERROR([--with-tclsh must specify an executable file.])
 
61
     fi
 
62
 
 
63
     if test X"$TclLibBase" = X; then # do we already know?
 
64
       # No? Run tclsh and ask it where it lives.
 
65
 
 
66
       # Do we know where a tclsh lives?
 
67
       if test X"$TCLSH" = X; then
 
68
         # Try and find tclsh.  Any tclsh.
 
69
         # If a new version of tcl comes out and unfortunately adds another
 
70
         # filename, it should be safe to add it (to the front of the line --
 
71
         # somef vendors have older, badly installed tclshs that we want to avoid
 
72
         # if we can)
 
73
         AC_PATH_PROGS(TCLSH, [tclsh tclsh8.3 tclsh8.4], "unknown")
 
74
       fi
 
75
 
 
76
       # Do we know where to get a tclsh?
 
77
       if test "X${TCLSH}" != "Xunknown"; then
 
78
         AC_MSG_CHECKING([where Tcl says it lives])
 
79
         dnl to avoid .tclshrc issues use from a file...
 
80
         echo "puts \$tcl_library" > /tmp/tcl.conf.$$
 
81
         TclLibBase=`${TCLSH} /tmp/tcl.conf.$$ | sed -e 's,[^/]*$,,'`
 
82
         rm /tmp/tcl.conf.$$
 
83
          AC_MSG_RESULT($TclLibBase)
 
84
       fi
 
85
     fi
 
86
 
 
87
     if test -z "$TclLibBase" ; then
 
88
       AC_MSG_RESULT([can't find tclsh])
 
89
       AC_MSG_WARN([can't find Tcl installtion; use of Tcl disabled.])
 
90
       with_tcl=no
 
91
     else
 
92
       AC_MSG_CHECKING([for tclConfig.sh])
 
93
       # Check a list of places where the tclConfig.sh file might be.
 
94
       # Note we prefer the 64 bit version if exists
 
95
       tclCondifSearchPath="$tclCondifSearchPath ${TclLibBase}"
 
96
       tclCondifSearchPath="$tclCondifSearchPath ${TclLibBase}/.."
 
97
       tclCondifSearchPath="$tclCondifSearchPath `echo ${TCLSH} | sed s/sh//`"
 
98
       tclCondifSearchPath="$tclCondifSearchPath /usr/lib64"
 
99
       tclCondifSearchPath="$tclCondifSearchPath /usr/lib"
 
100
       tclCondifSearchPath="$tclCondifSearchPath /usr/local/lib"
 
101
       for tcldir in $tclCondifSearchPath; do
 
102
         if test -f "${tcldir}/tclConfig.sh"; then
 
103
           TclLibBase="${tcldir}"
 
104
           break
 
105
         fi
 
106
       done
 
107
 
 
108
       if test -z "${TclLibBase}" ; then
 
109
         AC_MSG_RESULT("unknown")
 
110
         AC_MSG_WARN([can't find Tcl configuration; use of Tcl disabled.])
 
111
         with_tcl=no
 
112
       else
 
113
         AC_MSG_RESULT(${TclLibBase}/)
 
114
       fi
 
115
 
 
116
       if test "X${with_tcl}" != Xno ; then
 
117
         AC_MSG_CHECKING([Tcl configuration on what Tcl needs to compile])
 
118
         . ${TclLibBase}/tclConfig.sh
 
119
         AC_MSG_RESULT(ok)
 
120
         dnl no TK stuff for us.
 
121
         dnl . ${TclLibBase}/tkConfig.sh
 
122
       fi
 
123
 
 
124
       dnl We hack the provided TCL_LIB_SPEC since it is using the /usr/lib even
 
125
       dnl if the build was using lib64
 
126
       if test -d /usr/lib64 ; then
 
127
          TCL_LIB_SPEC=`echo ${TCL_LIB_SPEC} | sed 's=/usr/lib =/usr/lib64 =g'`
 
128
       fi
 
129
 
 
130
       if test "X${with_tcl}" != Xno ; then
 
131
         dnl Now, hunt for the Tcl include files, since we don't strictly
 
132
         dnl know where they are; some folks put them (properly) in the
 
133
         dnl default include path, or maybe in /usr/local; the *BSD folks
 
134
         dnl put them in other places.
 
135
         AC_MSG_CHECKING([where Tcl includes are])
 
136
         for tclinclude in "${TCL_PREFIX}/include/tcl${TCL_VERSION}" \
 
137
                           "${TCL_PREFIX}/include/tcl" \
 
138
                           "${TCL_PREFIX}/include" ; do
 
139
           if test -r "${tclinclude}/tcl.h" ; then
 
140
             TCL_CPPFLAGS="-I${tclinclude}"
 
141
             break
 
142
           fi
 
143
         done
 
144
         if test X"${TCL_CPPFLAGS}" = X ; then
 
145
           AC_MSG_WARN(can't find Tcl includes; use of Tcl disabled.)
 
146
           with_tcl=no
 
147
         fi
 
148
         AC_MSG_RESULT(${TCL_CPPFLAGS})
 
149
       fi
 
150
 
 
151
       # Finally, pick up the Tcl configuration if we haven't found an
 
152
       # excuse not to.
 
153
       if test "X${with_tcl}" != Xno; then
 
154
         dnl TCL_LIBS="${TK_LIB_SPEC} ${TK_XLIBSW} ${TCL_LD_SEARCH_FLAGS} ${TCL_LIB_SPEC}"
 
155
         dnl we are using libtool so need to convert to -rpath if at all
 
156
         TCL_SEARCH=`echo ${TCL_LD_SEARCH_FLAGS} | sed 's/-Wl,-rpath,/-rpath/'`
 
157
 
 
158
         dnl sometimes we got empty libs: use TCL_LIB_FILE
 
159
         if test X"$TCL_LIBS" = X; then
 
160
           dnl extract the lib style name...
 
161
           TCL_LIBS=`echo ${TCL_LIB_FILE} | sed 's/lib\([[^ \t]]*\)\.\(so\|a\)/-l\1/'`
 
162
         fi
 
163
 
 
164
         dnl sometimes we got empty libs: use TCL_LIB_SPEC
 
165
         if test X"$TCL_LIB_SPEC" = X; then
 
166
           dnl extract the lib style name...
 
167
           TCL_LIB_SPEC='-L/usr/lib'
 
168
         fi
 
169
 
 
170
         TCL_LIBS1="${TCL_LIB_SPEC} ${TCL_LIBS}"
 
171
         dnl Filter out the ieee - I do not see a shared version for it.
 
172
         TCL_LIBS=`echo ${TCL_LIBS1} | sed 's/-lieee//'`
 
173
       fi
 
174
     fi
 
175
   fi
 
176
else
 
177
dnl disbled libcheck mode - we do not need anything...
 
178
   TCL_DEFS=disabled
 
179
   TCL_LIBS=disabled
 
180
   TCL_CPPFLAGS=disabled
 
181
   TCL_PREFIX=disabled
 
182
fi
 
183
 
 
184
AC_SUBST(TCL_DEFS)
 
185
AC_SUBST(TCL_LIBS)
 
186
AC_SUBST(TCL_CPPFLAGS)
 
187
AC_SUBST(TCL_PREFIX)
 
188
 
 
189
# --- END MLX_LANG_TCL ---
 
190
]) dnl MLX_LANG_TCL
 
191