diff options
Diffstat (limited to 'otherlibs/labltk/configure.in')
-rw-r--r-- | otherlibs/labltk/configure.in | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/otherlibs/labltk/configure.in b/otherlibs/labltk/configure.in new file mode 100644 index 0000000000..05097b94aa --- /dev/null +++ b/otherlibs/labltk/configure.in @@ -0,0 +1,167 @@ +dnl This file is an input file used by the GNU "autoconf" program to +dnl generate the file "configure", which in turn produces the files +dnl "Makefile.config" and "labltklink". +dnl If you don't have autoconf installed, simply use the "configure" +dnl script. +dnl Usage: +dnl $ autoconf configure.in > configure +dnl edit site.config +dnl $ ./configure -with-config=site.config +dnl NOTE: autoconf 2.4 CHOKES on this. Use a newer version (e.g 2.7). + +dnl This is the file that must exist in srcdir +AC_INIT(Widgets.src) + +dnl Rather use gcc +AC_PROG_CC +AC_HAVE_HEADERS(unistd.h limits.h) + +dnl Defaults for variables, overriden in site.config +LIBEXT= +TKNAME=tk + +dnl We need locations in the first place +AC_ARG_WITH(config, + [ --with-config=Site specific locations of various software. Check the INSTALL instructions], + if test -f $withval; then + SITECFG=`dirname $withval`/`basename $withval` + . $SITECFG + else + AC_MSG_ERROR($withval does not exist) + fi, + AC_MSG_ERROR( +You must provide a file giving the location of various software using the option --with-config=file. Check the INSTALL instructions)) + +if test -z "$OCAMLLIBDIR"; then + AC_MSG_ERROR("OCAMLLIBDIR is still undefined. Edit $SITECFG") +fi + +if test -z "$INSTALLDIR"; then + AC_MSG_ERROR("INSTALLDIR is still undefined. Edit $SITECFG") +fi + +if test -z "$INSTALLBINDIR"; then + AC_MSG_ERROR("INSTALLBINDIR is still undefined. Edit $SITECFG") +fi + +dnl builtin rule for X +AC_PATH_XTRA +WITH_X="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" +CPPFLAGS="$CPPFLAGS $X_CFLAGS" + +dnl builtin rule for ranlib +AC_PROG_RANLIB + +dnl where is cpp +AC_PATH_PROG(CPPPROG, cpp, /lib/cpp, $PATH) + +dnl As soon as we use this, we must have install-sh available. Damn. +dnl AC_CANONICAL_HOST + +LIBS="-lm" + +### We probably need more +AC_CHECK_LIB(dl, dlopen, LIBS="-ldl $LIBS") + +### Check for Tcl7.5(7.6,8.0) and Tk4.1(4.2) +AC_CHECKING(Tcl and Tk includes and libraries) + +AC_CHECK_HEADERS(tcl.h,, + AC_MSG_ERROR(Can't find tcl.h. Check the CPPFLAGS variable in $SITECFG)) + +AC_CHECK_HEADERS(tk.h,, + AC_MSG_ERROR(Can't find tk.h. Check the CPPFLAGS variable in $SITECFG)) + +AC_MSG_CHECKING(Tcl version) +### Check Tcl version +tclver=no +AC_EGREP_CPP(^VERSION=.*7\.5, [#include <tcl.h> +VERSION=TCL_VERSION], tclver=7.5) +if test $tclver = no; then +AC_EGREP_CPP(^VERSION=.*7\.6, [#include <tcl.h> +VERSION=TCL_VERSION], tclver=7.6) +fi +if test $tclver = no; then +AC_EGREP_CPP(^VERSION=.*8\.0, [#include <tcl.h> +VERSION=TCL_VERSION], tclver=8.0) +fi +if test $tclver = no; then +AC_EGREP_CPP(^VERSION=.*8\.1, [#include <tcl.h> +VERSION=TCL_VERSION], tclver=8.1) +fi +if test $tclver = no; then +AC_EGREP_CPP(^VERSION=.*8\.2, [#include <tcl.h> +VERSION=TCL_VERSION], tclver=8.2) +fi +AC_MSG_RESULT($tclver) + +case $tclver in +7.5) tclmaj=7 tclmin=5 tkmaj=4 tkmin=1 ;; +7.6) tclmaj=7 tclmin=6 tkmaj=4 tkmin=2 ;; +8.0) tclmaj=8 tclmin=0 tkmaj=8 tkmin=0 ;; +8.1) tclmaj=8 tclmin=1 tkmaj=8 tkmin=1 ;; +8.2) tclmaj=8 tclmin=2 tkmaj=8 tkmin=2 ;; +esac + +if test x$tkmaj = x8; then + CPPFLAGS="-DTK80 $CPPFLAGS" +fi + +tcllib="tcl$tclmaj$tclmin$LIBEXT" +tcllibd="tcl$tclmaj.$tclmin$LIBEXT" + +dnl We use Tcl_DoOneEvent to be sure to get version >= 7.5 +AC_CHECK_LIB($tcllibd, Tcl_DoOneEvent, + LIBS="-l$tcllibd $LIBS" tkver=$tkmaj.$tkmin, + AC_CHECK_LIB($tcllib, Tcl_DoOneEvent, + LIBS="-l$tcllib $LIBS" tkver=$tkmaj$tkmin, + AC_CHECK_LIB(tcl$LIBEXT, Tcl_DoOneEvent, LIBS="-ltcl$LIBEXT $LIBS", + AC_MSG_ERROR(Can't find a tcl library. +Check config.log to see what happened, and try setting LDFLAGS in $SITECFG), + $X_EXTRA_LIBS), + $X_EXTRA_LIBS), + $X_EXTRA_LIBS) + +tklib="${TKNAME}${tkver}${LIBEXT}" + +dnl We use Tk_SetGrid to be sure to get version >= 4.1 +AC_CHECK_LIB($tklib, Tk_SetGrid, LIBS="-l$tklib $LIBS", + AC_MSG_ERROR(Can't find a tk library. +Check config.log to see what happened, and try setting LDFLAGS in $SITECFG), + $WITH_X -lm) + +dnl This is the file that we produce +dnl These are the variables that are substituted in Makefile.config.in to +dnl produce Makefile.config + +dnl The OCAML library +AC_SUBST(OCAMLLIBDIR) + +dnl Install dir +AC_SUBST(INSTALLDIR) +AC_SUBST(INSTALLBINDIR) + +dnl Info collected about X +dnl The includes and options +dnl AC_SUBST(X_CFLAGS) + +dnl The libraries +dnl special trick to substitute -L and -l ... +dnl All options (for cc compilation) +AC_SUBST(WITH_X) +dnl X link options +AC_SUBST(X_LIBS) +THE_X_LIBS="$X_PRE_LIBS -lX11 $X_EXTRA_LIBS" +AC_SUBST(THE_X_LIBS) + +dnl Tcl/Tk +dnl CPPFLAGS, LIBS and LDFLAGS are substituted by default + +dnl Info collected about ranlib +AC_SUBST(RANLIB) +AC_SUBST(CPPPROG) +dnl LIBS is subsituted by default +AC_SUBST(OCAMLSRCDIR) + +dnl Files to generate +AC_OUTPUT(Makefile.config labltk labltklink labltkopt) |