+dnl ---------------------------------------------------------------------------
+dnl CF_XOPEN_CURSES version: 8 updated: 2003/11/07 19:47:46
+dnl ---------------
+dnl Test if we should define X/Open source for curses, needed on Digital Unix
+dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
+dnl
+dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
+dnl as getbegy(). The latter is better design, but the former is standard.
+AC_DEFUN([CF_XOPEN_CURSES],
+[
+AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
+AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
+AC_TRY_LINK([
+#include <stdlib.h>
+#include <${cf_cv_ncurses_header-curses.h}>],[
+ long x = winnstr(stdscr, "", 0);
+ int x1, y1;
+ getbegyx(stdscr, y1, x1)],
+ [cf_cv_need_xopen_extension=no],
+ [AC_TRY_LINK([
+#define _XOPEN_SOURCE_EXTENDED
+#include <stdlib.h>
+#include <${cf_cv_ncurses_header-curses.h}>],[
+ long x = winnstr(stdscr, "", 0);
+ int x1, y1;
+ getbegyx(stdscr, y1, x1)],
+ [cf_cv_need_xopen_extension=yes],
+ [cf_cv_need_xopen_extension=unknown])])])
+test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_XOPEN_SOURCE version: 25 updated: 2007/01/29 18:36:38
+dnl ---------------
+dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
+dnl or adapt to the vendor's definitions to get equivalent functionality,
+dnl without losing the common non-POSIX features.
+dnl
+dnl Parameters:
+dnl $1 is the nominal value for _XOPEN_SOURCE
+dnl $2 is the nominal value for _POSIX_C_SOURCE
+AC_DEFUN([CF_XOPEN_SOURCE],[
+
+AC_REQUIRE([CF_PROG_CC_U_D])
+
+cf_XOPEN_SOURCE=ifelse($1,,500,$1)
+cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
+
+case $host_os in #(vi
+aix[[45]]*) #(vi
+ CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
+ ;;
+freebsd*) #(vi
+ # 5.x headers associate
+ # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
+ # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
+ cf_POSIX_C_SOURCE=200112L
+ cf_XOPEN_SOURCE=600
+ CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+ ;;
+hpux*) #(vi
+ CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
+ ;;
+irix[[56]].*) #(vi
+ CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
+ ;;
+linux*|gnu*|k*bsd*-gnu) #(vi
+ CF_GNU_SOURCE
+ ;;
+mirbsd*) #(vi
+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
+ ;;
+netbsd*) #(vi
+ # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+ ;;
+openbsd*) #(vi
+ # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
+ ;;
+osf[[45]]*) #(vi
+ CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
+ ;;
+nto-qnx*) #(vi
+ CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
+ ;;
+sco*) #(vi
+ # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
+ ;;
+solaris*) #(vi
+ CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
+ ;;
+*)
+ AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
+ AC_TRY_COMPILE([#include <sys/types.h>],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+ [cf_cv_xopen_source=no],
+ [cf_save="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+ AC_TRY_COMPILE([#include <sys/types.h>],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+ [cf_cv_xopen_source=no],
+ [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
+ CPPFLAGS="$cf_save"
+ ])
+])
+ if test "$cf_cv_xopen_source" != no ; then
+ CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
+ CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
+ test "$cf_cv_cc_u_d_options" = yes && \
+ CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
+ fi
+ CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
+ ;;
+esac
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41
+dnl -----------
+dnl Check for Xaw (Athena) libraries
+dnl
+dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
+AC_DEFUN([CF_X_ATHENA],
+[AC_REQUIRE([CF_X_TOOLKIT])
+cf_x_athena=${cf_x_athena-Xaw}
+
+AC_MSG_CHECKING(if you want to link with Xaw 3d library)
+withval=
+AC_ARG_WITH(Xaw3d,
+ [ --with-Xaw3d link with Xaw 3d library])
+if test "$withval" = yes ; then
+ cf_x_athena=Xaw3d
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING(if you want to link with neXT Athena library)
+withval=
+AC_ARG_WITH(neXtaw,
+ [ --with-neXtaw link with neXT Athena library])
+if test "$withval" = yes ; then
+ cf_x_athena=neXtaw
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING(if you want to link with Athena-Plus library)
+withval=
+AC_ARG_WITH(XawPlus,
+ [ --with-XawPlus link with Athena-Plus library])
+if test "$withval" = yes ; then
+ cf_x_athena=XawPlus
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+AC_CHECK_LIB(Xext,XextCreateExtension,
+ [LIBS="-lXext $LIBS"])
+
+cf_x_athena_lib=""
+
+CF_X_ATHENA_CPPFLAGS($cf_x_athena)
+CF_X_ATHENA_LIBS($cf_x_athena)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_X_ATHENA_CPPFLAGS version: 2 updated: 2002/10/09 20:00:37
+dnl --------------------
+dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
+dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
+AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
+[
+cf_x_athena_root=ifelse($1,,Xaw,$1)
+cf_x_athena_include=""
+
+for cf_path in default \
+ /usr/contrib/X11R6 \
+ /usr/contrib/X11R5 \
+ /usr/lib/X11R5 \
+ /usr/local
+do
+ if test -z "$cf_x_athena_include" ; then
+ cf_save="$CPPFLAGS"
+ cf_test=X11/$cf_x_athena_root/SimpleMenu.h
+ if test $cf_path != default ; then
+ CPPFLAGS="-I$cf_path/include $cf_save"
+ AC_MSG_CHECKING(for $cf_test in $cf_path)
+ else
+ AC_MSG_CHECKING(for $cf_test)
+ fi
+ AC_TRY_COMPILE([
+#include <X11/Intrinsic.h>
+#include <$cf_test>],[],
+ [cf_result=yes],
+ [cf_result=no])
+ AC_MSG_RESULT($cf_result)
+ if test "$cf_result" = yes ; then
+ cf_x_athena_include=$cf_path
+ break
+ else
+ CPPFLAGS="$cf_save"
+ fi
+ fi
+done
+
+if test -z "$cf_x_athena_include" ; then
+ AC_MSG_WARN(
+[Unable to successfully find Athena header files with test program])
+elif test "$cf_x_athena_include" != default ; then
+ CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_X_ATHENA_LIBS version: 6 updated: 2006/11/30 17:57:11
+dnl ----------------
+dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
+dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
+AC_DEFUN([CF_X_ATHENA_LIBS],
+[AC_REQUIRE([CF_X_TOOLKIT])
+cf_x_athena_root=ifelse($1,,Xaw,$1)
+cf_x_athena_lib=""
+
+for cf_path in default \
+ /usr/contrib/X11R6 \
+ /usr/contrib/X11R5 \
+ /usr/lib/X11R5 \
+ /usr/local
+do
+ for cf_lib in \
+ "-l$cf_x_athena_root -lXmu" \
+ "-l$cf_x_athena_root -lXpm -lXmu" \
+ "-l${cf_x_athena_root}_s -lXmu_s"
+ do
+ if test -z "$cf_x_athena_lib" ; then
+ cf_save="$LIBS"
+ cf_test=XawSimpleMenuAddGlobalActions
+ if test $cf_path != default ; then
+ LIBS="-L$cf_path/lib $cf_lib $LIBS"
+ AC_MSG_CHECKING(for $cf_lib in $cf_path)
+ else
+ LIBS="$cf_lib $LIBS"
+ AC_MSG_CHECKING(for $cf_test in $cf_lib)
+ fi
+ AC_TRY_LINK([],[$cf_test()],
+ [cf_result=yes],
+ [cf_result=no])
+ AC_MSG_RESULT($cf_result)
+ if test "$cf_result" = yes ; then
+ cf_x_athena_lib="$cf_lib"
+ break
+ fi
+ LIBS="$cf_save"
+ fi
+ done
+done
+
+if test -z "$cf_x_athena_lib" ; then
+ AC_ERROR(
+[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
+fi
+
+CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
+AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_X_TOOLKIT version: 11 updated: 2006/11/29 19:05:14
+dnl ------------
+dnl Check for X Toolkit libraries
+dnl
+AC_DEFUN([CF_X_TOOLKIT],
+[
+AC_REQUIRE([AC_PATH_XTRA])
+AC_REQUIRE([CF_CHECK_CACHE])
+
+# SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -`
+
+cf_have_X_LIBS=no
+
+LDFLAGS="$X_LIBS $LDFLAGS"
+CF_CHECK_CFLAGS($X_CFLAGS)
+
+AC_CHECK_FUNC(XOpenDisplay,,[
+AC_CHECK_LIB(X11,XOpenDisplay,
+ [LIBS="-lX11 $LIBS"],,
+ [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
+
+AC_CHECK_FUNC(XtAppInitialize,,[
+AC_CHECK_LIB(Xt, XtAppInitialize,
+ [AC_DEFINE(HAVE_LIBXT)
+ cf_have_X_LIBS=Xt
+ LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
+ [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
+
+if test $cf_have_X_LIBS = no ; then
+ AC_WARN(
+[Unable to successfully link X Toolkit library (-lXt) with
+test program. You will have to check and add the proper libraries by hand
+to makefile.])
+fi
+])dnl