Change to recommanded m4/-style small files

This commit is contained in:
Nirgal Vourgère 2013-07-15 00:30:21 +02:00
parent a63692312c
commit 05980343ec
6 changed files with 72 additions and 61 deletions

4
.gitignore vendored
View File

@ -6,6 +6,10 @@
aclocal.m4 aclocal.m4
autom4te.cache/ autom4te.cache/
build-aux/ build-aux/
m4/
!m4/ccalias.m4
!m4/iconv.m4
!m4/readline.m4
config.log config.log
config.status config.status
configure configure

View File

@ -1,3 +1,4 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src include doc SUBDIRS = src include doc
DEFDIR = $(prefix) DEFDIR = $(prefix)

View File

@ -1,5 +1,6 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT([mdbtools],[0.7],[mdbtools-dev@lists.sourceforge.net]) AC_INIT([mdbtools],[0.7],[mdbtools-dev@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR(src/extras/mdb-dump.c) AC_CONFIG_SRCDIR(src/extras/mdb-dump.c)
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE

16
m4/ccalias.m4 Normal file
View 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])

View File

@ -1,49 +1,6 @@
AC_DEFUN([VL_LIB_READLINE], [ dnl This is a mdbtools specific version of iconv.m4
AC_CACHE_CHECK([for a readline compatible library], dnl Do not put a serial in it, or be prepared to install extra stuff like rpath.config
vl_cv_lib_readline, [ dnl
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
dnl From Bruno Haible. dnl From Bruno Haible.
AC_DEFUN([AM_ICONV], AC_DEFUN([AM_ICONV],
[ [
@ -110,18 +67,3 @@ size_t iconv();
fi fi
AC_SUBST(LIBICONV) AC_SUBST(LIBICONV)
]) ])
dnl Check whether the target supports symbol aliases.
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])

47
m4/readline.m4 Normal file
View 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