File: configure.in

package info (click to toggle)
tclcurl 0.9.5-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 764 kB
  • ctags: 222
  • sloc: ansic: 1,804; tcl: 712; sh: 212; makefile: 42
file content (361 lines) | stat: -rwxr-xr-x 12,823 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
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
#!/bin/bash -norc
dnl	This file is an input file used by the GNU "autoconf" program to
dnl	generate the file "configure", which is run during Tcl installation
dnl	to configure the system for the local environment.
#
# This is adpated from the configure.in by Jeffrey Hobbs for the TEA
# sample extension

#--------------------------------------------------------------------
# Sample configure.in for Tcl Extensions.  The only places you should
# need to modify this file are marked by the string __CHANGE__
#--------------------------------------------------------------------

#--------------------------------------------------------------------
# __CHANGE__
# This very first macro is used to verify that the configure script can 
# find the sources.  The argument to AC_INIT should be a unique filename
# for this package, and can be a relative path, such as:
#
# AC_INIT(generic/tcl.h)
#--------------------------------------------------------------------

AC_INIT(tclcurl.h)

AC_CONFIG_AUX_DIR(tclconfig)
CONFIGDIR=${srcdir}/tclconfig
AC_SUBST(CONFIGDIR)

#--------------------------------------------------------------------
# __CHANGE__
# Set your package name and version numbers here.  The NODOT_VERSION is
# required for constructing the library name on systems that don't like
# dots in library names (Windows).  The VERSION variable is used on the
# other systems.
#--------------------------------------------------------------------

PACKAGE=tclcurl

MAJOR_VERSION=0
MINOR_VERSION=9
PATCHLEVEL=5

VERSION=${MAJOR_VERSION}.${MINOR_VERSION}${PATCHLEVEL}
NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

#--------------------------------------------------------------------
# We put this here so that you can compile with -DVERSION="1.2" to
# encode the package version directly into the source files.
#--------------------------------------------------------------------

eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")

#------------------------------------------------------------------------
# Handle the --prefix=... option
#------------------------------------------------------------------------

if test "${prefix}" = "NONE"; then
    prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
    exec_prefix=$prefix
fi

#------------------------------------------------------------------------
# Standard compiler checks.
# This uses the CC env var, or looks for gcc otherwise.
#------------------------------------------------------------------------

# If the user did not set CFLAGS, set it now to keep
# the AC_PROG_CC macro from adding "-g -O2".

if test "${CFLAGS+set}" != "set" ; then
    CFLAGS=""
fi

AC_PROG_CC

#------------------------------------------------------------------------
# If we're using GCC, see if the compiler understands -pipe.  If so, use it.
# It makes compiling go faster.  (This is only a performance feature.)
#------------------------------------------------------------------------

if test -z "$no_pipe" -a -n "$GCC"; then
    AC_MSG_CHECKING([if the compiler understands -pipe])
    OLDCC="$CC"
    CC="$CC -pipe"
    AC_TRY_COMPILE(,, AC_MSG_RESULT([yes]), CC="$OLDCC"
	AC_MSG_RESULT([no]))
fi

AC_PROG_INSTALL

#--------------------------------------------------------------------
# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------

AC_PROG_MAKE_SET

#--------------------------------------------------------------------
# Find ranlib
#--------------------------------------------------------------------

AC_PROG_RANLIB

#--------------------------------------------------------------------
# This macro performs additional compiler tests.
#--------------------------------------------------------------------

AC_CYGWIN

if test "$ac_cv_cygwin" = "yes" ; then
    AC_MSG_ERROR([Compiling with the Cygwin version of gcc is not supported.
    Use the Mingw version of gcc from www.mingw.org instead.])
fi

#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
#--------------------------------------------------------------------

AC_OBJEXT
AC_EXEEXT

#--------------------------------------------------------------------
# Call SC_TEA_INIT as the first SC_ macro to set up initial vars
#--------------------------------------------------------------------

SC_TEA_INIT

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

