$NetBSD: patch-aa,v 1.2 2003/08/28 22:33:14 epg Exp $

--- configure.in.orig	Sun Mar 23 17:47:23 2003
+++ configure.in
@@ -350,6 +350,8 @@ AC_ARG_WITH(tclincl,[  --with-tclincl=pa
 AC_ARG_WITH(tcllib,[  --with-tcllib=path      Set location of Tcl library directory],[
 	TCLLIB="-L$withval"], [TCLLIB=])
 
+if test "x${with_tcl}" != 'xno'; then
+
 AC_MSG_CHECKING([for Tcl configuration])
 # First check to see if --with-tclconfig was specified.
 if test x"${with_tclconfig}" != x ; then
@@ -435,6 +437,8 @@ case $host in
 *)TCLDYNAMICLINKING="";;
 esac
 
+fi # test "x${with_tcl}" != 'xno'
+
 AC_SUBST(TCLINCLUDE)
 AC_SUBST(TCLLIB)
 AC_SUBST(TCLDYNAMICLINKING)
@@ -474,6 +478,8 @@ AC_ARG_WITH(python,[  --with-python=path
 
 # First figure out the name of the Python executable
 
+if test "x${PYBIN}" != 'xno'; then
+
 if test -z "$PYBIN"; then
 AC_CHECK_PROGS(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python1.4 python)
 else
@@ -503,11 +509,11 @@ if test -n "$PYTHON"; then
 
     AC_MSG_CHECKING(for Python header files)
     if test -r $PYPREFIX/include/$PYVERSION/Python.h; then
-        PYINCLUDE="-I$PYPREFIX/include/$PYVERSION -I$PYEPREFIX/lib/$PYVERSION/config"
+        PYINCLUDE="-I${BUILDLINK_DIR}/include -I$PYPREFIX/include/$PYVERSION -I$PYEPREFIX/lib/$PYVERSION/config"
     fi
     if test -z "$PYINCLUDE"; then
         if test -r $PYPREFIX/include/Py/Python.h; then
-            PYINCLUDE="-I$PYPREFIX/include/Py -I$PYEPREFIX/lib/python/lib"
+            PYINCLUDE="-I${BUILDLINK_DIR}/include -I$PYPREFIX/include/Py -I$PYEPREFIX/lib/python/lib"
         fi
     fi
     AC_MSG_RESULT($PYINCLUDE)
@@ -543,6 +549,7 @@ case $host in
 *)PYTHONDYNAMICLINKING="";;
 esac
 
+fi # test "x${PYBIN}" != 'xno'
 
 AC_SUBST(PYINCLUDE)
 AC_SUBST(PYLIB)
@@ -559,6 +566,8 @@ AC_ARG_WITH(perl5,[  --with-perl5=path  
 
 # First figure out what the name of Perl5 is
 
+if test "x${PERLBIN}" != 'xno'; then
+
 if test -z "$PERLBIN"; then
 AC_CHECK_PROGS(PERL, perl perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl)
 else
@@ -613,6 +622,8 @@ case $host in
 *)PERL5DYNAMICLINKING="";;
 esac
 
+fi # test "x${PERLBIN}" != 'xno'
+
 AC_SUBST(PERL5EXT)
 AC_SUBST(PERL5DYNAMICLINKING)
 AC_SUBST(PERL5LIB)
@@ -630,6 +641,8 @@ AC_SUBST(PERL5CCFLAGS)
 AC_ARG_WITH(java, [  --with-java=path        Set location of Java],[JAVABIN="$withval"], [JAVABIN=])
 AC_ARG_WITH(javac, [  --with-javac=path       Set location of Javac],[JAVACBIN="$withval"], [JAVACBIN=])
 
+if test "x${JAVABIN}" != 'xno'; then
+
 if test -z "$JAVABIN" ; then
   AC_CHECK_PROGS(JAVA, java kaffe guavac)
 else
@@ -697,6 +710,7 @@ case $host in
 *)JAVALIBRARYPREFIX="lib";;
 esac
 
+fi # test "x${JAVABIN}" != 'xno'
 
 AC_SUBST(JAVA)
 AC_SUBST(JAVAC)
@@ -711,15 +725,17 @@ AC_SUBST(JAVALIBRARYPREFIX)
 GUILEINCLUDE=
 GUILELIB=
 GUILELINK=
+GUILEPACKAGE=
+
+AC_ARG_WITH(guile,[  --with-guile=path       Set location of Guile],[
+	GUILEPACKAGE="$withval"], [GUILEPACKAGE=])
+
+if test "x${GUILEPACKAGE}" != 'xno'; then
 
 AC_PATH_PROG(GUILE_CONFIG, guile-config)
 
 if test -n "$GUILE_CONFIG" ; then
 
-  GUILEPACKAGE=
-
-  AC_ARG_WITH(guile,[  --with-guile=path       Set location of Guile],[
-	GUILEPACKAGE="$withval"], [GUILEPACKAGE=])
   AC_ARG_WITH(guileincl,[  --with-guileincl=path   Set location of Guile include directory],[
 	GUILEINCLUDE="$withval"], [GUILEINCLUDE=])
   AC_ARG_WITH(guilelib,[  --with-guilelib=path    Set location of Guile library directory],[
@@ -770,6 +786,8 @@ if test -n "$GUILE_CONFIG" ; then
 
 fi # have GUILE_CONFIG
 
+fi # test "x${GUILEPACKAGE}" != 'xno'
+
 AC_SUBST(GUILEINCLUDE)
 AC_SUBST(GUILELIB)
 AC_SUBST(GUILELINK)
@@ -788,6 +806,8 @@ RUBYBIN=
 
 AC_ARG_WITH(ruby,[  --with-ruby=path        Set location of Ruby executable],[ RUBYBIN="$withval"], [RUBYBIN=])
 
+if test "x${RUBYBIN}" != 'xno'; then
+
 # First figure out what the name of Ruby is
 
 if test -z "$RUBYBIN"; then
@@ -863,6 +883,7 @@ case $host in
 *)		RUBYDYNAMICLINKING="";;
 esac
 
+fi # test "x${RUBYBIN}" != 'xno'
 
 AC_SUBST(RUBYINCLUDE)
 AC_SUBST(RUBYLIB)
@@ -878,6 +899,8 @@ PHP4BIN=
 
 AC_ARG_WITH(php4,[  --with-php4=path	  Set location of PHP4 executable],[ PHP4BIN="$withval"], [PHP4BIN=])
 
+if test "x${PHP4BIN}" != 'xno'; then
+
 if test -z "$PHP4BIN"; then
 AC_CHECK_PROGS(PHP4, php, php4)
 else
@@ -900,6 +923,8 @@ if test -z "$PHP4INC"; then
 	AC_MSG_RESULT(not found)
 fi
 
+fi # test "x${PHP4BIN}" != 'xno'
+
 AC_SUBST(PHP4INC)
 
 # kludges to ease naming conventions conformance.
@@ -932,6 +957,8 @@ else
 OCAMLFIND="$OCAMLFIND"
 fi
 
+if test "x${OCAMLBIN}" != 'xno'; then
+
 AC_MSG_CHECKING(for Ocaml compiler)
 if test -z "$OCAMLC"; then
 AC_CHECK_PROGS(OCAMLC, ocamlc, ocamlc)
@@ -967,6 +994,8 @@ if test -z "$OCAMLINC"; then
 	AC_MSG_RESULT(not found)
 fi
 
+fi # test "x${OCAMLBIN}" != 'xno'
+
 export OCAMLINC
 export OCAMLBIN
 export OCAMLC
@@ -988,6 +1017,9 @@ AC_SUBST(OCAMLMKTOP)
 # Identify the name of the Pike executable
 PIKEBIN=
 AC_ARG_WITH(pike,[  --with-pike=path       Set location of Pike executable],[ PIKEBIN="$withval"], [PIKEBIN=])
+
+if test "x${PIKEBIN}" != 'xno'; then
+
 if test -z "$PIKEBIN"; then
 	AC_CHECK_PROGS(PIKE, pike)
 else
@@ -1013,6 +1045,8 @@ fi
 else
         AC_MSG_RESULT($PIKEINCLUDE)
 fi
+
+fi # test "x${PIKEBIN}" != 'xno'; then
 
 AC_SUBST(PIKEINCLUDE)
 AC_SUBST(PIKECCDLFLAGS)
