aboutsummaryrefslogtreecommitdiff
path: root/tclconfig/teax.m4
blob: e2b6355b6c080f1c5d25a3a60ad9e8f2d302d98e (plain)
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
dnl
dnl $Id$
dnl 
dnl Additional autoconf macros for TEA
dnl 
dnl

dnl _TEAX_CHECK_MSVC --
dnl
dnl Defines the shell variable "USING_MSVC" as "yes" or "no".
dnl Several tests on Windows work differently depending on
dnl whether we're using MSVC or GCC.  Current heuristic:
dnl if it's Windows, and CC is not gcc, we're using MSVC.
dnl
dnl This macro doesn't need to be called from configure.ac;
dnl other macros that need it will AC_REQUIRE it.
dnl
AC_DEFUN([_TEAX_CHECK_MSVC],[
#@ _TEAX_CHECK_MSVC
AC_REQUIRE([AC_PROG_CC])
if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
    USING_MSVC="yes"
else
    USING_MSVC="no"
fi;
])

dnl TEAX_CONFIG_LDFLAGS --
dnl 
dnl Sets the following additional variables used when building libraries:
dnl
dnl	SHLIB_LD_OUT
dnl	    Either "-o " or "/out:" depending on whether SHLIB_LD
dnl	    is a Unix-style linker (ld) or MS-style (link)
dnl
dnl	STLIB_LD_OUT --
dnl 	    Either " " or "/out:" depending on whether STLIB_LD
dnl 	    is Unix-style (ar) or MS-style (lib)
dnl
dnl	SHLIB_SUFFIX --
dnl	    Suffix for shared libraries.  This is actually computed by
dnl 	    TEA_CONFIG_CFLAGS, but it doesn't AC_SUBST() it.
dnl
dnl 	STLIB_SUFFIX --
dnl	    Suffix for static libraries (.a, .lib, ...)
dnl
dnl	LIB_PREFIX --
dnl	    Prefix for library names; either "lib" or empty.
dnl
AC_DEFUN([TEAX_CONFIG_LDFLAGS],[
#@ TEAX_CONFIG_LDFLAGS
    AC_REQUIRE([_TEAX_CHECK_MSVC])
    if test "${USING_MSVC}" = "yes"; then
	SHLIB_LD_OUT="/out:"
	STLIB_LD_OUT="/out:"
	STLIB_SUFFIX=".lib"
	LIB_PREFIX=""
    else
	SHLIB_LD_OUT="-o "
	STLIB_LD_OUT=" "
	STLIB_SUFFIX=".a"
	LIB_PREFIX="lib"
    fi
    AC_SUBST(SHLIB_LD_OUT)
    AC_SUBST(STLIB_LD_OUT)
    AC_SUBST(SHLIB_SUFFIX)
    AC_SUBST(STLIB_SUFFIX)
    AC_SUBST(LIB_PREFIX)
])

dnl TEAX_EXPAND_CFLAGS --
dnl	Computes final value of CFLAGS macro.
dnl
dnl	Uses the same logic as TEA_MAKE_LIB, except that
dnl	${CFLAGS_DEFAULT}, ${CFLAGS_WARNING}, and ${SHLIB_CFLAGS}
dnl 	are expanded at configure-time instead of at make-time.
dnl 
AC_DEFUN([TEAX_EXPAND_CFLAGS],[
#@ TEAX_EXPAND_CFLAGS
    AC_REQUIRE([TEA_ENABLE_SYMBOLS])
    CFLAGS="${CFLAGS} ${CFLAGS_DEFAULT} ${CFLAGS_WARNING}"
    if test "${SHARED_BUILD}" = "1" ; then
    	CFLAGS="${CFLAGS} ${SHLIB_CFLAGS}"
    fi
])

dnl TEAX_FIX_LIB_SPECS --
dnl	TCL_STUB_LIB_SPEC is supposed to contain the linker flags
dnl 	for picking up the Tcl stub library; however, the settings
dnl 	in tclConfig.sh only work on Unix and with GCC on Windows.
dnl 	TEAX_FIX_LIB_SPECS adjusts TCL_STUB_LIB_SPEC et. al. so
dnl	they work with MSVC as well. 
dnl
dnl	(TEA_MAKE_LIB works around this in a different way.)
dnl
AC_DEFUN([TEAX_FIX_LIB_SPECS],[
#@TEAX_FIX_LIB_SPECS
AC_REQUIRE([_TEAX_CHECK_MSVC])
if test "${USING_MSVC}" = "yes"; then
    TCL_STUB_LIB_SPEC="$TCL_STUB_LIB_PATH"
    TK_STUB_LIB_SPEC="$TK_STUB_LIB_PATH"
    # tclConfig.sh doesn't define TCL_LIB_SPEC, but if it did,
    # it would be as follows:
    eval TCL_LIB_SPEC="${TCL_EXEC_PREFIX}/lib/$TCL_LIB_FILE"
    # Same for TK_LIB_SPEC:
    eval TK_LIB_SPEC="${TK_EXEC_PREFIX}/lib/$TK_LIB_FILE"
fi
])