| 1 |
# |
| 2 |
# Include the TEA standard macro set |
| 3 |
# |
| 4 |
|
| 5 |
builtin(include,tclconfig/tcl.m4) |
| 6 |
|
| 7 |
# |
| 8 |
# Add here whatever m4 macros you want to define for your package |
| 9 |
# |
| 10 |
|
| 11 |
#------------------------------------------------------------------------ |
| 12 |
# CRITCL_TEA_PUBLIC_PACKAGE_HEADERS -- |
| 13 |
# |
| 14 |
# Locate the installed public FOO header files |
| 15 |
# |
| 16 |
# Arguments: |
| 17 |
# Name of the package to search headers for. |
| 18 |
# |
| 19 |
# Requires: |
| 20 |
# CYGPATH must be set |
| 21 |
# |
| 22 |
# Results: |
| 23 |
# |
| 24 |
# Adds a --with-[$1]-include switch to configure. |
| 25 |
# Result is cached. |
| 26 |
# |
| 27 |
# Substs the following vars: |
| 28 |
# CRITCL_API_$1_INCLUDE |
| 29 |
#------------------------------------------------------------------------ |
| 30 |
|
| 31 |
AC_DEFUN([CRITCL_TEA_PUBLIC_PACKAGE_HEADERS],[ |
| 32 |
# CRITCL_TEA_PUBLIC_PACKAGE_HEADERS: $1 |
| 33 |
AC_MSG_CHECKING([for $1 public headers]) |
| 34 |
AC_ARG_WITH([$1-include], [ --with-$1-include directory containing the public $1 header files], [with_$1_include=${withval}]) |
| 35 |
AC_CACHE_VAL(ac_cv_c_$1_header, [ |
| 36 |
# Use the value from --with-$1-include, if it was given |
| 37 |
|
| 38 |
if test x"[$]{with_$1_include}" != x ; then |
| 39 |
if test -f "[$]{with_$1_include}/$1Decls.h" ; then |
| 40 |
ac_cv_c_$1_header=[$]{with_$1_include} |
| 41 |
else |
| 42 |
AC_MSG_ERROR([[$]{with_$1_include} directory does not contain $1Decls.h]) |
| 43 |
fi |
| 44 |
else |
| 45 |
list="" |
| 46 |
if test "`uname -s`" = "Darwin"; then |
| 47 |
# If $1 was built as a framework, attempt to use |
| 48 |
# the framework's Headers directory |
| 49 |
case [$]{$1_DEFS} in |
| 50 |
*$1_FRAMEWORK*) |
| 51 |
list="`ls -d [$]{$1_BIN_DIR}/Headers 2>/dev/null`" |
| 52 |
;; |
| 53 |
esac |
| 54 |
fi |
| 55 |
|
| 56 |
# Check order: pkg --prefix location, Tcl's --prefix location, |
| 57 |
# relative to directory of $1Config.sh. |
| 58 |
|
| 59 |
eval "temp_includedir=[$]{includedir}" |
| 60 |
list="[$]list \ |
| 61 |
`ls -d [$]{temp_includedir} 2>/dev/null` \ |
| 62 |
`ls -d [$]{$1_PREFIX}/include 2>/dev/null` \ |
| 63 |
`ls -d [$]{$1_BIN_DIR}/../include 2>/dev/null` \ |
| 64 |
`ls -d ${TCL_PREFIX}/include 2>/dev/null` \ |
| 65 |
`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`" |
| 66 |
|
| 67 |
if test "[$]{TEA_PLATFORM}" != "windows" -o "[$]GCC" = "yes"; then |
| 68 |
list="[$]list /usr/local/include /usr/include" |
| 69 |
if test x"[$]{$1_INCLUDE_SPEC}" != x ; then |
| 70 |
d=`echo "[$]{$1_INCLUDE_SPEC}" | sed -e 's/^-I//'` |
| 71 |
list="[$]list `ls -d ${d} 2>/dev/null`" |
| 72 |
fi |
| 73 |
fi |
| 74 |
for i in [$]list ; do |
| 75 |
if test -f "[$]i/$1/$1Decls.h" ; then |
| 76 |
ac_cv_c_$1_header=[$]i |
| 77 |
break |
| 78 |
fi |
| 79 |
done |
| 80 |
fi |
| 81 |
]) |
| 82 |
|
| 83 |
# Print a message based on how we determined the include path |
| 84 |
if test x"[$]{ac_cv_c_$1_header}" = x ; then |
| 85 |
AC_MSG_ERROR([$1Decls.h not found. Please specify its location with --with-$1-include]) |
| 86 |
else |
| 87 |
AC_MSG_RESULT([[$]{ac_cv_c_$1_header}]) |
| 88 |
fi |
| 89 |
|
| 90 |
# Convert to a native path and substitute into the transfer variable. |
| 91 |
# NOTE: Anything going into actual TEA would have to use A TEA_xx |
| 92 |
# transfer variable, instead of critcl. |
| 93 |
INCLUDE_DIR_NATIVE=`[$]{CYGPATH} [$]{ac_cv_c_$1_header}` |
| 94 |
CRITCL_API_$1_INCLUDE="\"[$]{INCLUDE_DIR_NATIVE}\"" |
| 95 |
AC_SUBST([CRITCL_API_$1_INCLUDE]) |
| 96 |
]) |
| 97 |
|
| 98 |
#------------------------------------------------------------------------ |
| 99 |
# CRITCL_TEA_WITH_CONFIG -- |
| 100 |
# |
| 101 |
# Declare a --with-FOO option, with default and legal values. |
| 102 |
# |
| 103 |
# Arguments: |
| 104 |
# Name of the option. |
| 105 |
# List of legal values. |
| 106 |
# Default value. |
| 107 |
# Option description. |
| 108 |
# |
| 109 |
# Requires: |
| 110 |
# Results: |
| 111 |
# Adds a --with-[$1] switch to configure. |
| 112 |
# |
| 113 |
# Substs the following vars: |
| 114 |
# CRITCL_UCONFIG_$1 |
| 115 |
#------------------------------------------------------------------------ |
| 116 |
|
| 117 |
AC_DEFUN([CRITCL_TEA_WITH_CONFIG],[ |
| 118 |
# CRITCL_TEA_WITH_CONFIG: $1 |
| 119 |
AC_ARG_WITH([$1], |
| 120 |
AC_HELP_STRING([--with-$1], |
| 121 |
[$4]), |
| 122 |
[with_uc_$1=${withval}]) |
| 123 |
|
| 124 |
# Use default if user did not specify anything. |
| 125 |
if test x"[$]{with_uc_$1}" = x ; then |
| 126 |
with_uc_$1="$3" |
| 127 |
fi |
| 128 |
|
| 129 |
AC_MSG_CHECKING([Validating $1]) |
| 130 |
tcl_ok=no |
| 131 |
for x in $2 |
| 132 |
do |
| 133 |
if test "[$]x" = "[$]with_uc_$1" ; then |
| 134 |
tcl_ok=yes |
| 135 |
break |
| 136 |
fi |
| 137 |
done |
| 138 |
if test "[$]tcl_ok" = "no" ; then |
| 139 |
AC_MSG_ERROR([Illegal value [$]with_uc_$1, expected one of: $2]) |
| 140 |
else |
| 141 |
AC_MSG_RESULT([[$]with_uc_$1]) |
| 142 |
fi |
| 143 |
|
| 144 |
CRITCL_UCONFIG_$1="-with-$1 \"[$]with_uc_$1\"" |
| 145 |
AC_SUBST([CRITCL_UCONFIG_$1]) |
| 146 |
]) |
| 147 |
|
| 148 |
#------------------------------------------------------------------------ |
| 149 |
# CRITCL_TEA_BOOL_CONFIG -- |
| 150 |
# |
| 151 |
# Declare a --disable/enable-FOO option, with default. |
| 152 |
# |
| 153 |
# Arguments: |
| 154 |
# Name of the option. |
| 155 |
# Default value. |
| 156 |
# Option description. |
| 157 |
# |
| 158 |
# Requires: |
| 159 |
# Results: |
| 160 |
# Adds a --enable-[$1] switch to configure. |
| 161 |
# |
| 162 |
# Substs the following vars: |
| 163 |
# CRITCL_UCONFIG_$1 |
| 164 |
#------------------------------------------------------------------------ |
| 165 |
|
| 166 |
AC_DEFUN([CRITCL_TEA_BOOL_CONFIG],[ |
| 167 |
# CRITCL_TEA_BOOL_CONFIG: $1 |
| 168 |
AC_ARG_ENABLE([$1], |
| 169 |
AC_HELP_STRING([--enable-$1],[$3]), |
| 170 |
[bool_uc_$1=${enableval}] |
| 171 |
[bool_uc_$1="$2"]) |
| 172 |
|
| 173 |
if test "bool_uc_$1" = "yes" ; then |
| 174 |
CRITCL_UCONFIG_$1="-enable $1" |
| 175 |
else |
| 176 |
CRITCL_UCONFIG_$1="-disable $1" |
| 177 |
fi |
| 178 |
|
| 179 |
AC_SUBST([CRITCL_UCONFIG_$1]) |
| 180 |
]) |