SC_PATH_TCLCONFIG
SC_LOAD_TCLCONFIG

#--------------------------------------------------------------------
# Load the tkConfig.sh file if necessary (Tk extension)
#--------------------------------------------------------------------

#SC_PATH_TKCONFIG
#SC_LOAD_TKCONFIG

#--------------------------------------------------------------------
# __CHANGE__
# Choose which headers you need.  Extension authors should try very
# hard to only rely on the Tcl public header files.  Internal headers
# contain private data structures and are subject to change without
# notice.
# This MUST be called after SC_LOAD_TCLCONFIG / SC_LOAD_TKCONFIG
#--------------------------------------------------------------------

SC_PUBLIC_TCL_HEADERS
#SC_PRIVATE_TCL_HEADERS

#SC_PUBLIC_TK_HEADERS
#SC_PRIVATE_TK_HEADERS

#--------------------------------------------------------------------
# __CHANGE__
# A few miscellaneous platform-specific items:
#
# Define a special symbol for Windows (BUILD_sample in this case) so
# that we create the export library with the dll.  See sha1.h on how
# to use this.
#
# Windows creates a few extra files that need to be cleaned up.
# You can add more files to clean if your extension creates any extra
# files.
#
# Define any extra compiler flags in the PACKAGE_CFLAGS variable.
# These will be appended to the current set of compiler flags for
# your system.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then
    AC_DEFINE_UNQUOTED(BUILD_${PACKAGE})
    CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    EXTRA_SOURCES='$(WIN_SOURCES)'
else
    CLEANFILES=
    EXTRA_SOURCES='$(UNIX_SOURCES)'
fi
AC_SUBST(CLEANFILES)
AC_SUBST(EXTRA_SOURCES)

#--------------------------------------------------------------------
# Find libcurl, if it's not present, it makes no sense to compile
# this.
#--------------------------------------------------------------------

TCLCURL_CFLAGS=""

