Minor changes.
[ir-tcl-moved-to-github.git] / configure.in
index 0a5e489..57198ac 100644 (file)
 dnl IR toolkit for tcl/tk
-dnl (c) Index Data 1995
+dnl (c) Index Data 1996-1999
 dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.5 1995-06-23 10:58:11 adam Exp $
-AC_INIT(README)
-AC_PROG_CC
-AC_PROG_RANLIB
-AC_PROG_INSTALL
-checkBoth=0
-AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
-if test "$tk_checkSocket" = 1; then
-    AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
-fi
-if test "$checkBoth" = 1; then
-    tk_oldLibs=$LIBS
-    LIBS="$LIBS -lsocket -lnsl"
-    AC_CHECK_FUNC(accept, , [LIBS=$tk_oldLibs])
-fi
-AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
-AC_STDC_HEADERS
+dnl $Id: configure.in,v 1.28 2000-06-29 10:22:30 adam Exp $
+AC_INIT(ir-tcl.h)
+dnl ------ Substitutions
+AC_SUBST(CC)
 AC_SUBST(TCLLIB)
-AC_CHECK_LIB(tcl, Tcl_Eval, tclFound=1, tclFound=0, -lm)
-if test "$tclFound" = 1; then
-    TCLLIB=-ltcl
-else
-    TCLLIB=/usr/local/lib/libtcl.a
-fi
-AC_SUBST(YAZDIR)
-AC_SUBST(MOSI)
-AC_SUBST(MOSILIB)
-AC_SUBST(MOSIDIR)
-AC_MSG_CHECKING(for YAZ directory)
-AC_ARG_WITH(yazdir,[  --with-yazdir           Yaz directory], [YAZDIR=$withval])
-if test "$YAZDIR" = "yes"; then
-       YAZDIR="../yaz-1.0b"
-elif test "$YAZDIR" = ""; then
-       YAZDIR="../yaz-1.0b"
-       if test -d "../yaz"; then
-               YAZDIR="../yaz"
+AC_SUBST(TKLIB)
+AC_SUBST(TCLINC)
+AC_SUBST(TKINC)
+AC_SUBST(SHLIB_CFLAGS)
+AC_SUBST(SHLIB_LD)
+AC_SUBST(SHLIB_SUFFIX)
+AC_SUBST(SHLIB_VERSION)
+AC_SUBST(SHLIB_IRTCL)
+AC_SUBST(ALL_SPEC)
+AC_SUBST(IRCLIENT_SHELL)
+AC_SUBST(YAZLIB)
+AC_SUBST(YAZINC)
+dnl
+dnl ------ Build root
+AC_SUBST(build_root)
+AC_ARG_WITH(build-root, [  --with-buildroot        RPM Build root],[build_root=$withval],[build_root=""])
+dnl
+dnl ------ Preliminary settings
+AC_PROG_INSTALL
+dnl
+dnl ------ look for Tcl
+tclconfig=NONE
+tryprefix=NONE
+AC_ARG_WITH(tclconfig, [  --with-tclconfig=DIR    tclConfig.sh/tkConfig.sh in DIR (example /usr/lib)], [tclconfig=$withval])
+if test "x$tclconfig" = xNONE; then
+        saveprefix=${prefix}
+       AC_PREFIX_PROGRAM(tclsh)
+       if test "x$prefix" = xNONE; then
+               AC_PREFIX_PROGRAM(tclsh8.2)
        fi
+       if test "x$prefix" = xNONE; then
+               AC_PREFIX_PROGRAM(tclsh8.1)
+       fi
+       if test "x$prefix" = xNONE; then
+               AC_PREFIX_PROGRAM(tclsh8.0)
+       fi
+       if test "x$prefix" = xNONE; then
+               AC_PREFIX_PROGRAM(tclsh7.6)
+       fi
+       if test "x$prefix" = xNONE; then
+               AC_PREFIX_PROGRAM(tclsh7.5)
+       fi
+       if test "x$prefix" = xNONE; then
+               prefix=/usr/local
+       fi
+        tclconfig=${prefix}/lib
+       tryprefix=${prefix}
+        prefix=${saveprefix}
 fi
