dnl --------------------------------------------------------------------------- dnl Determine if the system has System V IPC. ie sys/ipc.h and sys/shm.h dnl headers. dnl --------------------------------------------------------------------------- AC_DEFUN([MH_IPC], [ AC_MSG_CHECKING(for System V IPC support) AC_CHECK_HEADER(sys/ipc.h) if test $ac_cv_header_sys_ipc_h = no; then AC_MSG_ERROR(Cannot find required header file sys/ipc.h; XCurses cannot be configured) fi ])dnl dnl --------------------------------------------------------------------------- dnl Set up the correct X header file location dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_INC], [ AC_MSG_CHECKING(for location of X headers) mh_x11_dir="" dnl dnl specify latest release of X directories first dnl mh_inc_dirs="\ $HOME/include/X11 \ $HOME/include \ /tmp/include/X11 \ /tmp/include \ /usr/X11R6/include \ /usr/include/X11R6 \ /usr/local/X11R6/include \ /usr/local/include/X11R6 \ /usr/X11R5/include \ /usr/include/X11R5 \ /usr/local/X11R5/include \ /usr/local/include/X11R5 \ /usr/local/x11r5/include \ /usr/X11R4/include \ /usr/include/X11R4 \ /usr/local/X11R4/include \ /usr/local/include/X11R4 \ \ /usr/X11/include \ /usr/include/X11 \ /usr/local/X11/include \ /usr/local/include/X11 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include" dnl dnl Provide for user supplying directory dnl if test "x$x_includes" != xNONE ; then mh_inc_dirs="$x_includes $mh_inc_dirs" fi dnl dnl Try to determine the directory containing X headers dnl We will append X11 to all the paths above as an extra check dnl for ac_dir in $mh_inc_dirs ; do if test -r $ac_dir/Intrinsic.h; then mh_x11_dir=$ac_dir break fi if test -r $ac_dir/X11/Intrinsic.h; then mh_x11_dir="$ac_dir/X11" break fi done if test "x$mh_x11_dir" != "x" ; then mh_x11_dir_no_x11=`echo $mh_x11_dir | sed 's/\/X11$//'` if test "$mh_x11_dir_no_x11" != "$mh_x11_dir" ; then MH_XINC_DIR="-I$mh_x11_dir -I$mh_x11_dir_no_x11" else MH_XINC_DIR="-I$mh_x11_dir" fi AC_MSG_RESULT(found in $mh_x11_dir) AC_SUBST(MH_XINC_DIR) else AC_MSG_ERROR(Cannot find required header file Intrinsic.h; XCurses cannot be configured) fi ])dnl dnl --------------------------------------------------------------------------- dnl Set up the correct X library file location dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_LIB], [ dnl dnl Some systems require extra libraries... dnl mh_solaris_flag=no mh_hpux9_flag=no AC_REQUIRE([AC_CANONICAL_SYSTEM]) case "$target" in *solaris*) mh_solaris_flag=yes ;; *pc-sco*) extra_x_libs="Xext" ;; sparc*sunos*) extra_x_libs="Xext" if test "$ac_cv_prog_CC" = "gcc" ; then extra_ld_flags="-Wl,-Bstatic" extra_ld_flags2="-Wl,-Bdynamic" else extra_ld_flags="-Bstatic" extra_ld_flags2="-Bdynamic" fi ;; *hpux9*) mh_hpux9_flag=yes ;; esac AC_MSG_CHECKING(for location of X libraries) if test "$with_xaw3d" = yes; then MH_X11_LIBS="Xaw3d Xmu Xt X11" else MH_X11_LIBS="Xaw Xmu Xt X11" fi MH_X11R6_LIBS="SM ICE Xext" mh_x11r6=no dnl dnl specify latest release of X directories first dnl mh_lib_dirs="\ $HOME/lib \ /tmp/lib \ /usr/X11R6/lib \ /usr/lib/X11R6 \ /usr/local/X11R6/lib \ /usr/local/lib/X11R6 \ /usr/X11R5/lib \ /usr/lib/X11R5 \ /usr/local/X11R5/lib \ /usr/local/lib/X11R5 \ /usr/local/x11r5/lib \ /usr/X11R4/lib \ /usr/lib/X11R4 \ /usr/local/X11R4/lib \ /usr/local/lib/X11R4 \ \ /usr/X11/lib \ /usr/lib/X11 \ /usr/local/X11/lib \ /usr/local/lib/X11 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/lpp/Xamples/lib \ \ /usr/openwin/lib \ /usr/openwin/share/lib" dnl dnl Provide for user supplying directory dnl if test "x$x_libraries" != xNONE ; then mh_lib_dirs="$x_libraries $mh_lib_dirs" fi dnl dnl try to find libSM.[a,sl,so]. If we find it we are using X11R6 dnl for ac_dir in $mh_lib_dirs ; do for mh_xsm in libSM.a libSM.so libSM.sl; do if test -r $ac_dir/$mh_xsm; then mh_x11r6=yes break 2 fi done done if test "$mh_x11r6" = yes ; then mh_libs="$MH_X11_LIBS $MH_X11R6_LIBS" else mh_libs="$MH_X11_LIBS $extra_x_libs" fi dnl dnl Ensure that all required X libraries are found dnl mh_prev_dir="" mh_where_found="" mh_where_found_dirs="" mh_solaris_path="" for mh_lib in $mh_libs; do mh_lib_found=no for ac_dir in $mh_lib_dirs ; do for mh_ext in a so sl; do if test -r $ac_dir/lib$mh_lib.$mh_ext; then if test "x$mh_prev_dir" != "x$ac_dir" ; then if test "x$mh_prev_dir" = "x" ; then mh_where_found="$mh_where_found found in $ac_dir" else mh_where_found="$mh_where_found and in $ac_dir" fi mh_prev_dir=$ac_dir mh_where_found_dirs="$mh_where_found_dirs $ac_dir" MH_XLIBS="$MH_XLIBS -L$ac_dir" mh_solaris_path="${mh_solaris_path}:$ac_dir" fi MH_XLIBS="$MH_XLIBS -l$mh_lib" mh_lib_found=yes break 2 fi done done if test "$mh_lib_found" = no; then AC_MSG_ERROR(Cannot find required X library; lib$mh_lib. XCurses cannot be configured) fi done AC_MSG_RESULT($mh_where_found) mh_solaris_path=`echo $mh_solaris_path | sed 's/^://'` if test "$mh_solaris_flag" = yes ; then MH_XLIBS="-R$mh_solaris_path $extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" else MH_XLIBS="$extra_ld_flags $MH_XLIBS $extra_libs $extra_ld_flags2" fi if test "$mh_hpux9_flag" = yes ; then grep -q XtSetLanguageProc $mh_x11_dir/Intrinsic.h if test $? -eq 0 ; then mh_found_xtshellstrings=no for mh_acdir in $mh_where_found_dirs ; do for mh_xaw in `ls $mh_acdir/libXaw.*` ; do nm $mh_xaw | grep XtShellStrings | grep -qv extern if test $? -eq 0 ; then mh_found_xtshellstrings=yes fi done done if test "$mh_found_xtshellstrings" = no ; then AC_MSG_WARN(The X11 development environment has not been installed correctly.) AC_MSG_WARN(The header file; Intrinsic.h, is for X11R5 while the Athena Widget) AC_MSG_WARN(Set library; libXaw is for X11R4. This is a common problem with) AC_MSG_WARN(HP-UX 9.x.) AC_MSG_WARN(A set of required X11R5 library files can be obtained from the) AC_MSG_WARN(anonymous ftp sites listed on the PDCurses WWW home page:) AC_MSG_WARN(http://www.lightlink.com/hessling/) AC_MSG_WARN(The file is called HPUX-9.x-libXaw-libXmu.tar.Z) AC_MSG_ERROR(X11 installation incomplete; cannot continue) fi fi fi AC_SUBST(MH_XLIBS) ])dnl dnl --------------------------------------------------------------------------- dnl Determine if C compiler handles ANSI prototypes dnl --------------------------------------------------------------------------- AC_DEFUN([MH_HAVE_PROTO], [ AC_MSG_CHECKING(if compiler supports ANSI prototypes) dnl dnl override existing value of $ac_compile so we use the correct compiler dnl SHOULD NOT NEED THIS dnl ac_compile='$ac_cv_prog_CC conftest.$ac_ext $CFLAGS $CPPFLAGS -c 1>&5 2>&5' AC_TRY_COMPILE([#include ], [extern int xxx(int, char *);], mh_have_proto=yes; AC_DEFINE(HAVE_PROTO), mh_have_proto=no ) AC_MSG_RESULT($mh_have_proto) ])dnl dnl --------------------------------------------------------------------------- dnl Determine the best C compiler to use given a list dnl --------------------------------------------------------------------------- AC_DEFUN([MH_PROG_CC], [ mh_sysv_incdir="" mh_sysv_libdir="" all_words="$CC_LIST" ac_dir="" AC_MSG_CHECKING(for one of the following C compilers: $all_words) AC_CACHE_VAL(ac_cv_prog_CC,[ if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for mh_cc in $all_words; do for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$mh_cc; then ac_cv_prog_CC="$mh_cc" if test "$ac_dir" = "/usr/5bin"; then mh_sysv_incdir="/usr/5include" mh_sysv_libdir="/usr/5lib" fi break 2 fi done done IFS="$ac_save_ifs" test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" fi CC="$ac_cv_prog_CC" ]) AC_SUBST(CC) if test "$ac_dir" = ""; then AC_MSG_RESULT(using $ac_cv_prog_CC specified in CC env variable) else AC_MSG_RESULT(using $ac_dir/$ac_cv_prog_CC) fi ])dnl dnl --------------------------------------------------------------------------- dnl Determine if the supplied X headers exist. dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_HEADERS], [ save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" for mh_header in $1; do AC_CHECK_HEADERS($mh_header) done CPPFLAGS="$save_CPPFLAGS" ])dnl dnl --------------------------------------------------------------------------- dnl Determine if various key definitions exist in keysym.h dnl --------------------------------------------------------------------------- AC_DEFUN([MH_CHECK_X_KEYDEFS], [ save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" for mh_keydef in $1; do AC_MSG_CHECKING(for $mh_keydef in keysym.h) mh_upper_name="HAVE_`echo $mh_keydef | tr '[a-z]' '[A-Z]'`" AC_TRY_COMPILE([#include ], [int i = $mh_keydef;], mh_have_key=yes; AC_DEFINE_UNQUOTED($mh_upper_name,1), mh_have_key=no ) AC_MSG_RESULT($mh_have_key) done CPPFLAGS="$save_CPPFLAGS" ])dnl dnl --------------------------------------------------------------------------- dnl Provide our own AC_TRY_LINK dnl --------------------------------------------------------------------------- AC_DEFUN([MH_TRY_LINK], [ mh_link='${LD-ld} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" for mh_keydef in $1; do AC_MSG_CHECKING(for $mh_keydef in keysym.h) mh_upper_name="HAVE_`echo $mh_keydef | tr '[a-z]' '[A-Z]'`" AC_TRY_COMPILE([#include ], [int i = $mh_keydef;], mh_have_key=yes; AC_DEFINE_UNQUOTED($mh_upper_name,1), mh_have_key=no ) AC_MSG_RESULT($mh_have_key) done CPPFLAGS="$save_CPPFLAGS" ])dnl