]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/aclocal.m4
ncurses 5.9 - patch 20110924
[ncurses.git] / test / aclocal.m4
index 41641b507f5a55fb6ee95cb50b8647fc39d254cb..736067db813809f8b1d917cb28e4a66c6c669c37 100644 (file)
@@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written       *
 dnl authorization.                                                           *
 dnl***************************************************************************
 dnl
-dnl $Id: aclocal.m4,v 1.49 2011/01/15 23:47:10 tom Exp $
+dnl $Id: aclocal.m4,v 1.66 2011/09/24 16:54:41 tom Exp $
 dnl
 dnl Author: Thomas E. Dickey
 dnl
@@ -40,6 +40,31 @@ dnl See http://invisible-island.net/autoconf/ for additional information.
 dnl
 dnl ---------------------------------------------------------------------------
 dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_CHECK version: 2 updated: 2011/05/08 11:22:03
+dnl ------------------
+dnl Conditionally generate script according to whether we're using a given autoconf.
+dnl
+dnl $1 = version to compare against
+dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
+dnl $3 = code to use if AC_ACVERSION is older than $1.
+define(CF_ACVERSION_CHECK,
+[
+ifdef([m4_version_compare],
+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
+[CF_ACVERSION_COMPARE(
+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_COMPARE version: 2 updated: 2011/04/14 20:56:50
+dnl --------------------
+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
+dnl                      MAJOR2, MINOR2, TERNARY2,
+dnl                      PRINTABLE2, not FOUND, FOUND)
+define(CF_ACVERSION_COMPARE,
+[ifelse(builtin([eval], [$2 < $5]), 1,
+[ifelse([$8], , ,[$8])],
+[ifelse([$9], , ,[$9])])])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
 dnl -------------
 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
@@ -272,12 +297,33 @@ ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
 }
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
+dnl CF_ANSI_CC_CHECK version: 11 updated: 2011/07/01 19:47:45
 dnl ----------------
-dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
-dnl in the sharutils 4.2 distribution.
+dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and
+dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution.
 AC_DEFUN([CF_ANSI_CC_CHECK],
 [
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+# Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
+# into CC.  This will not help with broken scripts that wrap the compiler with
+# options, but eliminates a more common category of user confusion.
+AC_MSG_CHECKING(\$CC variable)
+case "$CC" in #(vi
+*[[\ \ ]]-[[IUD]]*)
+       AC_MSG_RESULT(broken)
+       AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
+       # humor him...
+       cf_flags=`echo "$CC" | sed -e 's/^[[^   ]]*[[   ]]//'`
+       CC=`echo "$CC" | sed -e 's/[[   ]].*//'`
+       CF_ADD_CFLAGS($cf_flags)
+       ;;
+*)
+       AC_MSG_RESULT(ok)
+       ;;
+esac
+
 AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
 cf_cv_ansi_cc=no
 cf_save_CFLAGS="$CFLAGS"
@@ -533,7 +579,7 @@ CF_NCURSES_VERSION
 CF_CURSES_LIBS
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11
+dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
 dnl ------------------
 dnl Look for the curses headers.
 AC_DEFUN([CF_CURSES_CPPFLAGS],[
@@ -542,13 +588,19 @@ AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
 cf_cv_curses_incdir=no
 case $host_os in #(vi
 hpux10.*) #(vi
-       test -d /usr/include/curses_colr && \
-       cf_cv_curses_incdir="-I/usr/include/curses_colr"
+       if test "x$cf_cv_screen" = "xcurses_colr"
+       then
+               test -d /usr/include/curses_colr && \
+               cf_cv_curses_incdir="-I/usr/include/curses_colr"
+       fi
        ;;
 sunos3*|sunos4*)
-       test -d /usr/5lib && \
-       test -d /usr/5include && \
-       cf_cv_curses_incdir="-I/usr/5include"
+       if test "x$cf_cv_screen" = "xcurses_5lib"
+       then
+               test -d /usr/5lib && \
+               test -d /usr/5include && \
+               cf_cv_curses_incdir="-I/usr/5include"
+       fi
        ;;
 esac
 ])
@@ -558,7 +610,7 @@ CF_CURSES_HEADER
 CF_TERM_HEADER
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_FUNCS version: 15 updated: 2010/10/23 15:52:32
+dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
 dnl ---------------
 dnl Curses-functions are a little complicated, since a lot of them are macros.
 AC_DEFUN([CF_CURSES_FUNCS],
@@ -566,6 +618,7 @@ AC_DEFUN([CF_CURSES_FUNCS],
 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 AC_REQUIRE([CF_XOPEN_CURSES])
 AC_REQUIRE([CF_CURSES_TERM_H])
+AC_REQUIRE([CF_CURSES_UNCTRL_H])
 for cf_func in $1
 do
        CF_UPPER(cf_tr_func,$cf_func)
@@ -578,7 +631,8 @@ do
                        [
 #ifndef ${cf_func}
 long foo = (long)(&${cf_func});
-${cf_cv_main_return:-return}(foo == 0);
+if (foo + 1234 > 5678)
+       ${cf_cv_main_return:-return}(foo);
 #endif
                        ],
                        [cf_result=yes],
@@ -595,7 +649,7 @@ ${cf_cv_main_return:-return}(foo == 0);
 done
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16
+dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
 dnl ----------------
 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 dnl variations of ncurses' installs.
@@ -605,10 +659,10 @@ AC_DEFUN([CF_CURSES_HEADER],[
 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
 cf_cv_ncurses_header=none
 for cf_header in ifelse($1,,,[ \
-    $1/curses.h \
-       $1/ncurses.h]) \
-       curses.h \
-       ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h])
+    $1/ncurses.h \
+       $1/curses.h]) \
+       ncurses.h \
+       curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
 do
 AC_TRY_COMPILE([#include <${cf_header}>],
        [initscr(); tgoto("?", 0,0)],
@@ -624,7 +678,7 @@ fi
 AC_CHECK_HEADERS($cf_cv_ncurses_header)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_LIBS version: 31 updated: 2010/10/23 15:54:49
+dnl CF_CURSES_LIBS version: 35 updated: 2011/08/09 21:06:37
 dnl --------------
 dnl Look for the curses libraries.  Older curses implementations may require
 dnl termcap/termlib to be linked as well.  Call CF_CURSES_CPPFLAGS first.
@@ -644,24 +698,46 @@ freebsd*) #(vi
     AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
     ;;
 hpux10.*) #(vi
-    AC_CHECK_LIB(cur_colr,initscr,[
-        CF_ADD_LIBS(-lcur_colr)
-        ac_cv_func_initscr=yes
-        ],[
-    AC_CHECK_LIB(Hcurses,initscr,[
-        # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
-        CF_ADD_LIBS(-lHcurses)
-        CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
-        ac_cv_func_initscr=yes
-        ])])
+       # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
+       # next (1998), and xcurses "newer" (2000).  There is no header file for
+       # Hcurses; the subdirectory curses_colr has the headers (curses.h and
+       # term.h) for cur_colr
+       if test "x$cf_cv_screen" = "xcurses_colr"
+       then
+               AC_CHECK_LIB(cur_colr,initscr,[
+                       CF_ADD_LIBS(-lcur_colr)
+                       ac_cv_func_initscr=yes
+                       ],[
+               AC_CHECK_LIB(Hcurses,initscr,[
+                       # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
+                       CF_ADD_LIBS(-lHcurses)
+                       CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
+                       ac_cv_func_initscr=yes
+                       ])])
+       fi
     ;;
-linux*) # Suse Linux does not follow /usr/lib convention
-    CF_ADD_LIBDIR(/lib)
+linux*)
+       case `arch 2>/dev/null` in
+       x86_64)
+               if test -d /lib64
+               then
+                       CF_ADD_LIBDIR(/lib64)
+               else
+                       CF_ADD_LIBDIR(/lib)
+               fi
+               ;;
+       *)
+               CF_ADD_LIBDIR(/lib)
+               ;;
+       esac
     ;;
 sunos3*|sunos4*)