-AC_MSG_RESULT($YAZDIR)
-if test ! -d $YAZDIR; then
-       AC_MSG_WARN(YAZ directory doesnt exist)
-fi
-AC_MSG_CHECKING(for MOSI)
-AC_ARG_WITH(mosidir, [  --with-mosidir          MOSI directory], [MOSIDIR=$withval])
-if test "$MOSIDIR" = "yes"; then
-       MOSIDIR="../xtimosi/src"
-elif test "$MOSIDIR" = ""; then
-       MOSIDIR="../xtimosi/src"
-fi
-if test -r ${YAZDIR}/lib/librfc.a; then
-       MOSI=1
-       MOSIDIR=$MOSIDIR
-       MOSILIB='$(MOSIDIR)/libmosi.a $(YAZDIR)/lib/librfc.a'
-        MOSITELL=yes
+if test -r ${tclconfig}/tclConfig.sh; then
+       AC_MSG_CHECKING(for Tcl)
+       . ${tclconfig}/tclConfig.sh
+       TCLLIB="${TCL_LIB_SPEC} ${TCL_LIBS}"
+       TCLINC=-I${TCL_PREFIX}/include
+       RANLIB=$TCL_RANLIB
+        SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
+       SHLIB_LD=$TCL_SHLIB_LD
+       SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
+       SHLIB_VERSION=$TCL_SHLIB_VERSION
+       SHLIB_IRTCL=irtcl${TCL_SHLIB_SUFFIX}
+       ALL_SPEC="irtcl${TCL_SHLIB_SUFFIX} libirtcl.a"
+       AC_MSG_RESULT($TCL_VERSION)
+       CC=$TCL_CC
 else
-       MOSI=0
-       MOSIDIR=$MOSIDIR
-        MOSILIB=''
-        MOSITELL=no
-fi
-AC_MSG_RESULT($MOSITELL)
-AC_PATH_X
-not_really_there=""
-if test "$no_x" = ""; then
-    if test "$x_includes" = ""; then
-       AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
-    else
-       if test ! -r $x_includes/X11/Intrinsic.h; then
-           not_really_there="yes"
+       AC_PROG_CC
+        SHLIB_CFLAGS=""
+       SHLIB_LD="shared-linker"
+       SHLIB_SUFFIX=""
+       SHLIB_VERSION=""
+       SHLIB_IRTCL="irtcl-shared"
+       AC_PROG_RANLIB
+       AC_MSG_CHECKING(for Tcl)
+       TCL_VERSION=nope
+       for i in "" 7.4 7.5 7.6 8.0; do
+               if test -r ${tryprefix}/lib/libtcl${i}.a; then
+                       TCL_VERSION=$i
+               fi
+       done
+       if test "$TCL_VERSION" = nope; then
+               AC_MSG_WARN(Didn't find Tcl)
+               TCL_LIB_SPEC=-ltcl
+               TCLINC=" # -I.. Tcl/Tk include path"
+       else
+               if test "$TCL_VERSION" = ""; then
+                       AC_MSG_RESULT(7.3)
+               else
+                       AC_MSG_RESULT($TCL_VERSION)
+               fi
+               TCL_LIB_SPEC=${tryprefix}/lib/libtcl${TCL_VERSION}.a
+               TCLINC=-I${tryprefix}/include
        fi
-    fi
+       TCLLIB="${TCL_LIB_SPEC} ${LIBS} -lm"
+       ALL_SPEC="ir-tcl ir-tk"
 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 <X11/Intrinsic.h>], , XINCLUDES="nope")
