File: configure.ac

package info (click to toggle)
tclreadline 2.3.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,848 kB
  • sloc: tcl: 5,697; sh: 4,217; ansic: 720; makefile: 80
file content (315 lines) | stat: -rw-r--r-- 8,881 bytes parent folder | download
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
dnl -*- autoconf -*-
dnl FILE: configure.in
dnl $Id: b5c93b01fcdb246fec5afaceee661fa4d0347401 $
dnl ---
dnl tclreadline -- gnu readline for tcl
dnl https://github.com/flightaware/tclreadline/
dnl Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
dnl This software is copyright under the BSD license.
dnl ---

AC_INIT([tclreadline], [2.3.8])
AC_CONFIG_SRCDIR([tclreadline.c])
AC_CONFIG_HEADERS(config.h)
AC_PREREQ(2.13)
AC_REVISION($Revision$)
AC_CONFIG_AUX_DIR(./aux)

MAJOR="`echo 'AC_PACKAGE_VERSION' | cut -d. -f 1`"
MINOR="`echo 'AC_PACKAGE_VERSION' | cut -d. -f 2`"
PATCHLEVEL="`echo 'AC_PACKAGE_VERSION' | cut -d. -f 3`"
VERSION=$MAJOR.$MINOR
PATCHLEVEL_STR=$VERSION.$PATCHLEVEL

AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(PATCHLEVEL)
AC_SUBST(VERSION)
AC_SUBST(PATCHLEVEL_STR)

AM_INIT_AUTOMAKE([foreign])


AC_PROG_MAKE_SET

dnl AM_INIT_AUTOMAKE(tclreadline, $VERSION)

AC_CANONICAL_HOST
AC_PROG_CC
AC_EXEEXT
dnl AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)

AC_C_CONST
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S


# -- WHICH TCL TO USE
AC_ARG_WITH(
    tcl,
    [  --with-tcl=DIR          where to look for tclConfig.sh],
    tcl_search=$withval,
    tcl_search=""
)

AC_MSG_CHECKING([which tclConfig.sh to use])
TCL_LIB_DIR=""
for dir in $tcl_search /usr/lib /usr/local/lib $exec_prefix/lib /usr/local/lib/unix /opt/tcl/lib; do
    if test -r $dir/tclConfig.sh; then
        TCL_LIB_DIR=$dir
        break
    fi
done

