--- popt/configure.in.orig	Fri Dec 11 03:37:23 1998
+++ popt/configure.in	Tue Nov  9 01:57:42 1999
@@ -2,6 +2,11 @@
 AM_INIT_AUTOMAKE(popt, 1.2.2)
 AM_CONFIG_HEADER(config.h)
 
+dnl default to not using NLS
+XGETTEXT=""
+LIBINTL=""
+PO=""
+
 AC_PROG_CC
 AC_GCC_TRADITIONAL
 AM_C_PROTOTYPES
@@ -38,7 +43,7 @@
 fi
 AC_SUBST(TARGET)
 
-AC_CHECK_HEADERS(unistd.h alloca.h libintl.h)
+AC_CHECK_HEADERS(unistd.h alloca.h)
 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
 if test -d /usr/ucblib ; then
 	if test "$build" = "mips-sni-sysv4" ; then
@@ -53,11 +58,48 @@
 fi
 
 AC_CHECK_FUNCS(strerror)
-AC_CHECK_FUNCS(gettext)
-AC_CHECK_FUNCS(dgettext)
 AC_CHECK_FUNC(setreuid, [], [
     AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
 ])
+
+dnl
+dnl handle --disable-nls  
+dnl
+AC_ARG_ENABLE([nls],
+[  --disable-nls           do not use National Language Support],
+	USE_NLS=$enableval, USE_NLS=yes)
+
+if test "$USE_NLS" != "no"; then
+    AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"],
+      AC_CHECK_LIB(intl, gettext, [LIBINTL="-lintl" HAVEGETTEXT="y"],
+		   AC_MSG_WARN([sorry this package needs libintl.a (from the
+    gettext package)])
+		 )
+		)
+
+    AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
+
+    if test "$XGETTEXT" != ""; then
+	if xgettext --help 2>&1 | grep illegal >/dev/null ; then
+	    echo "xgettext isn't GNU version"
+	    XGETTEXT=""
+	fi
+    fi
+     
+    if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
+	echo "xgettext and gettext() exist; will build i18n support"
+	PO=po
+    else     
+	echo "xgettext and libintl.a don't both exist; will not build i18n support"
+    fi
+else 
+    echo "user specificed no gettext; will not build i18n support"
+fi
+
+if test "$PO" = po; then
+    AC_CHECK_HEADERS(libintl.h)
+fi
+AC_SUBST(PO)
 
 AC_OUTPUT([Makefile  po/Makefile.in],
 	[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