-    if test -d /usr/5lib ; then
-      CF_ADD_LIBDIR(/usr/5lib)
-      CF_ADD_LIBS(-lcurses -ltermcap)
+       if test "x$cf_cv_screen" = "xcurses_5lib"
+       then
+               if test -d /usr/5lib ; then
+                       CF_ADD_LIBDIR(/usr/5lib)
+                       CF_ADD_LIBS(-lcurses -ltermcap)
+               fi
     fi
     ac_cv_func_initscr=yes
     ;;
@@ -682,7 +758,7 @@ if test ".$ac_cv_func_initscr" != .yes ; then
     # Check for library containing tgoto.  Do this before curses library
     # because it may be needed to link the test-case for initscr.
     AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
-        for cf_term_lib in $cf_check_list termcap termlib unknown
+        for cf_term_lib in $cf_check_list otermcap termcap termlib unknown
         do
             AC_CHECK_LIB($cf_term_lib,tgoto,[break])
         done
@@ -726,7 +802,7 @@ fi
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_CURSES_TERM_H version: 8 updated: 2010/10/23 15:54:49
+dnl CF_CURSES_TERM_H version: 9 updated: 2011/04/09 18:19:55
 dnl ----------------
 dnl SVr4 curses should have term.h as well (where it puts the definitions of
 dnl the low-level interface).  This may not be true in old/broken implementations,
