fix LYX_CHECK_DECL in autoconf 2.5x

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5712 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2002-11-25 16:02:21 +00:00
parent c9e33c37e6
commit 7a172cb177
8 changed files with 124 additions and 85 deletions

View File

@ -1,3 +1,7 @@
2002-11-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* autogen.sh: add support for EXTRA_ACINCLUDE_FILES.
2001-09-08 Rob Lahaye <lahaye@snu.ac.kr>
* autogen.sh: set autotool commands at top of the file;

View File

@ -1,9 +1,10 @@
#!/bin/sh
ACLOCAL=aclocal
ACLOCAL="aclocal"
AUTOHEADER="autoheader"
AUTOMAKE="automake -a -c --foreign"
AUTOCONF="autoconf"
ACINCLUDE_FILES="lyxinclude.m4 libtool.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 xforms.m4 qt.m4 gtk--.m4 gnome--.m4 gnome.m4 pspell.m4 pkg.m4"
# Discover what version of autoconf we are using.
autoversion=`$AUTOCONF --version | head -n 1`
@ -16,6 +17,7 @@ case $autoversion in
rm -f configure.ac
cp config/relyx_configure.in lib/reLyX/configure.in
rm -f lib/reLyX/configure.ac
EXTRA_ACINCLUDE_FILES="lyxinclude213.m4"
;;
*2.5[23])
rm -f acconfig.h
@ -23,18 +25,15 @@ case $autoversion in
cp config/configure.ac .
rm -f lib/reLyX/configure.in
cp config/relyx_configure.ac lib/reLyX/configure.ac
EXTRA_ACINCLUDE_FILES="lyxinclude25x.m4"
;;
*)
echo "This autoconf version is not supported by LyX."
echo "LyX only supports autoconf 2.13 and 2.53."
echo "LyX only supports autoconf 2.13 and 2.5[23]."
exit
;;
esac
ACINCLUDE_FILES="lyxinclude.m4 libtool.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 xforms.m4 qt.m4 gtk--.m4 gnome--.m4 gnome.m4 pspell.m4 pkg.m4"
SIGCPP_ACINCLUDE_FILES="libtool.m4"
echo -n "Locating GNU m4... "
GNUM4=
for prog in $M4 gm4 gnum4 m4; do
@ -58,7 +57,7 @@ fi
# Generate acinclude.m4
echo -n "Generate acinclude.m4... "
rm -f acinclude.m4
(cd config ; cat ${ACINCLUDE_FILES} >../acinclude.m4)
(cd config ; cat ${ACINCLUDE_FILES} ${EXTRA_ACINCLUDE_FILES} >../acinclude.m4)
echo "done."
# Generate the Makefiles and configure files

View File

@ -1,3 +1,20 @@
2002-11-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* Makefile.am (EXTRA_DIST): add lyxinclude25x.m4 and
lyxinclude213.m4
* lyxinclude25x.m4: new file, containing macros specific to
autoconf 2.5x (LYX_CHECK_DECL and LYX_CHECK_DECL_HDRS for now)
* lyxincludes213.m4: new file, containing macros specific to
autoconf 2.13 (LYX_CHECK_DECL and LYX_CHECK_DECL_HDRS for now)
(LYX_FUNC_SELECT_ARGTYPES): move here
* lyxinclude.m4 (LYX_FUNC_SELECT_ARGTYPES): remove
* configure.ac: use AC_FUNC_SELECT_ARGTYPES (because it works in
2.5x)
2002-11-24 Lars Gullik Bjønnes <larsbj@gullik.net>
* configure.ac: USE_BOOST_FORMAT

View File

@ -1,5 +1,6 @@
include $(top_srcdir)/config/common.am
EXTRA_DIST = common.am codeset.m4 lyxinclude.m4 libtool.m4 gettext.m4 \
EXTRA_DIST = common.am codeset.m4 libtool.m4 gettext.m4 \
lyxinclude.m4 lyxinclude25x.m4 lyxinclude213.m4 \
glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4 \
qt.m4 gtk--.m4 gnome--.m4 gnome.m4 xforms.m4 pspell.m4

View File

@ -251,6 +251,7 @@ AC_CHECK_FUNCS(snprintf vsnprintf)
LYX_CHECK_DECL(snprintf, stdio.h)
LYX_CHECK_DECL(vsnprintf, stdio.h)
LYX_CHECK_DECL(istreambuf_iterator, iterator)
LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
dnl This is a slight hack: the tests generated by autoconf 2.52 do not
dnl work correctly because of some conflict with stdlib.h with g++ 2.96
@ -261,14 +262,12 @@ AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo mkstemp mktemp)
AC_LANG_POP(C)
dnl Until this is fixed in autoconf we provide our own version
LYX_FUNC_SELECT_ARGTYPES
AC_FUNC_SELECT_ARGTYPES
dnl check whether we have to work around solaris broken putenv()
LYX_FUNC_PUTENV_ARGTYPE
LYX_CHECK_DECL_HDRS(mkstemp,[unistd.h stdlib.h])
### Some information on what just happened
real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
real_datadir=`eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`

View File

