mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-11-24 16:53:04 +08:00
Change to recommanded m4/-style small files
This commit is contained in:
16
m4/ccalias.m4
Normal file
16
m4/ccalias.m4
Normal file
@@ -0,0 +1,16 @@
|
||||
dnl Check whether the target supports symbol aliases.
|
||||
dnl This is a mdbtools specific version
|
||||
dnl TODO: Check if gnulib version works, and add serial
|
||||
|
||||
dnl Code copied from libgomp
|
||||
AC_DEFUN([AM_GCC_ATTRIBUTE_ALIAS], [
|
||||
AC_CACHE_CHECK([whether the target supports symbol aliases],
|
||||
am_cv_gcc_have_attribute_alias, [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||
void foo(void) { }
|
||||
extern void bar(void) __attribute__((alias("foo")));],
|
||||
[bar();])], am_cv_gcc_have_attribute_alias=yes, am_cv_gcc_have_attribute_alias=no)])
|
||||
if test $am_cv_gcc_have_attribute_alias = yes; then
|
||||
AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
|
||||
[Define to 1 if the target supports __attribute__((alias(...))).])
|
||||
fi])
|
||||
69
m4/iconv.m4
Normal file
69
m4/iconv.m4
Normal file
@@ -0,0 +1,69 @@
|
||||
dnl This is a mdbtools specific version of iconv.m4
|
||||
dnl Do not put a serial in it, or be prepared to install extra stuff like rpath.config
|
||||
dnl
|
||||
dnl From Bruno Haible.
|
||||
AC_DEFUN([AM_ICONV],
|
||||
[
|
||||
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
||||
dnl those with the standalone portable GNU libiconv installed).
|
||||
|
||||
AC_ARG_WITH([libiconv-prefix],
|
||||
AS_HELP_STRING([--with-libiconv-prefix=DIR], [search for libiconv in DIR/include and DIR/lib]), [
|
||||
for dir in `echo "$withval" | tr : ' '`; do
|
||||
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
|
||||
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
|
||||
done
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
||||
am_cv_func_iconv="no, consider installing GNU libiconv"
|
||||
am_cv_lib_iconv=no
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);])],
|
||||
am_cv_func_iconv=yes)
|
||||
if test "$am_cv_func_iconv" != yes; then
|
||||
am_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -liconv"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);])],
|
||||
[am_cv_lib_iconv=yes
|
||||
am_cv_func_iconv=yes])
|
||||
LIBS="$am_save_LIBS"
|
||||
fi
|
||||
])
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||
AC_MSG_CHECKING([for iconv declaration])
|
||||
AC_CACHE_VAL(am_cv_proto_iconv, [
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
||||
#else
|
||||
size_t iconv();
|
||||
#endif
|
||||
], [])], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
|
||||
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
|
||||
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
||||
AC_MSG_RESULT([$]{ac_t:-
|
||||
}[$]am_cv_proto_iconv)
|
||||
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
||||
[Define as const if the declaration of iconv() needs const.])
|
||||
fi
|
||||
LIBICONV=
|
||||
if test "$am_cv_lib_iconv" = yes; then
|
||||
LIBICONV="-liconv"
|
||||
fi
|
||||
AC_SUBST(LIBICONV)
|
||||
])
|
||||
47
m4/readline.m4
Normal file
47
m4/readline.m4
Normal file
@@ -0,0 +1,47 @@
|
||||
dnl readline.m4
|
||||
dnl mdbtools specific version
|
||||
dnl TODO: Check if official version works then add serial
|
||||
AC_DEFUN([VL_LIB_READLINE], [
|
||||
AC_CACHE_CHECK([for a readline compatible library],
|
||||
vl_cv_lib_readline, [
|
||||
ORIG_LIBS="$LIBS"
|
||||
for readline_lib in readline edit editline; do
|
||||
for termcap_lib in "" termcap curses ncurses; do
|
||||
TRY_LIB="-l$readline_lib"
|
||||
if test -n "$termcap_lib"; then
|
||||
TRY_LIB="$TRY_LIB -l$termcap_lib"
|
||||
fi
|
||||
LIBS="$ORIG_LIBS $TRY_LIB"
|
||||
AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline=yes)
|
||||
if test "$vl_cv_lib_readline" = yes; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$vl_cv_lib_readline" = yes; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
if test "$vl_cv_lib_readline" = yes; then
|
||||
AC_DEFINE(HAVE_LIBREADLINE, 1,
|
||||
[Define if you have a readline compatible library])
|
||||
AC_CHECK_HEADERS(readline.h readline/readline.h)
|
||||
AC_CACHE_CHECK([whether readline supports history],
|
||||
vl_cv_lib_readline_history, [
|
||||
AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history=yes)
|
||||
])
|
||||
if test "$vl_cv_lib_readline_history" = yes; then
|
||||
AC_DEFINE(HAVE_READLINE_HISTORY, 1,
|
||||
[Define if your readline library has \`add_history'])
|
||||
AC_CHECK_HEADERS(history.h readline/history.h)
|
||||
fi
|
||||
fi
|
||||
LIBS="$ORIG_LIBS"
|
||||
|
||||
LIBREADLINE=
|
||||
if test "$vl_cv_lib_readline" = yes; then
|
||||
LIBREADLINE="$TRY_LIB"
|
||||
fi
|
||||
AC_SUBST(LIBREADLINE)
|
||||
])dnl
|
||||
Reference in New Issue
Block a user