-    if test "$XINCLUDES" = nope; then
-        dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /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
+dnl 
+dnl ------ Look for Yaz
+dnl See if user specified location of yaz-config; otherwise
+dnl use ../yaz if is a directory (internal development); otherwise
+dnl use yaz-config found in PATH.
+yazconfig=NONE
+yazpath=NONE
+AC_ARG_WITH(yazconfig, [  --with-yazconfig=DIR    yaz-config in DIR (example /home/yaz-1.5)], [yazpath=$withval])
+if test "x$yazpath" != "xNONE"; then
+        yazconfig=$yazpath/yaz-config
 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"
+        for i in ../yaz* ../yaz; do
+                if test -d $i; then
+                        if test -r $i/yaz-config; then
+                                yazconfig=$i/yaz-config
+                        fi
+                fi
+        done
+        if test "x$yazconfig" = "xNONE"; then
+                AC_PATH_PROG(yazconfig, yaz-config, NONE)
+        fi
 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/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /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
+AC_MSG_CHECKING(for YAZ)
+if test -r $yazconfig; then
+        . $yazconfig
+        AC_MSG_RESULT($yazconfig)
 else
-    if test "$x_libraries" = ""; then
-       XLIBSW=-lX11
-    else
-       XLIBSW="-L$x_libraries -lX11"
-    fi
+        AC_MSG_RESULT(Not found)
 fi
-if test "$XLIBSW" = nope ; then
-    AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
-fi
-if test "$XLIBSW" = nope ; then
-    echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
-    XLIBSW=-lX11
-fi
-AC_SUBST(XLIBSW)
-AC_SUBST(TKLIB)
-AC_CHECK_LIB(tk, main, tkFound=1, tkFound=0, $TCLLIB $XLIBSW -lm)
-if test "$tkFound" = 1; then
-    TKLIB=-ltk
+dnl
+dnl ------ look for Tk
+dnl
+if test -r ${tclconfig}/tkConfig.sh; then
+       AC_MSG_CHECKING(for Tk)
+       . ${tclconfig}/tkConfig.sh
+       AC_MSG_RESULT($TK_VERSION)
+       TKINC=${TK_XINCLUDES}
+       TKLIB="${TK_LIB_SPEC} ${TCL_LIB_SPEC} ${TK_LIBS}"
+       IRCLIENT_SHELL=wish${TK_VERSION}
 else
-    TKLIB=/usr/local/lib/libtk.a
+       AC_MSG_CHECKING(for Tk)
+       TK_VERSION=nope
+       for i in "" 4.0 4.1 4.2 8.0; do
+               if test -r ${tryprefix}/lib/libtk${i}.a; then
+                       TK_VERSION=$i
+               fi
+       done
+       if test "$TK_VERSION" = nope; then
+               AC_MSG_WARN(Didn't find Tk)
+               TKLIB=-ltk
+       else
+               TKLIB=${tryprefix}/lib/libtk${TK_VERSION}.a
+               if test "$TK_VERSION" = ""; then
+                       AC_MSG_RESULT(3.x)
+               else
+                       AC_MSG_RESULT($TK_VERSION)
+               fi
+       fi
+       AC_PATH_X
+       not_really_there=""
+       if test "$no_x" = ""; then
+               if test "$x_includes" = ""; then
+                       AC_TRY_CPP([#include <X11/XIntrinsic.h>], , 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 <X11/Intrinsic.h>], , XINCLUDES="nope")
+               if test "$XINCLUDES" = nope; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /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
+       if test "$no_x" = yes; then
+               XLIBSW=nope
+               if test "$XLIBSW" = nope; then
+                       dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /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
+               echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
+               XLIBSW=-lX11
+       fi
+       TKINC=$XINCLUDES
+       TKLIB="${TKLIB} ${XLIBSW} ${TCLLIB}"
+       IRCLIENT_SHELL=ir-tk
 fi
 AC_OUTPUT(Makefile)