1#!/bin/bash -norc 2dnl This file is an input file used by the GNU "autoconf" program to 3dnl generate the file "configure", which is run during Tcl installation 4dnl to configure the system for the local environment. 5# 6# RCS: @(#) $Id: configure.ac,v 1.33 2010/01/11 23:27:16 treectrl Exp $ 7 8#----------------------------------------------------------------------- 9# Sample configure.in for Tcl Extensions. 10# See the TEA sample extension for description of structure and items. 11#----------------------------------------------------------------------- 12 13#----------------------------------------------------------------------- 14# __CHANGE__ 15# This very first macro is used to verify that the configure script can 16# find the sources. The argument to AC_INIT should be a unique filename 17# for this package, and can be a relative path, such as: 18# 19# AC_INIT(generic/tcl.h) 20#----------------------------------------------------------------------- 21 22AC_INIT([treectrl], [2.2]) 23AC_SUBST([PACKAGE_PATCHLEVEL], [2.2.10]) 24AC_DEFINE_UNQUOTED(PACKAGE_PATCHLEVEL, "$PACKAGE_PATCHLEVEL") 25 26TEA_INIT([3.9]) 27 28AC_CONFIG_AUX_DIR(tclconfig) 29 30#-------------------------------------------------------------------- 31# Load the tclConfig.sh file 32#-------------------------------------------------------------------- 33 34TEA_PATH_TCLCONFIG 35TEA_LOAD_TCLCONFIG 36 37#-------------------------------------------------------------------- 38# Load the tkConfig.sh file if necessary (Tk extension) 39#-------------------------------------------------------------------- 40 41TEA_PATH_TKCONFIG 42TEA_LOAD_TKCONFIG 43 44#----------------------------------------------------------------------- 45# Handle the --prefix=... option by defaulting to what Tcl gave. 46# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. 47#----------------------------------------------------------------------- 48 49TEA_PREFIX 50 51#----------------------------------------------------------------------- 52# Standard compiler checks. 53# This sets up CC by using the CC env var, or looks for gcc otherwise. 54# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create 55# the basic setup necessary to compile executables. 56#----------------------------------------------------------------------- 57 58TEA_SETUP_COMPILER 59 60#----------------------------------------------------------------------- 61# __CHANGE__ 62# Specify the C source files to compile in TEA_ADD_SOURCES, 63# public headers that need to be installed in TEA_ADD_HEADERS, 64# stub library C source files to compile in TEA_ADD_STUB_SOURCES, 65# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. 66# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS 67# and PKG_TCL_SOURCES. 68#----------------------------------------------------------------------- 69 70TEA_ADD_SOURCES([qebind.c tkTreeColumn.c tkTreeCtrl.c tkTreeDisplay.c 71 tkTreeDrag.c tkTreeElem.c tkTreeItem.c tkTreeMarquee.c 72 tkTreeNotify.c tkTreeStyle.c tkTreeTheme.c tkTreeUtils.c]) 73TEA_ADD_HEADERS([]) 74#TEA_ADD_INCLUDES([-I. -I\"`${CYGPATH} ${srcdir}/generic`\"]) 75TEA_ADD_CFLAGS([]) 76TEA_ADD_STUB_SOURCES([]) 77TEA_ADD_TCL_SOURCES([library/treectrl.tcl library/filelist-bindings.tcl]) 78 79#-------------------------------------------------------------------- 80# __CHANGE__ 81# Choose which headers you need. Extension authors should try very 82# hard to only rely on the Tcl public header files. Internal headers 83# contain private data structures and are subject to change without 84# notice. 85# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG 86#-------------------------------------------------------------------- 87 88#TEA_PUBLIC_TCL_HEADERS 89TEA_PRIVATE_TCL_HEADERS 90 91#TEA_PUBLIC_TK_HEADERS 92TEA_PRIVATE_TK_HEADERS 93 94#-------------------------------------------------------------------- 95# For Unix/Tk builds, make sure that the X libraries/headers are found. 96#-------------------------------------------------------------------- 97 98TEA_PATH_X 99 100# Needed for OS X ppx/intel image handling 101AC_C_BIGENDIAN 102 103#-------------------------------------------------------------------- 104# __CHANGE__ 105# A few miscellaneous platform-specific items: 106# 107# Define a special symbol for Windows (BUILD_sample in this case) so 108# that we create the export library with the dll. See sha1.h on how 109# to use this. 110# 111# Windows creates a few extra files that need to be cleaned up. 112# You can add more files to clean if your extension creates any extra 113# files. 114# 115# Define any extra compiler flags in the PACKAGE_CFLAGS variable. 116# These will be appended to the current set of compiler flags for 117# your system. 118#-------------------------------------------------------------------- 119 120OUTPUTFILES=Makefile 121 122if test "${TEA_PLATFORM}" = "windows" ; then 123 AC_DEFINE(BUILD_treectrl) 124 CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" 125 TEA_ADD_LIBS([gdi32.lib user32.lib]) 126 127 AC_ARG_ENABLE(shellicon, 128 AC_HELP_STRING([--enable-shellicon], 129 [build the shellicon extension (default: no)]), 130 [tcl_ok=$enableval], [tcl_ok=no]) 131 if test "$tcl_ok" = "yes" ; then 132 AC_CONFIG_SUBDIRS(shellicon) 133 fi 134 135 # Find rc.exe or windres.exe. 136 # Defined in winrc.m4. 137 TREECTRL_PROG_RC 138 139 # X86|AMD64|IA64 for manifest 140 AC_SUBST(MACHINE) 141 142 # Create treectrl.dll.manifest from treectrl.dll.manifest.in. 143 # treectrl.dll.manifest is included by treectrl.rc. 144 # If building with a Microsoft compiler that generates 145 # treectrlNN.dll.manifest (to pick the correct MSVCRT runtime) then 146 # that manifest is merged with mine using mt.exe (see the Makefile 147 # rule for PKG_LIB_FILE). 148 OUTPUTFILES="Makefile treectrl.dll.manifest" 149 150 TREECTRL_ADD_RC([treectrl.rc]) 151else 152 CLEANFILES="pkgIndex.tcl" 153fi 154 155if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then 156 # Tk 8.6 supports Cocoa and Carbon builds, Cocoa by default 157 if test "${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}" = "8.6"; then 158 AC_MSG_CHECKING([whether to use Cocoa or Carbon]) 159 AC_ARG_ENABLE(cocoa, 160 AC_HELP_STRING([--enable-cocoa=yes|no], 161 [use Cocoa on Mac OS X (default: yes)]), 162 [tcl_ok=$enableval], [tcl_ok=yes]) 163 if test "$tcl_ok" = "yes"; then 164 TEA_ADD_CFLAGS([-DMAC_TK_COCOA -std=gnu99 -x objective-c -fobjc-gc]) 165 TEA_ADD_LIBS([-framework Cocoa -framework Carbon]) 166 else 167 TEA_ADD_CFLAGS([-DMAC_TK_CARBON]) 168 TEA_ADD_LIBS([-framework Carbon]) 169 fi 170 # Tk 8.5 supports Cocoa (back-port) and Carbon builds, Carbon by default 171 elif test "${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}" = "8.5"; then 172 AC_MSG_CHECKING([whether to use Cocoa or Carbon]) 173 AC_ARG_ENABLE(cocoa, 174 AC_HELP_STRING([--enable-cocoa=yes|no], 175 [use Cocoa on Mac OS X (default: no)]), 176 [tcl_ok=$enableval], [tcl_ok=no]) 177 if test "$tcl_ok" = "yes"; then 178 TEA_ADD_CFLAGS([-DMAC_TK_COCOA -std=gnu99 -x objective-c -fobjc-gc]) 179 TEA_ADD_LIBS([-framework Cocoa -framework Carbon]) 180 else 181 TEA_ADD_CFLAGS([-DMAC_TK_CARBON]) 182 TEA_ADD_LIBS([-framework Carbon]) 183 fi 184 else 185 TEA_ADD_CFLAGS([-DMAC_TK_CARBON]) 186 TEA_ADD_LIBS([-framework Carbon]) 187 fi 188fi 189 190AC_SUBST(CLEANFILES) 191 192#-------------------------------------------------------------------- 193# Check whether --enable-threads or --disable-threads was given. 194#-------------------------------------------------------------------- 195 196TEA_ENABLE_THREADS 197 198#-------------------------------------------------------------------- 199# The statement below defines a collection of symbols related to 200# building as a shared library instead of a static library. 201#-------------------------------------------------------------------- 202 203TEA_ENABLE_SHARED 204 205#-------------------------------------------------------------------- 206# This macro figures out what flags to use with the compiler/linker 207# when building shared/static debug/optimized objects. This information 208# can be taken from the tclConfig.sh file, but this figures it all out. 209#-------------------------------------------------------------------- 210 211TEA_CONFIG_CFLAGS 212 213#-------------------------------------------------------------------- 214# Set the default compiler switches based on the --enable-symbols option. 215#-------------------------------------------------------------------- 216 217TEA_ENABLE_SYMBOLS 218 219if test "${enable_symbols+set}" = set && test "$enable_symbols" != no; then 220 TEA_ADD_CFLAGS([-DTREECTRL_DEBUG]) 221fi 222 223#-------------------------------------------------------------------- 224# Everyone should be linking against the Tcl stub library. If you 225# can't for some reason, remove this definition. If you aren't using 226# stubs, you also need to modify the SHLIB_LD_LIBS setting below to 227# link against the non-stubbed Tcl library. Add Tk too if necessary. 228#-------------------------------------------------------------------- 229 230AC_DEFINE(USE_TCL_STUBS) 231AC_DEFINE(USE_TK_STUBS) 232 233#-------------------------------------------------------------------- 234# This macro generates a line to use when building a library. It 235# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, 236# and TEA_LOAD_TCLCONFIG macros above. 237#-------------------------------------------------------------------- 238 239TEA_MAKE_LIB 240 241#-------------------------------------------------------------------- 242# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl 243# file during the install process. Don't run the TCLSH_PROG through 244# ${CYGPATH} because it's being used directly by make. 245# Require that we use a tclsh shell version 8.2 or later since earlier 246# versions have bugs in the pkg_mkIndex routine. 247# Add WISH as well if this is a Tk extension. 248#-------------------------------------------------------------------- 249 250TEA_PROG_TCLSH 251TEA_PROG_WISH 252 253#-------------------------------------------------------------------- 254# Finally, substitute all of the various values into the Makefile. 255# You may alternatively have a special pkgIndex.tcl.in or other files 256# which require substituting th AC variables in. Include these here. 257#-------------------------------------------------------------------- 258 259AC_OUTPUT([$OUTPUTFILES]) 260