From 24e415ca06fc4af9dd41c09dc0110a96b7bc0dc1 Mon Sep 17 00:00:00 2001 From: Mark Hessling Date: Tue, 16 Oct 2001 11:14:03 +0000 Subject: [PATCH] Handle platforms where X11 headers do not typedef XPointer. --- aclocal.m4 | 24 ++++++++++++++++++++++++ config.h.in | 2 ++ configure | 50 +++++++++++++++++++++++++++++++++++++++++++------- configure.in | 1 + x11/pdcx11.h | 4 ++++ 5 files changed, 74 insertions(+), 7 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 36283871..a9407a6a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -401,3 +401,27 @@ else AC_MSG_RESULT($mh_cv_max_signals) fi ])dnl + +dnl --------------------------------------------------------------------------- +dnl Determine if supplied types have been typedefed +dnl --------------------------------------------------------------------------- +AC_DEFUN([MH_CHECK_X_TYPEDEF], +[ +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $SYS_DEFS $MH_XINC_DIR" +for td in $1 ; do +AC_MSG_CHECKING(if $td is typedefed:) +AC_TRY_COMPILE( +[#include "X11/Xlib.h"], +[$td fred], + [mh_td=yes], + [mh_td=no] +) +if test "$mh_td" = yes ; then + TD_upper=`echo $td | tr a-z A-Z` + AC_DEFINE_UNQUOTED(${TD_upper}_TYPEDEFED, 1) +fi +AC_MSG_RESULT($mh_td) +done +CPPFLAGS="$save_CPPFLAGS" +])dnl diff --git a/config.h.in b/config.h.in index 9656c518..75b98a92 100644 --- a/config.h.in +++ b/config.h.in @@ -131,3 +131,5 @@ /* Define if you want to build XCurses with processes */ #undef USE_PROCESSES +/* Define XPointer is typedefed in X11/Xlib.h */ +#undef XPOINTER_TYPEDEFED diff --git a/configure b/configure index 56028a3a..2d2868b1 100755 --- a/configure +++ b/configure @@ -2342,6 +2342,42 @@ done CPPFLAGS="$save_CPPFLAGS" +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $SYS_DEFS $MH_XINC_DIR" +for td in XPointer ; do +echo $ac_n "checking if $td is typedefed:""... $ac_c" 1>&6 +echo "configure:2350: checking if $td is typedefed:" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + mh_td=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + mh_td=no + +fi +rm -f conftest* +if test "$mh_td" = yes ; then + TD_upper=`echo $td | tr a-z A-Z` + cat >> confdefs.h <&6 +done +CPPFLAGS="$save_CPPFLAGS" + + # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" @@ -2502,10 +2538,10 @@ esac if test "$DYN_COMP" = ""; then echo $ac_n "checking compiler flags for a dynamic object""... $ac_c" 1>&6 -echo "configure:2506: checking compiler flags for a dynamic object" >&5 +echo "configure:2542: checking compiler flags for a dynamic object" >&5 cat > conftest.$ac_ext <&5; (eval $mh_compile) 2>&5; }; then + if { (eval echo configure:2557: \"$mh_compile\") 1>&5; (eval $mh_compile) 2>&5; }; then DYN_COMP="" else slash="\\" @@ -2634,21 +2670,21 @@ case "$target" in mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&5' cat > conftest.$ac_ext <&5; (eval $mh_compile) 2>&5; } && test -s conftest.o; then +if { (eval echo configure:2680: \"$mh_compile\") 1>&5; (eval $mh_compile) 2>&5; } && test -s conftest.o; then mh_dyn_link='ld -shared -o conftest.rxlib conftest.o -lc 1>&5' - if { (eval echo configure:2646: \"$mh_dyn_link\") 1>&5; (eval $mh_dyn_link) 2>&5; } && test -s conftest.rxlib; then + if { (eval echo configure:2682: \"$mh_dyn_link\") 1>&5; (eval $mh_dyn_link) 2>&5; } && test -s conftest.rxlib; then LD_RXLIB1="ld -shared" RXLIBPRE="lib" RXLIBPST=".so" else mh_dyn_link='ld -G -o conftest.rxlib conftest.o 1>&5' - if { (eval echo configure:2652: \"$mh_dyn_link\") 1>&5; (eval $mh_dyn_link) 2>&5; } && test -s conftest.rxlib; then + if { (eval echo configure:2688: \"$mh_dyn_link\") 1>&5; (eval $mh_dyn_link) 2>&5; } && test -s conftest.rxlib; then LD_RXLIB1="ld -G" RXLIBPRE="lib" RXLIBPST=".so" diff --git a/configure.in b/configure.in index c7305204..4b7e7224 100755 --- a/configure.in +++ b/configure.in @@ -102,6 +102,7 @@ MH_CHECK_X_LIB MH_CHECK_X_HEADERS(DECkeysym.h Sunkeysym.h) MH_CHECK_X_KEYDEFS(XK_KP_Delete XK_KP_Insert XK_KP_End XK_KP_Down XK_KP_Next \ XK_KP_Left XK_KP_Right XK_KP_Home XK_KP_Up XK_KP_Prior XK_KP_Begin) +MH_CHECK_X_TYPEDEF(XPointer) dnl --------------- allow --enable-debug to compile in debug mode -------- AC_ARG_ENABLE(debug, diff --git a/x11/pdcx11.h b/x11/pdcx11.h index 8f20233e..f385eaad 100644 --- a/x11/pdcx11.h +++ b/x11/pdcx11.h @@ -51,6 +51,10 @@ # include #endif +#if !defined(XPOINTER_TYPEDEFED) + typedef char * XPointer; +#endif + /* * #includes specific to running XCurses with threads */