if test -z "$TCL_LIB_DIR"; then
    AC_MSG_ERROR(Can't find Tcl libraries.  Use --with-tcl to specify the directory containing tclConfig.sh on your system.)
fi

. $TCL_LIB_DIR/tclConfig.sh
AC_MSG_RESULT($TCL_LIB_DIR/tclConfig.sh)
AC_MSG_CHECKING([for your tcl version])
AC_MSG_RESULT([$TCL_VERSION, patchlevel $TCL_PATCH_LEVEL])

# Check, if tcl_version is > 8.0
if test $TCL_MAJOR_VERSION -lt 8; then
    AC_MSG_ERROR(need tcl 8.0 or higher.)
fi


# -- WHICH TK TO USE
AC_ARG_WITH(
    tk,
    [  --with-tk=DIR          where to look for tkConfig.sh],
    tk_search=$withval,
    tk_search=""
)

if test x$tk_search != xno; then

    AC_MSG_CHECKING([which tkConfig.sh to use])
    TK_LIB_DIR=""
    for dir in $tk_search $tcl_search /usr/lib /usr/local/lib $exec_prefix/lib /usr/local/lib/unix /opt/tcl/lib; do
        if test -r $dir/tkConfig.sh; then
            TK_LIB_DIR=$dir
            break
        fi
    done

    if test -z "$TK_LIB_DIR"; then
        AC_MSG_ERROR(Can't find Tk libraries.  Use --with-tk to specify the directory containing tkConfig.sh on your system.)
    fi

    . $TK_LIB_DIR/tkConfig.sh
    AC_MSG_RESULT($TK_LIB_DIR/tkConfig.sh)
    AC_MSG_CHECKING([for your tk version])
    AC_MSG_RESULT([$TK_VERSION, patchlevel $TK_PATCH_LEVEL])

    # Check, if tk_version is > 8.0
    if test $TK_MAJOR_VERSION -lt 8; then
        AC_MSG_ERROR(need tk 8.0 or higher.)
    fi
    
fi

# -----------------------------------------------------------------------
#   Set up a new default --prefix.
# -----------------------------------------------------------------------

# this is the default anyway:
# AC_PREFIX_DEFAULT(/usr/local)

if test "${prefix}" = "NONE"; then
    prefix=$TCL_PREFIX
fi
TCLRL_LIBDIR="${prefix}/lib/${DEB_HOST_MULTIARCH}"
AC_SUBST(TCLRL_LIBDIR)
TCLRL_DIR="${prefix}/lib/tcltk/${DEB_HOST_MULTIARCH}/tclreadline$VERSION"
AC_SUBST(TCLRL_DIR)

# HEADERS
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h)

#--------------------------------------------------------------------
#   Check for tcl.h
#--------------------------------------------------------------------

AC_ARG_WITH(tcl-includes,
            [  --with-tcl-includes=DIR where to look for tcl.h],
            tcl_includes=$withval, tcl_includes=$prefix/include)

AC_MSG_CHECKING([where to look for tcl.h])
TCL_INCLUDE_DIR=""
for dir in $tcl_includes $prefix/include/ ${TCL_INCLUDE_SPEC#-I} /usr/include; do
    if test -r $dir/tcl.h; then
        TCL_INCLUDE_DIR=$dir
        break
    fi
done

if test -z "$TCL_INCLUDE_DIR"; then
    AC_MSG_ERROR([
  Can't find tcl.h.  Use --with-tcl-includes to specify the directory
  containing tcl.h on your system.])
else
    AC_MSG_RESULT($TCL_INCLUDE_DIR/tcl.h)
fi
#--------------------------------------------------------------------
#   Check for readline.h
#--------------------------------------------------------------------

AC_ARG_WITH(readline-includes,
            [  --with-readline-includes=DIR readline include files in DIR],
            rl_includes=$withval, rl_includes="")

dnl look for readline/readline.h
dnl          ^^^^^^^^
AC_MSG_CHECKING([where to look for readline.h])
READLINE_INCLUDE_DIR=""
for dir in $rl_includes /usr/local/include /usr/include ; do
    if test -r $dir/readline/readline.h; then
        READLINE_INCLUDE_DIR=$dir
        break
    fi
done

dnl look directly in the include dirs for readline.h
if test -z "$READLINE_INCLUDE_DIR"; then
    for dir in $rl_includes /usr/local/include /usr/include ; do
    if test -r $dir/readline.h; then
        READLINE_INCLUDE_DIR=$dir
        AC_DEFINE_UNQUOTED(READLINE_LIBRARY, 1, [ Define if we have libreadline. ])
        break
    fi
    done
fi

if test -z "$READLINE_INCLUDE_DIR"; then
    AC_MSG_ERROR([
  Can't find readline.h.
  Use --with-readline-includes to specify the directory
  containing readline.h on your system.])
fi

AC_ARG_WITH(readline-library,
    [  --with-readline-library=DIR
          lib spec to readline (e.g. '-L/usr/local/lib -lreadline')],
    LIBS="$LIBS $withval",
    AC_SEARCH_LIBS(rl_callback_read_char, readline, ,
        AC_MSG_RESULT([
            Your readline version does not support readline's alternate interface.
            Please upgrade to readline >= 2.2 and retry.
        ])
        exit
    )
)



# check for readline's rl_executing_macro
# (could be macro.c's private variable _rl_executing_macro).

AC_CHECK_DECL(rl_executing_macro
, AC_DEFINE(EXECUTING_MACRO_NAME, rl_executing_macro,
  [ Define the name of the executing macro variable in libreadline. ])
, AC_MSG_CHECKING([for _rl_executing_macro in -lreadline])
  AC_TRY_LINK(,[
    extern char* _rl_executing_macro;
    _rl_executing_macro = (char*) 0;
  ]
  , AC_MSG_RESULT(yes)
    AC_DEFINE(EXECUTING_MACRO_HACK, 1,
    [ Define if EXECUTING_MACRO_NAME is resolved in libreadline. ])
    AC_DEFINE(EXECUTING_MACRO_NAME, _rl_executing_macro,
    [ Define the name of the executing macro variable in libreadline. ])
  , AC_MSG_RESULT(no))
, [AC_INCLUDES_DEFAULT
#include "$READLINE_INCLUDE_DIR/readline.h"])

# check for readline's rl_cleanup_after_signal

AC_MSG_CHECKING([for rl_cleanup_after_signal() in -lreadline])
AC_TRY_LINK(,[
    extern void rl_cleanup_after_signal();
    rl_cleanup_after_signal();
],
    AC_MSG_RESULT(yes);
    AC_DEFINE(CLEANUP_AFER_SIGNAL, 1,
    [ Define if rl_cleanup_after_signal is resolved in libreadline. ]),
    AC_MSG_RESULT(no))


AC_MSG_CHECKING([for the readline version number])
AC_TRY_RUN([
#include <stdio.h>
int main () {
    FILE *fp = fopen("conftestversion", "w");
    extern char *rl_library_version;
    fprintf(fp, "%s", rl_library_version);
    close(fp);
    return 0;
}],
    READLINE_VERSION=`cat conftestversion`
    AC_MSG_RESULT($READLINE_VERSION),
    AC_MSG_RESULT(failed),
    AC_MSG_RESULT(no cross compiling)
)

AC_ARG_ENABLE(tclstub,
    [  --enable-tclstub        build with TCL stub library],
    [dnl action if given
    case "${enableval}" in
        yes) enable_tclstub=true ;; 
        no)  enable_tclstub=false ;;
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-tclstub) ;;
    esac
    ],
    [dnl action if not given
    enable_tclstub=false
    ]
)
AM_CONDITIONAL(USE_TCL_STUBS, test x$enable_tclstub = xtrue)

AC_ARG_ENABLE(tclshrl,
    [  --enable-tclshrl        build statically linked tclshrl],
    [dnl action if given
    case "${enableval}" in
        yes) enable_static=true ;;
        no)  enable_static=false ;;
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
    esac
    ],
    [dnl action if not given
    enable_static=false
    ]
)
AM_CONDITIONAL(STATIC_TCLSHRL, test x$enable_static = xtrue)

AC_ARG_ENABLE(wishrl,
    [  --enable-wishrl         build statically linked wishrl],
    [dnl action if given
    case "${enableval}" in
        yes)
        enable_static=true
        dnl source the tkConfig.sh which defines TK_LIB_SPEC
        . $TK_LIB_DIR/tkConfig.sh
        AC_SUBST(TK_LIB_SPEC)
        ;;
        no)  enable_static=false ;;
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
    esac
    ],
    [dnl action if not given
    enable_static=false
    ]
)
AM_CONDITIONAL(STATIC_WISHRL, test x$enable_static = xtrue)

AC_SUBST(TCL_INCLUDE_DIR)
AC_SUBST(TCL_STUB_LIB_SPEC)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(READLINE_INCLUDE_DIR)
AC_OUTPUT(Makefile tclreadline.h tclreadlineInit.tcl tclreadlineSetup.tcl tclreadline.n pkgIndex.tcl)