Work on configure.
[ir-tcl-moved-to-github.git] / configure.in
1 dnl IR toolkit for tcl/tk
2 dnl (c) Index Data 1995
3 dnl See the file LICENSE for details.
4 dnl $Id: configure.in,v 1.5 1995-06-23 10:58:11 adam Exp $
5 AC_INIT(README)
6 AC_PROG_CC
7 AC_PROG_RANLIB
8 AC_PROG_INSTALL
9 checkBoth=0
10 AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
11 if test "$tk_checkSocket" = 1; then
12     AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", checkBoth=1)
13 fi
14 if test "$checkBoth" = 1; then
15     tk_oldLibs=$LIBS
16     LIBS="$LIBS -lsocket -lnsl"
17     AC_CHECK_FUNC(accept, , [LIBS=$tk_oldLibs])
18 fi
19 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
20 AC_STDC_HEADERS
21 AC_SUBST(TCLLIB)
22 AC_CHECK_LIB(tcl, Tcl_Eval, tclFound=1, tclFound=0, -lm)
23 if test "$tclFound" = 1; then
24     TCLLIB=-ltcl
25 else
26     TCLLIB=/usr/local/lib/libtcl.a
27 fi
28 AC_SUBST(YAZDIR)
29 AC_SUBST(MOSI)
30 AC_SUBST(MOSILIB)
31 AC_SUBST(MOSIDIR)
32 AC_MSG_CHECKING(for YAZ directory)
33 AC_ARG_WITH(yazdir,[  --with-yazdir           Yaz directory], [YAZDIR=$withval])
34 if test "$YAZDIR" = "yes"; then
35         YAZDIR="../yaz-1.0b"
36 elif test "$YAZDIR" = ""; then
37         YAZDIR="../yaz-1.0b"
38         if test -d "../yaz"; then
39                 YAZDIR="../yaz"
40         fi
41 fi
42 AC_MSG_RESULT($YAZDIR)
43 if test ! -d $YAZDIR; then
44         AC_MSG_WARN(YAZ directory doesnt exist)
45 fi
46 AC_MSG_CHECKING(for MOSI)
47 AC_ARG_WITH(mosidir, [  --with-mosidir          MOSI directory], [MOSIDIR=$withval])
48 if test "$MOSIDIR" = "yes"; then
49         MOSIDIR="../xtimosi/src"
50 elif test "$MOSIDIR" = ""; then
51         MOSIDIR="../xtimosi/src"
52 fi
53 if test -r ${YAZDIR}/lib/librfc.a; then
54         MOSI=1
55         MOSIDIR=$MOSIDIR
56         MOSILIB='$(MOSIDIR)/libmosi.a $(YAZDIR)/lib/librfc.a'
57         MOSITELL=yes
58 else
59         MOSI=0
60         MOSIDIR=$MOSIDIR
61         MOSILIB=''
62         MOSITELL=no
63 fi
64 AC_MSG_RESULT($MOSITELL)
65 AC_PATH_X
66 not_really_there=""
67 if test "$no_x" = ""; then
68     if test "$x_includes" = ""; then
69         AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
70     else
71         if test ! -r $x_includes/X11/Intrinsic.h; then
72             not_really_there="yes"
73         fi
74     fi
75 fi
76 if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
77     echo checking for X11 header files
78     XINCLUDES="# no special path needed"
79     AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
80     if test "$XINCLUDES" = nope; then
81         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"
82         for i in $dirs ; do
83             if test -r $i/X11/Intrinsic.h; then
84                 XINCLUDES=" -I$i"
85             fi
86         done
87     fi
88 else
89     if test "$x_includes" != ""; then
90         XINCLUDES=-I$x_includes
91     else
92         XINCLUDES="# no special path needed"
93     fi
94 fi
95 if test "$XINCLUDES" = nope; then
96   echo "Warning:  couldn't find any X11 include files."
97   XINCLUDES="# no include files found"
98 fi
99 AC_SUBST(XINCLUDES)
100 if test "$no_x" = yes; then
101     XLIBSW=nope
102     if test "$XLIBSW" = nope; then
103         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"
104         for i in $dirs ; do
105             if test -r $i/libX11.a; then
106                 XLIBSW="-L$i -lX11"
107             fi
108         done
109     fi
110 else
111     if test "$x_libraries" = ""; then
112         XLIBSW=-lX11
113     else
114         XLIBSW="-L$x_libraries -lX11"
115     fi
116 fi
117 if test "$XLIBSW" = nope ; then
118     AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
119 fi
120 if test "$XLIBSW" = nope ; then
121     echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
122     XLIBSW=-lX11
123 fi
124 AC_SUBST(XLIBSW)
125 AC_SUBST(TKLIB)
126 AC_CHECK_LIB(tk, main, tkFound=1, tkFound=0, $TCLLIB $XLIBSW -lm)
127 if test "$tkFound" = 1; then
128     TKLIB=-ltk
129 else
130     TKLIB=/usr/local/lib/libtk.a
131 fi
132 AC_OUTPUT(Makefile)