Hi folks,

I didn't like my original patch (even though it works) and I have cleaned
it up to touch one less file and clean up the macro names and the config.h
#defines.

Here it is. Please unapply the previous and apply this one instead.

                        ---Kayvan
-- 
Kayvan A. Sylvan                   | Proud husband of      | Father to my kids:
Sylvan Associates, Inc.            | Laura Isabella Sylvan | Katherine Yelena
http://www.successlinks.com/kayvan | Reach your goals now! | Robin Gregory
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/ChangeLog,v
retrieving revision 1.699
diff -u -r1.699 ChangeLog
--- ChangeLog   2000/11/22 18:46:53     1.699
+++ ChangeLog   2000/11/26 15:15:12
@@ -1,3 +1,10 @@
+2000-11-24  Kayvan A. Sylvan <[EMAIL PROTECTED]>
+
+       * acconfig.h, configure.in, config/libtool.m4: Added autoconf tests
+       to check for systems where mkstemp() is available but not declared
+       in headers. The new autoconf macro lyx_CHECK_DECL can be used
+       to check for declarations in headers.
+
 2000-11-22  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
        * src/version.h: try the pre2 again
Index: acconfig.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/acconfig.h,v
retrieving revision 1.15
diff -u -r1.15 acconfig.h
--- acconfig.h  2000/09/27 15:43:49     1.15
+++ acconfig.h  2000/11/26 15:15:12
@@ -44,6 +44,9 @@
 
 #undef USE_PSPELL
 
+/* Define as 1 if the MKSTEMP function is declared */
+#undef HAVE_DECL_MKSTEMP
+
 @BOTTOM@ 
 
 /************************************************************ 
@@ -66,6 +69,15 @@
 
 #ifdef BROKEN_HEADERS
 #include "broken_headers.h"
+#endif
+
+#ifdef HAVE_MKSTEMP
+#ifndef HAVE_DECL_MKSTEMP
+#if defined (__cplusplus)
+extern "C"
+#endif
+int mkstemp(char*);
+#endif
 #endif
 
 /* C++ always support the keyword `inline' */
Index: configure.in
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/configure.in,v
retrieving revision 1.54
diff -u -r1.54 configure.in
--- configure.in        2000/11/22 15:51:34     1.54
+++ configure.in        2000/11/26 15:15:13
@@ -264,6 +264,9 @@
 # SunOS 4.1.3 does not have strerror and atexit
 AC_REPLACE_FUNCS(strerror atexit)
 
+# Check for mkstemp declaration
+LYX_CHECK_DECL_HDRS(mkstemp, unistd.h stdlib.h, HAVE_DECL_MKSTEMP)
+
 ### and now some special lyx flags.
 AC_ARG_ENABLE(assertions,
   [  --enable-assertions     add runtime sanity checks in the program],,
Index: config/libtool.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/libtool.m4,v
retrieving revision 1.1
diff -u -r1.1 libtool.m4
--- config/libtool.m4   2000/01/08 21:06:59     1.1
+++ config/libtool.m4   2000/11/26 15:15:14
@@ -428,3 +428,28 @@
 
 dnl This is just to silence aclocal about the macro not being used
 ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+dnl Check things are declared in headers to avoid errors or warnings.
+dnl Called like LYX_CHECK_DECL(function, headerfile, CONFIG_DEFINE)
+dnl Defines CONFIG_DEFINE if function is declared in headerfile
+AC_DEFUN(LYX_CHECK_DECL,
+[AC_MSG_CHECKING($1 is declared by header $2)]
+[AC_EGREP_HEADER($1, $2, [lyx_cv_declare_$1=yes],[lyx_cv_declare_$1=no])]
+if test "${lyx_cv_declare_$1}" = "yes"; then
+        AC_DEFINE($3)
+        AC_MSG_RESULT(yes)
+else
+        AC_MSG_RESULT(no)
+fi)
+
+dnl This is the multiple headers version of the LYX_CHECK_DECL macro above.
+dnl Called like LYX_CHECK_DECL_HDRS(function, file1 file2 file3, CONFIG_DEFINE)
+AC_DEFUN(LYX_CHECK_DECL_HDRS,
+[got="no"
+for I in $2; do
+if test "${got}" = "no"; then
+     LYX_CHECK_DECL($1, $I, $3)
+fi
+if test ${lyx_cv_declare_$1} = "yes"; then
+     got="yes"
+fi; done])

Reply via email to