@ -650,49 +650,6 @@ rm -f conftest*])
])
### end of LYX_PATH_HEADER
dnl We use this until autoconf fixes its version.
AC_DEFUN(LYX_FUNC_SELECT_ARGTYPES,
[AC_MSG_CHECKING([types of arguments for select()])
AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
[AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
[AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
[for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
AC_TRY_COMPILE(dnl
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
extern int select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
[ac_not_found=no ; break 3],ac_not_found=yes)
done
done
done
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
if test "$ac_not_found" = yes; then
ac_cv_func_select_arg1=int
ac_cv_func_select_arg234='int *'
ac_cv_func_select_arg5='struct timeval *'
fi
AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1,
[Define to the type of arg1 for select().])
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234),
[Define to the type of args 2, 3 and 4 for select().])
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5),
[Define to the type of arg5 for select().])
])
### Check which frontend we want to use. The default is XForms
###
AC_DEFUN(LYX_USE_FRONTEND,
@ -710,37 +667,6 @@ AC_SUBST(FRONTEND_LIBS)
])
dnl Check things are declared in headers to avoid errors or warnings.
dnl Called like LYX_CHECK_DECL(function, headerfile)
dnl Defines HAVE_DECL_{FUNCTION}
AC_DEFUN(LYX_CHECK_DECL,
[AC_MSG_CHECKING(if $1 is declared by header $2)
tr_func=`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
tr_hdr=`echo $2 | tr . _`
AC_CACHE_VAL([lyx_cv_declare_${tr_hdr}_$1],
[AC_EGREP_HEADER($1, $2, [eval "lyx_cv_declare_${tr_hdr}_$1=yes"], [eval "lyx_cv_declare_${tr_hdr}_$1=no"])])
if eval "test \"\${lyx_cv_declare_${tr_hdr}_$1}\" = \"yes\""; then
AC_DEFINE_UNQUOTED(HAVE_DECL_${tr_func},1,[dummy])
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)
AC_DEFUN(LYX_CHECK_DECL_HDRS,
[ got="no"
for I in $2; do
tr_hdr=`echo $I | tr . _`
if test "${got}" = "no"; then
LYX_CHECK_DECL($1, $I)
fi
if eval "test \"\${lyx_cv_declare_${tr_hdr}_$1}\" = \"yes\""; then
got="yes"
fi
done])
## ------------------------------------------------------------------------
## Find a file (or one of more files in a list of dirs)

74
config/lyxinclude213.m4 Normal file
View File

@ -0,0 +1,74 @@
dnl We use this until autoconf fixes its version.
AC_DEFUN(LYX_FUNC_SELECT_ARGTYPES,
[AC_MSG_CHECKING([types of arguments for select()])
AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
[AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
[AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
[for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
AC_TRY_COMPILE(dnl
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
extern int select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
[ac_not_found=no ; break 3],ac_not_found=yes)
done
done
done
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
if test "$ac_not_found" = yes; then
ac_cv_func_select_arg1=int
ac_cv_func_select_arg234='int *'
ac_cv_func_select_arg5='struct timeval *'
fi
AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1,
[Define to the type of arg1 for select().])
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234),
[Define to the type of args 2, 3 and 4 for select().])
AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5),
[Define to the type of arg5 for select().])
])
dnl Check things are declared in headers to avoid errors or warnings.
dnl Called like LYX_CHECK_DECL(function, headerfile)
dnl Defines HAVE_DECL_{FUNCTION}
AC_DEFUN(LYX_CHECK_DECL,
[AC_MSG_CHECKING(if $1 is declared by header $2)
tr_func=`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
tr_hdr=`echo $2 | tr . _`
AC_CACHE_VAL([lyx_cv_declare_${tr_hdr}_$1],
[AC_EGREP_HEADER($1, $2, [eval "lyx_cv_declare_${tr_hdr}_$1=yes"], [eval "lyx_cv_declare_${tr_hdr}_$1=no"])])
if eval "test \"\${lyx_cv_declare_${tr_hdr}_$1}\" = \"yes\""; then
AC_DEFINE_UNQUOTED(HAVE_DECL_${tr_func},1,[dummy])
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)
AC_DEFUN(LYX_CHECK_DECL_HDRS,
[ got="no"
for I in $2; do
tr_hdr=`echo $I | tr . _`
if test "${got}" = "no"; then
LYX_CHECK_DECL($1, $I)
fi
if eval "test \"\${lyx_cv_declare_${tr_hdr}_$1}\" = \"yes\""; then
got="yes"
fi
done])

19
config/lyxinclude25x.m4 Normal file
View File

@ -0,0 +1,19 @@
dnl this is used by the macro blow to general a proper config.h.in entry
m4_define([LYX_AH_CHECK_DECL],
[AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_$1),
[Define if you have the prototype for function `$1'])])
dnl Check things are declared in headers to avoid errors or warnings.
dnl Called like LYX_CHECK_DECL(function, header1 header2...)
dnl Defines HAVE_DECL_{FUNCTION}
AC_DEFUN(LYX_CHECK_DECL,
[LYX_AH_CHECK_DECL($1)
for ac_header in $2
do
AC_MSG_CHECKING([if $1 is declared by header $ac_header])
AC_EGREP_HEADER($1, $ac_header,
[AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_DECL_$1))
break],
[AC_MSG_RESULT(no)])
done])