AC_ARG_WITH(curlprefix,
 [  --with-curlprefix     directory containing the cURL executable],
 [
    curlprefix=$withval
    AC_CHECK_PROG(curl,curl,yes,no,$curlprefix)
    if test "x$curl" = xno ; then
       AC_MSG_ERROR([can't find cURL in the given directory])
    fi
 ],[
    AC_CHECK_PROG(curl,curl-config,yes,no)
    if test "x$curl" = xno ; then
        AC_MSG_ERROR([can't find cURL or libcurl... go to http://curl.haxx.se/ to download and then install it first])
    else
        curlpath=`curl-config --prefix`
        curlprefix=$curlpath/bin
    fi
 ])
AC_ARG_WITH(curlinclude,
 [  --with-curlinclude     directory containing the public libcurl header files],[
     TCLCURL_CFLAGS="$TCLCURL_CFLAGS -I$withval" ; curlinclude=$withval
 ],
 [
     TCLCURL_CFLAGS="$TCLCURL_CFLAGS -I$curlpath/include" ; curlinclude=$curlpath/include
 ])

AC_ARG_WITH(libcurl,
 [  --with-libcurl]       directory containing libcurl],[
     TCLCURL_LD_LIBS="$TCLCURL_LD_LIBS -L$withval"
 ])

AC_MSG_CHECKING([if libcurl version is recent enough])
CURL_VERSION=`$curlprefix/curl-config --vernum`
if test $CURL_VERSION -lt 070905 ; then
    AC_MSG_ERROR([libcurl version too old, please upgrade])
fi
AC_MSG_RESULT([$CURL_VERSION])

#AC_CHECK_LIB(curl, curl_version, libcurl=yes, libcurl=no)
#if test "x$libcurl" = xno ; then
#    AC_MSG_ERROR([libcurl required..go to http://curl.haxx.se/ to download and then install it first])
#fi

AC_CHECK_HEADER(curl/curl.h,headercurl=yes, headercurl=no)
if test "x$headercurl" = xno ; then
    if test [ ! -e $curlinclude/curl/curl.h ] ; then
        AC_MSG_ERROR([cURL headers not found, you may need to install a curl-devel package])
    fi
    echo libcurl headers in $curlinclude...
fi

AC_SUBST(TCLCURL_CFLAGS)

#--------------------------------------------------------------------
# Check whether --enable-threads or --disable-threads was given.
#--------------------------------------------------------------------

SC_ENABLE_THREADS

#--------------------------------------------------------------------
# The statement below defines a collection of symbols related to
# building as a shared library instead of a static library.
#--------------------------------------------------------------------

SC_ENABLE_SHARED

#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects.  This information
# can be taken from the tclConfig.sh file, but this figures it all out.
#--------------------------------------------------------------------

SC_CONFIG_CFLAGS


#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols option.
#--------------------------------------------------------------------

SC_ENABLE_SYMBOLS

if test "${SHARED_BUILD}" = "1" ; then
    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}'
else
    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING}'
fi

#--------------------------------------------------------------------
# Everyone should be linking against the Tcl stub library.  If you
# can't for some reason, remove this definition.  If you aren't using
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
# link against the non-stubbed Tcl library.  Add Tk too if necessary.
#--------------------------------------------------------------------

AC_DEFINE(USE_TCL_STUBS)
#AC_DEFINE(USE_TK_STUBS)

#--------------------------------------------------------------------
# This macro generates a line to use when building a library.  It
# depends on values set by the SC_ENABLE_SHARED, SC_ENABLE_SYMBOLS,
# and SC_LOAD_TCLCONFIG macros above.
#--------------------------------------------------------------------

SC_MAKE_LIB

#--------------------------------------------------------------------
# Shared libraries and static libraries have different names.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then
    if test "${SHARED_BUILD}" = "1" ; then
	SHLIB_LD_LIBS="\"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" ${TCL_SHLIB_LD_LIBS}"
	# For Tk extensions
	#SHLIB_LD_LIBS="\"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" ${TCL_SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\" ${TK_SHLIB_LD_LIBS}"
	eval "${PACKAGE}_LIB_FILE=${PACKAGE}${SHARED_LIB_SUFFIX}"
	RANLIB=:
    else
	eval "${PACKAGE}_LIB_FILE=${PACKAGE}${UNSHARED_LIB_SUFFIX}"
    fi
    TCLCURL_LD_LIBS="$TCLCURL_LD_LIBS -lwsock32 -lws2_32"
    if test "$MINGW32" = yes; then 
        TCLCURL_LD_LIBS="`$curlprefix/curl-config --libs` $TCLCURL_LD_LIBS"
    fi
else
    if test "${SHARED_BUILD}" = "1" ; then
	SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC}"
	# For Tk extensions
	#SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
	eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${SHARED_LIB_SUFFIX}"
	RANLIB=:
    else
	eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${UNSHARED_LIB_SUFFIX}"
    fi
    CURL_LIBS=`$curlprefix/curl-config --libs`
    TCLCURL_LD_LIBS="${TCLCURL_LD_LIBS} ${CURL_LIBS}"
fi

SHLIB_LD_LIBS="$TCLCURL_LD_LIBS $SHLIB_LD_LIBS"

AC_SUBST(SHARED_BUILD)

#--------------------------------------------------------------------
# __CHANGE__
# Change the name from exampeA_LIB_FILE to match your package name.
#--------------------------------------------------------------------

AC_SUBST(tclcurl_LIB_FILE)
AC_SUBST(SHLIB_LD_LIBS)

#--------------------------------------------------------------------
# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
# file during the install process.  Don't run the TCLSH_PROG through
# ${CYGPATH} because it's being used directly by make.
# Require that we use a tclsh shell version 8.2 or later since earlier
# versions have bugs in the pkg_mkIndex routine.
# Add WISH as well if this is a Tk extension.
#--------------------------------------------------------------------

SC_PROG_TCLSH
#SC_PROG_WISH

#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
#--------------------------------------------------------------------

AC_OUTPUT([Makefile \
	mkIndex.tcl])