Revert "Fix the fix, make pi a normal lisp var (Closes bug #176)"
[sxemacs] / configure.ac
index dfb737b..cdf5e68 100644 (file)
@@ -1740,10 +1740,30 @@ fi
 after_morecore_hook_exists=yes
 AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
 AC_MSG_CHECKING(whether __after_morecore_hook exists)
-AC_LINK_IFELSE([AC_LANG_SOURCE([[extern void (* __after_morecore_hook)();],[__after_morecore_hook = 0]])],
+AC_LINK_IFELSE([AC_LANG_SOURCE([
+       [extern void (* __after_morecore_hook)();]
+       [main() {__after_morecore_hook = 0;}]
+       ])],
   [AC_MSG_RESULT(yes)],
   [AC_MSG_RESULT(no)
    after_morecore_hook_exists=no])
+if test "$after_morecore_hook_exists" = "yes" ; then
+   AC_DEFINE([HAVE_MORECORE_HOOK], [1], [Define if __after_morecore_hook is available])
+fi
+AC_SUBST(HAVE_MORECORE_HOOK)
+free_hook_exists=yes
+AC_MSG_CHECKING(whether __free_hook exists)
+AC_LINK_IFELSE([AC_LANG_SOURCE([
+       [extern void (* __free_hook)();]
+       [main() {__free_hook = 0;}]
+       ])],
+  [AC_MSG_RESULT(yes)],
+  [AC_MSG_RESULT(no)
+   free_hook_exists=no])
+if test "$free_hook_exists" = "yes" ; then
+   AC_DEFINE([HAVE_FREE_HOOK], [1], [Define if __free_hook is available])
+fi
+AC_SUBST(HAVE_FREE_HOOK)
 if test "$system_malloc" = "yes" ; then
   GNU_MALLOC=no
   GNU_MALLOC_reason="
@@ -2504,7 +2524,7 @@ dnl   fi
 
        dnl make sure we can find Intrinsic.h
        AC_CHECK_HEADER([X11/Intrinsic.h], [],
-               [AC_MSG_ERROR([Unable to find X11 header files. Try using --x-includes=<path> if you know the path, or --with-x=no to disable X11 support.])])
+               [AC_MSG_ERROR([Unable to find X11 and/or Xt header files. Try using --x-includes=<path> if you know the path, or --with-x=no to disable X11 support.])])
 
        dnl Check some more headers
        AC_CHECK_HEADERS([X11/Intrinsic.h X11/StringDefs.h X11/Shell.h X11/ShellP.h],
@@ -2932,24 +2952,140 @@ AS_IF([test "$with_tty" != "no"],[
    if test -n "$curses_h_file"; then
        AC_DEFINE_UNQUOTED([HAVE_CURSES_H], [1],
                           [There is a curses.h header file available])
+       AC_DEFINE_UNQUOTED([CURSES_H_FILE], ["${curses_h_file}"],
+                          [The curses.h header file])
    fi
 
    if test -n "$termcap_h_file"; then
        AC_DEFINE_UNQUOTED([HAVE_TERMCAP_H], [1],
                           [There is a termcap.h header available])
+       AC_DEFINE_UNQUOTED([TERMCAP_H_FILE], ["${termcap_h_file}"],
+                          [The termcap.h header file])
    fi
 
    if test -n "$term_h_file"; then
        AC_DEFINE_UNQUOTED([HAVE_TERM_H], [1],
                           [There is a term.h header available])
+       AC_DEFINE_UNQUOTED([TERM_H_FILE], ["${term_h_file}"],
+                          [The term.h header file])
    fi
 
-   AC_DEFINE_UNQUOTED([CURSES_H_FILE], ["${curses_h_file-curses.h}"],
-                      [The curses.h header file])
-   AC_DEFINE_UNQUOTED([TERMCAP_H_FILE], ["${termcap_h_file-termcap.h}"],
-                      [The termcap.h header file])
-   AC_DEFINE_UNQUOTED([TERM_H_FILE], ["${term_h_file-term.h}"],
-                      [The term.h header file])
+   # Finally let's see if we have prototype for the elusive tparm
+   AC_MSG_CHECKING(for tparm prototype)
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef TERM_H_FILE
+#include TERM_H_FILE
+#endif
+#ifdef TERMCAP_H_FILE
+#include TERMCAP_H_FILE
+#endif
+#ifdef CURSES_H_FILE
+#include CURSES_H_FILE
+#endif
+/* Completely incompatible prototype with all tparm ones
+   if files above define it, compilation should fail
+*/
+extern void tparm(void);
+       ]], [[ tparm(); ]])],
+       [AC_MSG_RESULT(no)],
+       [AC_MSG_RESULT(yes)
+         AC_DEFINE_UNQUOTED([HAVE_TPARM_PROTOTYPE], [1],
+                           [tparm has a prototype defined])])
+
+   # Finally let's see if we have prototype for tgetent
+   AC_MSG_CHECKING(for tgetent prototype)
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef TERM_H_FILE
+#include TERM_H_FILE
+#endif
+#ifdef TERMCAP_H_FILE
+#include TERMCAP_H_FILE
+#endif
+#ifdef CURSES_H_FILE
+#include CURSES_H_FILE
+#endif
+extern void tgetent(void);
+       ]], [[ tgetent(); ]])],
+       [AC_MSG_RESULT(no)],
+       [AC_MSG_RESULT(yes)
+         AC_DEFINE_UNQUOTED([HAVE_TGETENT_PROTOTYPE], [1],
+                           [tgetent has a prototype defined])])
+
+
+   # Finally let's see if we have prototype for tgetflag
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef TERM_H_FILE
+#include TERM_H_FILE
+#endif
+#ifdef TERMCAP_H_FILE
+#include TERMCAP_H_FILE
+#endif
+#ifdef CURSES_H_FILE
+#include CURSES_H_FILE
+#endif
+extern void tgetflag(void);
+       ]], [[ tgetflag(); ]])],
+       [AC_MSG_RESULT(no)],
+       [AC_MSG_RESULT(yes)
+         AC_DEFINE_UNQUOTED([HAVE_TGETFLAG_PROTOTYPE], [1],
+                                [tgetflag has a prototype defined])])
+
+   # Finally let's see if we have prototype for tgetnum
+   AC_MSG_CHECKING(for tgetnum prototype)
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef TERM_H_FILE
+#include TERM_H_FILE
+#endif
+#ifdef TERMCAP_H_FILE
+#include TERMCAP_H_FILE
+#endif
+#ifdef CURSES_H_FILE
+#include CURSES_H_FILE
+#endif
+extern void tgetnum(void);
+       ]], [[ tgetnum(); ]])],
+       [AC_MSG_RESULT(no)],
+       [AC_MSG_RESULT(yes)
+        AC_DEFINE_UNQUOTED([HAVE_TGETNUM_PROTOTYPE], [1],
+                           [tgetnum has a prototype defined])])
+
+   # Finally let's see if we have prototype for tgetnum
+   AC_MSG_CHECKING(for tgetstr prototype)
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef TERM_H_FILE
+#include TERM_H_FILE
+#endif
+#ifdef TERMCAP_H_FILE
+#include TERMCAP_H_FILE
+#endif
+#ifdef CURSES_H_FILE
+#include CURSES_H_FILE
+#endif
+extern void tgetstr(void);
+       ]], [[ tgetstr(); ]])],
+       [AC_MSG_RESULT(no)],
+        [AC_MSG_RESULT(yes)
+        AC_DEFINE_UNQUOTED([HAVE_TGETSTR_PROTOTYPE], [1],
+                           [tgetstr has a prototype defined])])
+
+   # Finally let's see if we have prototype for tgetnum
+   AC_MSG_CHECKING(for tputs prototype)
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef TERM_H_FILE
+#include TERM_H_FILE
+#endif
+#ifdef TERMCAP_H_FILE
+#include TERMCAP_H_FILE
+#endif
+#ifdef CURSES_H_FILE
+#include CURSES_H_FILE
+#endif
+extern void tputs(void);
+       ]], [[ tputs(); ]])],
+       [AC_MSG_RESULT(no)],
+       [AC_MSG_RESULT(yes)
+         AC_DEFINE_UNQUOTED([HAVE_TPUTS_PROTOTYPE], [1],
+                           [tputs has a prototype defined])])
 ],[
   for feature in ncurses curses termcap terminfo termlib gpm; do
     if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then