@@ -740,9 +816,17 @@ AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
 
 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
 # for <term.h> if we do not find the variant.
-for cf_header in \
-       `echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \
-       term.h
+
+cf_header_list="term.h ncurses/term.h ncursesw/term.h"
+
+case ${cf_cv_ncurses_header:-curses.h} in #(vi
+*/*)
+       cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
+       cf_header_list="$cf_header_item $cf_header_list"
+       ;;
+esac
+
+for cf_header in $cf_header_list
 do
        AC_TRY_COMPILE([
 #include <${cf_cv_ncurses_header:-curses.h}>
@@ -788,6 +872,61 @@ ncursesw/term.h)
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_CURSES_UNCTRL_H version: 1 updated: 2011/04/09 18:19:55
+dnl ------------------
+dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
+dnl may put it in a subdirectory (along with ncurses' other headers, of
+dnl course).  Packages which put the headers in inconsistent locations are
+dnl broken).
+AC_DEFUN([CF_CURSES_UNCTRL_H],
+[
+AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
+
+AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
+
+# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
+# for <unctrl.h> if we do not find the variant.
+
+cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
+
+case ${cf_cv_ncurses_header:-curses.h} in #(vi
+*/*)
+       cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
+       cf_header_list="$cf_header_item $cf_header_list"
+       ;;
+esac
+
+for cf_header in $cf_header_list
+do
+       AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <${cf_header}>],
+       [WINDOW *x],
+       [cf_cv_unctrl_header=$cf_header
+        break],
+       [cf_cv_unctrl_header=no])
+done
+
+case $cf_cv_unctrl_header in #(vi
+no)
+       AC_MSG_WARN(unctrl.h header not found)
+       ;;
+esac
+])
+
+case $cf_cv_unctrl_header in #(vi
+unctrl.h) #(vi
+       AC_DEFINE(HAVE_UNCTRL_H)
+       ;;
+ncurses/unctrl.h) #(vi
+       AC_DEFINE(HAVE_NCURSES_UNCTRL_H)
+       ;;
+ncursesw/unctrl.h)
+       AC_DEFINE(HAVE_NCURSESW_UNCTRL_H)
+       ;;
+esac
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59
 dnl ------------------
 dnl Check for likely values of wacs_map[].
@@ -1365,6 +1504,29 @@ rm -rf conftest*
 AC_SUBST(EXTRA_CFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_GETOPT_HEADER version: 4 updated: 2009/08/31 20:07:52
+dnl ----------------
+dnl Check for getopt's variables which are commonly defined in stdlib.h,
+dnl unistd.h or (nonstandard) in getopt.h
+AC_DEFUN([CF_GETOPT_HEADER],
+[
+AC_HAVE_HEADERS(unistd.h getopt.h)
+AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
+cf_cv_getopt_header=none
+for cf_header in stdio.h stdlib.h unistd.h getopt.h
+do
+AC_TRY_COMPILE([
+#include <$cf_header>],
+[int x = optind; char *y = optarg],
+[cf_cv_getopt_header=$cf_header
+ break])
+done
+])
+if test $cf_cv_getopt_header != none ; then
+       AC_DEFINE(HAVE_GETOPT_HEADER)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
 dnl -------------
 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
@@ -2164,7 +2326,7 @@ else
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09
+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
 dnl -------------
 dnl Check for the package-config program, unless disabled by command-line.
 AC_DEFUN([CF_PKG_CONFIG],
@@ -2181,7 +2343,9 @@ no) #(vi
        PKG_CONFIG=none
        ;;
 yes) #(vi
-       AC_PATH_PROG(PKG_CONFIG, pkg-config, none)
+       CF_ACVERSION_CHECK(2.52,
+               [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
+               [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
        ;;
 *)
        PKG_CONFIG=$withval
@@ -2483,6 +2647,59 @@ ncursesw/term.h)
 esac
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
+dnl ---------------
+dnl Define a top_builddir symbol, for applications that need an absolute path.
+AC_DEFUN([CF_TOP_BUILDDIR],
+[
+top_builddir=`pwd`
+AC_SUBST(top_builddir)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_TPUTS_PROTO version: 2 updated: 2011/04/23 19:25:50
+dnl --------------
+dnl Check for type of function-pointer passed to tputs.  Some old
+dnl implementations used functions that had different prototypes, making it
+dnl hard to compile portable programs using tputs.
+AC_DEFUN([CF_TPUTS_PROTO],[
+CF_CURSES_FUNCS(tputs)
+if test x$cf_cv_func_tputs = xyes
+then
+       cf_done=no
+       for cf_arg in int char
+       do
+               for cf_ret in int void
+               do
+                       if test $cf_ret = void
+                       then
+                               cf_return="/* nothing */"
+                       else
+                               cf_return="return value"
+                       fi
+                       AC_TRY_COMPILE([
+#include <${cf_cv_ncurses_header:-curses.h}>
+#include <$cf_cv_term_header>
+
+static $cf_ret outc($cf_arg value) { $cf_return; }
+],[
+       tputs("hello", 0, outc); 
+       ${cf_cv_main_return:-return}(0);
+],[
+               CF_VERBOSE([prototype $cf_ret func($cf_arg value)])
+               cat >>confdefs.h <<EOF
+#define TPUTS_ARG               $cf_arg
+#define TPUTS_PROTO(func,value) $cf_ret func(TPUTS_ARG value)
+#define TPUTS_RETURN(value)     $cf_return
+EOF
+               cf_done=yes
+               break
+])
+               done
+               test $cf_done = yes && break
+       done
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30
 dnl -----------------
 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
@@ -2663,7 +2880,7 @@ CF_NO_LEAKS_OPTION(valgrind,
        [USE_VALGRIND])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_CURSES version: 10 updated: 2010/10/23 15:54:49
+dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
 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.
@@ -2678,7 +2895,7 @@ AC_TRY_LINK([
 #include <stdlib.h>
 #include <${cf_cv_ncurses_header:-curses.h}>],[
 #if defined(NCURSES_VERSION_PATCH)
-if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
+#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
        make an error
 #endif
 #endif
@@ -2702,7 +2919,7 @@ if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
+dnl CF_XOPEN_SOURCE version: 37 updated: 2011/08/06 20:32:05
 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,
@@ -2718,9 +2935,12 @@ cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
 cf_xopen_source=
 
 case $host_os in #(vi
-aix[[456]]*) #(vi
+aix[[4-7]]*) #(vi
        cf_xopen_source="-D_ALL_SOURCE"
        ;;
+cygwin) #(vi
+       cf_XOPEN_SOURCE=600
+       ;;
 darwin[[0-8]].*) #(vi
        cf_xopen_source="-D_APPLE_C_SOURCE"
        ;;
@@ -2751,7 +2971,7 @@ 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
+       cf_xopen_source="-D_NETBSD_SOURCE" # 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
@@ -2942,7 +3162,7 @@ elif test "$cf_x_athena_inc" != default ; then
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_X_ATHENA_LIBS version: 9 updated: 2010/06/02 05:03:05
+dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02
 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.
@@ -2958,31 +3178,42 @@ for cf_path in default \
        /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"
+               ${cf_x_athena_root} \
+               ${cf_x_athena_root}7 \
+               ${cf_x_athena_root}6
+       do
+       for cf_libs in \
+               "-l$cf_lib -lXmu" \
+               "-l$cf_lib -lXpm -lXmu" \
+               "-l${cf_lib}_s -lXmu_s"
        do
                if test -z "$cf_x_athena_lib" ; then
                        cf_save="$LIBS"
                        cf_test=XawSimpleMenuAddGlobalActions
                        if test $cf_path != default ; then
-                               CF_ADD_LIBS(-L$cf_path/lib $cf_lib)
-                               AC_MSG_CHECKING(for $cf_lib in $cf_path)
+                               CF_ADD_LIBS(-L$cf_path/lib $cf_libs)
+                               AC_MSG_CHECKING(for $cf_libs in $cf_path)
                        else
-                               CF_ADD_LIBS($cf_lib)
-                               AC_MSG_CHECKING(for $cf_test in $cf_lib)
+                               CF_ADD_LIBS($cf_libs)
+                               AC_MSG_CHECKING(for $cf_test in $cf_libs)
                        fi
-                       AC_TRY_LINK([],[$cf_test()],
+                       AC_TRY_LINK([
+#include <X11/Intrinsic.h>
+#include <X11/$cf_x_athena_root/SimpleMenu.h>
+],[
+$cf_test((XtAppContext) 0)],
                                [cf_result=yes],
                                [cf_result=no])
                        AC_MSG_RESULT($cf_result)
                        if test "$cf_result" = yes ; then
-                               cf_x_athena_lib="$cf_lib"
+                               cf_x_athena_lib="$cf_libs"
                                break
                        fi
                        LIBS="$cf_save"
                fi
-       done
+       done # cf_libs
+               test -n "$cf_x_athena_lib" && break
+       done # cf_lib
 done
 
 if test -z "$cf_x_athena_lib" ; then