dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. AC_PREREQ(2.5) AC_INIT(../generic/itk.h) AC_CONFIG_AUX_DIR(../../../) AC_CANONICAL_HOST AC_PROG_RANLIB AC_PROG_CC AC_OBJEXT AC_CHECK_TOOL(NM, nm, nm) AC_SUBST(NM) AC_CHECK_TOOL(AS, as, as) AC_SUBST(AS) AC_CHECK_TOOL(LD, ld, ld) AC_SUBST(LD) AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool) AC_SUBST(DLLTOOL) AC_CHECK_TOOL(WINDRES, windres, windres) AC_SUBST(WINDRES) AC_PROG_INSTALL # needed for the subtle differences between cygwin and mingw32 case "${host}" in *-*-cygwin*) DLL_LDLIBS=-lcygwin DLL_LDFLAGS='-nostartfiles -Wl,--dll' ;; *-*-mingw32*) DLL_LDLIBS= DLL_LDFLAGS='-mdll' ;; esac AC_SUBST(DLL_LDFLAGS) AC_SUBST(DLL_LDLIBS) ITCL_VERSION=3.0 ITCL_MAJOR_VERSION=3 ITCL_MINOR_VERSION=0 VERSION=${ITCL_MAJOR_VERSION}${ITCL_MINOR_VERSION} if test "${prefix}" = "NONE"; then prefix=/usr/local fi if test "${exec_prefix}" = "NONE"; then exec_prefix=$prefix fi # ----------------------------------------------------------------------- # Set up a new default --prefix. If a previous installation of # [incr Tcl] can be found searching $PATH use that directory. # ----------------------------------------------------------------------- AC_PREFIX_DEFAULT(/usr/local) AC_PREFIX_PROGRAM(itclsh) # ----------------------------------------------------------------------- BUILD_DIR=`pwd` ITK_SRC_DIR=`cd $srcdir/..; pwd` if ! test "$GCC" = yes; then tmp="`cygpath --windows $ITK_SRC_DIR`" ITK_SRC_DIR="`echo $tmp | sed -e s#\\\\\\\\#/#g`" fi cd ${BUILD_DIR} AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available], [itk_ok=$enableval], [itk_ok=no]) if test "$itk_ok" = "yes"; then AC_PROG_CC else CC=${CC-cc} AC_SUBST(CC) fi AC_HAVE_HEADERS(unistd.h limits.h) #-------------------------------------------------------------------- # See if there was a command-line option for where Tcl is; if # not, assume that its top-level directory is a sibling of ours. # CYGNUS LOCAL - Actually Tcl & Tk are siblings of the itcl directory # that contains itcl & itk & iwidgets. #-------------------------------------------------------------------- AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.0 binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd ../../../tcl/win; pwd`) if test ! -f $TCL_BIN_DIR/../unix/tclConfig.sh; then TCL_BIN_DIR=`cd ../../../tcl8.1/win;pwd` fi if test ! -f $TCL_BIN_DIR/../unix/tclConfig.sh; then AC_MSG_ERROR(There's no tclConfig.sh in $TCL_BIN_DIR; perhaps you didn't specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) fi #-------------------------------------------------------------------- # Read in configuration information generated by Tcl for shared # libraries, and arrange for it to be substituted into our # Makefile. #-------------------------------------------------------------------- file=$TCL_BIN_DIR/../unix/tclConfig.sh . $file dnl CFLAGS=$TCL_CFLAGS SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS SHLIB_LD=$TCL_SHLIB_LD SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX SHLIB_VERSION=$TCL_SHLIB_VERSION DL_LIBS=$TCL_DL_LIBS LD_FLAGS=$TCL_LD_FLAGS ITK_LD_SEARCH_FLAGS=$TCL_LD_SEARCH_FLAGS #-------------------------------------------------------------------- # See if there was a command-line option for where Tk is; if # not, assume that its top-level directory is a sibling of ours. # CYGNUS LOCAL - actually these are one level higher in the CYGNUS tree. #-------------------------------------------------------------------- AC_ARG_WITH(tcl, [ --with-tk=DIR use Tk 8.0 binaries from DIR], TK_BIN_DIR=$withval, TK_BIN_DIR=`cd ../../../tk/win; pwd`) if test ! -f $TK_BIN_DIR/../unix/tkConfig.sh; then TK_BIN_DIR=`cd ../../../tk8.1/win;pwd` fi if test ! -f $TK_BIN_DIR/../unix/tkConfig.sh; then AC_MSG_ERROR(There's no tkConfig.sh in $TK_BIN_DIR; perhaps you didn't specify the Tk *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) fi file=$TK_BIN_DIR/../unix/tkConfig.sh . $file if ! test "$GCC" = yes; then tmp="`cygpath --windows $TK_BIN_DIR`" TK_BIN_DIR="`echo $tmp | sed -e s#\\\\\\\\#/#g`" fi #-------------------------------------------------------------------- # See if there was a command-line option for where [incr Tcl] is. # If not, assume that its top-level directory is a sibling of ours. #-------------------------------------------------------------------- AC_ARG_WITH(itcl, [ --with-itcl=DIR use Itcl 3.0 binaries from DIR], ITCL_BIN_DIR=$withval, ITCL_BIN_DIR=`cd ../../itcl/win; pwd`) if test ! -d $ITCL_BIN_DIR; then AC_MSG_ERROR(Itcl directory $ITCL_BIN_DIR doesn't exist) fi if test ! -f $ITCL_BIN_DIR/Makefile; then AC_MSG_ERROR(There's no Makefile in $ITCL_BIN_DIR; perhaps you didn't specify the Itcl *build* directory (not the toplevel Itcl directory) or you forgot to configure Itcl?) fi file=$ITCL_BIN_DIR/../itclConfig.sh . $file AC_MSG_CHECKING([whether C compiler is gcc]) AC_CACHE_VAL(itcl_cv_prog_gcc, [ AC_EGREP_CPP(_cc_is_gcc_, [ #ifdef __GNUC__ _cc_is_gcc_ #endif ], [itcl_cv_prog_gcc=yes], [itcl_cv_prog_gcc=no])]) AC_MSG_RESULT([$itcl_cv_prog_gcc]) if test -z "$CFLAGS" ; then CFLAGS="-O" fi if test "$itcl_cv_prog_gcc" = "yes" ; then CFLAGS="$CFLAGS -Wshadow -Wtraditional -Wall" fi AC_MSG_CHECKING([default compiler flags]) AC_ARG_WITH(cflags, [ --with-cflags=FLAGS set compiler flags to FLAGS], [CFLAGS="$with_cflags"]) AC_MSG_RESULT([$CFLAGS]) #-------------------------------------------------------------------- # Supply a substitute for stdlib.h if it doesn't define strtol, # strtoul, or strtod (which it doesn't in some versions of SunOS). #-------------------------------------------------------------------- AC_MSG_CHECKING(stdlib.h) AC_HEADER_EGREP(strtol, stdlib.h, itk_ok=yes, itk_ok=no) AC_HEADER_EGREP(strtoul, stdlib.h, , itk_ok=no) AC_HEADER_EGREP(strtod, stdlib.h, , itk_ok=no) if test $itk_ok = no; then AC_DEFINE(NO_STDLIB_H) fi AC_MSG_RESULT($itk_ok) #-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- AC_MODE_T AC_PID_T AC_SIZE_T AC_UID_T # ----------------------------------------------------------------------- # C compiler and debugging flags # ----------------------------------------------------------------------- AC_MSG_CHECKING([which C compiler]) if test -z "$CC" ; then CC="cc" fi AC_ARG_WITH(cc, [ --with-cc=CC set C compiler to CC], [CC=$with_cc]) AC_MSG_RESULT([$CC]) AC_SUBST(CC) AC_PROG_CPP #-------------------------------------------------------------------- # Supply substitutes for missing POSIX header files. # Replacements are handled in "tclInt.h" which we include here. #-------------------------------------------------------------------- AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H)) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0) if test $tcl_ok = 0; then AC_DEFINE(NO_STDLIB_H) fi AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) if test $tcl_ok = 0; then AC_DEFINE(NO_STRING_H) fi #-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- AC_MODE_T AC_PID_T AC_SIZE_T AC_UID_T #-------------------------------------------------------------------- # Locate the X11 header files and the X11 library archive. Try # the ac_path_x macro first, but if it doesn't find the X stuff # (e.g. because there's no xmkmf program) then check through # a list of possible directories. Under some conditions the # autoconf macro will return an include directory that contains # no include files, so double-check its result just to be safe. #-------------------------------------------------------------------- AC_PATH_X not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then AC_TRY_CPP([#include ], , not_really_there="yes") else if test ! -r $x_includes/X11/Intrinsic.h; then not_really_there="yes" fi fi fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then echo checking for X11 header files XINCLUDES="# no special path needed" AC_TRY_CPP([#include ], , XINCLUDES="nope") if test "$XINCLUDES" = nope; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/include/X11R6 /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then XINCLUDES=" -I$i" fi done fi else if test "$x_includes" != ""; then XINCLUDES=-I$x_includes else XINCLUDES="# no special path needed" fi fi if test "$XINCLUDES" = nope; then echo "Warning: couldn't find any X11 include files." XINCLUDES="# no include files found" fi AC_SUBST(XINCLUDES) if test "$no_x" = yes; then XLIBSW=nope if test "$XLIBSW" = nope; then dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/lib/X11R6 /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do if test -r $i/libX11.a; then XLIBSW="-L$i -lX11" fi done fi else if test "$x_libraries" = ""; then XLIBSW=-lX11 else XLIBSW="-L$x_libraries -lX11" fi fi if test "$XLIBSW" = nope ; then AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) fi if test "$XLIBSW" = nope ; then AC_MSG_RESULT(couldn't find any! Using -lX11.) XLIBSW=-lX11 fi #-------------------------------------------------------------------- # If the X library binaries are in a non-standard directory, and # if a mechanism such as -R is available on this platform for # specifying a runtime search path for shared libraries, add the X # library location into that search path. #-------------------------------------------------------------------- if test "$x_libraries" != "" -a "$ITK_LD_SEARCH_FLAGS" != ""; then itk_tmp=`sed -e "s|\\\${LIB_RUNTIME_DIR}|$x_libraries|" << EOF $ITK_LD_SEARCH_FLAGS EOF` ITK_LD_SEARCH_FLAGS="$ITK_LD_SEARCH_FLAGS $itk_tmp" fi #-------------------------------------------------------------------- # Check for the existence of various libraries. The order here # is important, so that then end up in the right order in the # command line generated by make. The -lsocket and -lnsl libraries # require a couple of special tricks: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"]) itk_checkBoth=0 AC_CHECK_FUNC(connect, itk_checkSocket=0, itk_checkSocket=1) if test "$itk_checkSocket" = 1; then AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", itk_checkBoth=1) fi if test "$itk_checkBoth" = 1; then itk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" AC_CHECK_FUNC(accept, itk_checkNsl=0, [LIBS=$itk_oldLibs]) fi AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])) #-------------------------------------------------------------------- # One more check related to the X libraries. The standard releases # of Ultrix don't support the "xauth" mechanism, so send won't work # unless TK_NO_SECURITY is defined. However, there are usually copies # of the MIT X server available as well, which do support xauth. # Check for the MIT stuff and use it if it exists. # # Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1) # because it can't deal with the "-" in the library name. #-------------------------------------------------------------------- if test -d /usr/include/mit ; then AC_MSG_CHECKING([MIT X libraries]) itk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I/usr/include/mit" itk_oldLibs=$LIBS LIBS="$LIBS -lX11-mit" AC_TRY_LINK([ #include ], [ XOpenDisplay(0); ], [ AC_MSG_RESULT(yes) XLIBSW="-lX11-mit" XINCLUDES="-I/usr/include/mit" ], AC_MSG_RESULT(no)) CFLAGS=$itk_oldCFlags LIBS=$itk_oldLibs fi #-------------------------------------------------------------------- # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. # Also, Linux requires the "ieee" library for math to # work right (and it must appear before "-lm"). #-------------------------------------------------------------------- MATH_LIBS="" AC_CHECK_FUNC(sin, , MATH_LIBS="-lm") AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) #-------------------------------------------------------------------- # If this system doesn't have a memmove procedure, use memcpy # instead. #-------------------------------------------------------------------- AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)]) #-------------------------------------------------------------------- # Figure out whether "char" is unsigned. If so, set a # #define for __CHAR_UNSIGNED__. #-------------------------------------------------------------------- #AC_C_CHAR_UNSIGNED #-------------------------------------------------------------------- # Under Solaris 2.4, strtod returns the wrong value for the # terminating character under some conditions. Check for this # and if the problem exists use a substitute procedure # "fixstrtod" (provided by Tcl) that corrects the error. #-------------------------------------------------------------------- AC_CHECK_FUNC(strtod, itk_strtod=1, itk_strtod=0) if test "$itk_strtod" = 1; then AC_MSG_CHECKING([for Solaris 2.4 strtod bug]) AC_TRY_RUN([ extern double strtod(); int main() { char *string = "NaN"; char *term; strtod(string, &term); if ((term != string) && (term[-1] == 0)) { exit(1); } exit(0); }], itk_ok=1, itk_ok=0, itk_ok=0) if test "$itk_ok" = 1; then AC_MSG_RESULT(ok) else AC_MSG_RESULT(buggy) AC_DEFINE(strtod, fixstrtod) fi fi #-------------------------------------------------------------------- # If we are building with cygwin, we need one set of library names, # otherwise, we need the Source-Navigator set. #-------------------------------------------------------------------- if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then CYGITKLIBSPEC=itk${VERSION} else CYGITKLIBSPEC="itk`echo ${VERSION} | tr -d .`" fi CYGITKLIB=lib${CYGITKLIBSPEC}.a CYGITKDLL=cygitk${VERSION}.dll CYGITKWISH=cygitkwish${VERSION}.exe CYGITKDEF=itkcyg.def CYGITKTEST=cygitktest.exe CYGIMPORTLIB=cygitk${VERSION}.lib CYGITKRES=cygitk.o CYGITKWISHRES=cygitkwish.o SNITKLIBSPEC=itk30.lib SNITKLIB=${SNITKLIBSPEC} SNITKDLL=snitk30.dll SNITKWISH=snitkwish30.exe SNITKDEF=itksn.def SNITKTEST=snitktest.exe SNIMPORTLIB=snitk30.lib SNITKRES=snitk.obj SNITKWISHRES=snitksh.obj if test "$GCC" = yes; then ITKLIBSPEC=${CYGITKLIBSPEC} ITKLIB=${CYGITKLIB} ITKDLL=${CYGITKDLL} ITKWISH=${CYGITKWISH} ITKDEF=${CYGITKDEF} ITKTEST=${CYGITKTEST} ITKIMPORTLIB=${CYGIMPORTLIB} ITKRES=${CYGITKRES} ITKWISHRES=${CYGITKWISHRES} else ITKLIBSPEC=${SNITKLIBSPEC} ITKLIB=${SNITKLIB} ITKDLL=${SNITKDLL} ITKWISH=${SNITKWISH} ITKDEF=${SNITKDEF} ITKTEST=${SNITKTEST} ITKIMPORTLIB=${SNIMPORTLIB} ITKRES=${SNITKRES} ITKWISHRES=${SNITKWISHRES} fi #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libitk as a shared library instead of a static library. #-------------------------------------------------------------------- AC_ARG_ENABLE(shared, [ --enable-shared build libitk as a shared library], [ok=$enableval], [ok=no]) if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then ITK_SHLIB_CFLAGS="${SHLIB_CFLAGS}" eval "ITK_LIB_FILE=libitk${VERSION}${SHLIB_SUFFIX}" ITK_PKG_FILE="[[file join [file dirname \$dir] ${ITK_LIB_FILE}]]" MAKE_LIB="\${SHLIB_LD} -o ${ITK_LIB_FILE} ${LIBS} \${OBJS} ${SHLIB_LD_LIBS}" RANLIB=":" else ITK_SHLIB_CFLAGS="" eval "ITK_LIB_FILE=libitk${VERSION}.a" ITK_PKG_FILE="" MAKE_LIB="ar cr ${ITK_LIB_FILE} \${OBJS}" fi # Note: in the following variable, it's important to use the absolute # path name of the Tcl directory rather than "..": this is because # AIX remembers this path and will attempt to use it at run-time to look # up the Tcl library. if test "$GCC" = yes; then ITK_BUILD_LIB_SPEC="-L`pwd` -l${ITKLIBSPEC}" ITK_LIB_SPEC="-L${exec_prefix}/lib/ITK -l{ITKLIBSPEC}" ITK_LIB_FULL_PATH="`pwd`/${ITKLIB}" else tmp="`pwd`/${ITKLIB}" tmp2="`cygpath --windows $tmp`" ITK_BUILD_LIB_SPEC="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`" ITK_LIB_FULL_PATH=${ITK_BUILD_LIB_SPEC} tmp="${exec_prefix}/lib/ITK/${ITKLIB}" tmp2="`cygpath --windows $tmp`" ITK_LIB_SPEC="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`" fi if test "$GCC" = yes; then BASELIBS="-lkernel32 $optlibs -ladvapi32 -luser32" WINLIBS="-lgdi32 -lcomdlg32 -lwinspool" LIBCDLL= else BASELIBS="kernel32.lib advapi32.lib user32.lib" WINLIBS="gdi32.lib comdlg32.lib winspool.lib" LIBCDLL="msvcrt.lib oldnames.lib" fi AC_SUBST(CFLAGS) AC_SUBST(DL_LIBS) AC_SUBST(LD_FLAGS) AC_SUBST(MATH_LIBS) AC_SUBST(MAKE_LIB) AC_SUBST(SHLIB_CFLAGS) AC_SUBST(SHLIB_LD) AC_SUBST(SHLIB_LD_LIBS) AC_SUBST(SHLIB_SUFFIX) AC_SUBST(SHLIB_VERSION) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_BUILD_LIB_SPEC) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_VERSION) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FULL_PATH) AC_SUBST(TK_BIN_DIR) AC_SUBST(TK_BUILD_LIB_SPEC) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_VERSION) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_LIB_FULL_PATH) AC_SUBST(ITCL_BIN_DIR) AC_SUBST(ITCL_BUILD_LIB_SPEC) AC_SUBST(ITCL_MAJOR_VERSION) AC_SUBST(ITCL_MINOR_VERSION) AC_SUBST(ITCL_SRC_DIR) AC_SUBST(ITCL_VERSION) AC_SUBST(ITCL_LIB_FILE) AC_SUBST(ITCL_LIB_FULL_PATH) AC_SUBST(ITK_BUILD_LIB_SPEC) AC_SUBST(ITK_LD_SEARCH_FLAGS) AC_SUBST(ITK_LIB_FILE) AC_SUBST(ITK_LIB_FULL_PATH) AC_SUBST(ITK_LIB_SPEC) AC_SUBST(ITK_PKG_FILE) AC_SUBST(ITK_SHLIB_CFLAGS) AC_SUBST(ITK_SRC_DIR) AC_SUBST(XINCLUDES) AC_SUBST(XLIBSW) AC_SUBST(CYGITKLIB) AC_SUBST(CYGITKDLL) AC_SUBST(CYGITKWISH) AC_SUBST(CYGITKDEF) AC_SUBST(CYGITKTEST) AC_SUBST(CYGIMPORTLIB) AC_SUBST(CYGITKRES) AC_SUBST(CYGITKWISHRES) AC_SUBST(SNITKLIB) AC_SUBST(SNITKDLL) AC_SUBST(SNITKWISH) AC_SUBST(SNITKDEF) AC_SUBST(SNITKTEST) AC_SUBST(SNIMPORTLIB) AC_SUBST(SNITKRES) AC_SUBST(SNITKWISHRES) AC_SUBST(ITKLIB) AC_SUBST(ITKDLL) AC_SUBST(ITKWISH) AC_SUBST(ITKDEF) AC_SUBST(ITKTEST) AC_SUBST(ITKIMPORTLIB) AC_SUBST(ITKRES) AC_SUBST(ITKWISHRES) AC_SUBST(BASELIBS) AC_SUBST(WINLIBS) AC_SUBST(LIBCDLL) AC_OUTPUT(Makefile ../unix/pkgIndex.tcl ../itkConfig.sh)