aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-03-08 17:49:39 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-03-08 17:49:39 +0000
commit23030b10e3b9335ae5dc0384a2cb2890cf3685ac (patch)
treeca3e765a20e6da33cb24d1c9871987dd7e7ee756 /m4
parent1a63a918f80858a329f0312da04a6a2ea37011d0 (diff)
downloadellinika-23030b10e3b9335ae5dc0384a2cb2890cf3685ac.tar.gz
ellinika-23030b10e3b9335ae5dc0384a2cb2890cf3685ac.tar.bz2
New files
git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@27 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'm4')
-rw-r--r--m4/common.m449
-rw-r--r--m4/guile.m490
-rw-r--r--m4/lib.m426
3 files changed, 165 insertions, 0 deletions
diff --git a/m4/common.m4 b/m4/common.m4
new file mode 100644
index 0000000..395a7cb
--- /dev/null
+++ b/m4/common.m4
@@ -0,0 +1,49 @@
1dnl RA_FLUSHLEFT -- remove all whitespace at the beginning of lines
2dnl This is useful for c-code which may include cpp statements
3dnl
4define([RA_FLUSHLEFT],
5 [changequote(`,')dnl
6patsubst(`$1', `^[ ]+')
7changequote([,])])dnl
8
9dnl RA_RESULT_ACTIONS -- generate shell code for the result of a test
10dnl $1 -- CVAR -- cache variable to check
11dnl $2 -- NAME -- if not empty, used to generate a default value TRUE:
12dnl `AC_DEFINE(HAVE_NAME)'
13dnl $2 -- TRUE -- what to do if the CVAR is not `no'
14dnl $3 -- FALSE -- what to do otherwise; defaults to `:'
15dnl
16AC_DEFUN([RA_RESULT_ACTIONS], [
17[if test "$$1" != "" -a "$$1" != no; then
18 ]ifelse([$3], ,
19 [AC_DEFINE(HAVE_]translit($2, [a-z ./<>], [A-Z___])[,1,[FIXME])],
20 [$3])[
21else
22 ]ifelse([$4], , [:], [$4])[
23fi]])dnl
24
25dnl RA_CHECK_STRUCT_FIELD -- See if a structure has a particular field
26dnl $1 - NAME -- name of structure
27dnl $2 - FIELD -- name of field to test
28dnl $3 - INCLS -- C program text to inculde necessary files for testing
29dnl $4 - TRUE -- what to do if struct NAME has FIELD; defaults to
30dnl `AC_DEFINE(HAVE_NAME_FIELD)'
31dnl $5 - FALSE -- what to do if not; defaults to `:'
32dnl
33dnl NOTE: We still don't use AC_CHECK_MEMBERS, since it has (as of
34dnl autoconf 2.53) a bug which prevents it from recognizing members
35dnl of aggregate type.
36
37AC_DEFUN([RA_CHECK_STRUCT_FIELD], [
38 define([ra_CVAR], [ra_cv_struct_]translit($1_$2, [A-Z], [a-z]))dnl
39 AC_CACHE_CHECK([whether struct $1 has $2 field], ra_CVAR,
40 AC_TRY_COMPILE(RA_FLUSHLEFT([$3]),
41 [struct $1 ra_x; int ra_y = sizeof ra_x.$2;],
42 ra_CVAR[=yes], ra_CVAR[=no]))
43 RA_RESULT_ACTIONS(ra_CVAR, [$1_$2], [$4], [$5])dnl
44 undefine([ra_CVAR])])dnl
45
46AC_SUBST(RADIUSD_LDADD_LIST)
47AC_DEFUN([RA_RADIUSD_LDADD],
48 RADIUSD_LDADD_LIST="$RADIUSD_LDADD_LIST [$1]")
49
diff --git a/m4/guile.m4 b/m4/guile.m4
new file mode 100644
index 0000000..0934cc2
--- /dev/null
+++ b/m4/guile.m4
@@ -0,0 +1,90 @@
1dnl This file is part of GNU Radius.
2dnl Copyright (C) 2001,2003 Free Software Foundation, Inc.
3dnl
4dnl Written by Sergey Poznyakoff
5dnl
6dnl GNU Radius is free software; you can redistribute it and/or modify
7dnl it under the terms of the GNU General Public License as published by
8dnl the Free Software Foundation; either version 2 of the License, or
9dnl (at your option) any later version.
10dnl
11dnl GNU Radius is distributed in the hope that it will be useful,
12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14dnl GNU General Public License for more details.
15dnl
16dnl You should have received a copy of the GNU General Public License
17dnl along with GNU Radius; if not, write to the Free Software
18dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19dnl
20
21AC_DEFUN([RA_CHECK_GUILE],
22[
23 if test "x$ra_cv_lib_guile" = x; then
24 cached=""
25 AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $PATH)
26 if test $GUILE_CONFIG = no; then
27 ra_cv_lib_guile=no
28 else
29 GUILE_INCLUDES=`guile-config compile`
30 GUILE_LIBS=`guile-config link`
31 fi
32
33 if test $GUILE_CONFIG != no; then
34 AC_MSG_CHECKING(for guile version 1.4 or higher)
35 GUILE_VERSION=`($GUILE_CONFIG --version 2>&1; echo '')|sed -n 's/guile-config - Guile version \([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\).*/\1\2/p'`
36 case "x$GUILE_VERSION" in
37 x[[0-9]]*)
38 if test $GUILE_VERSION -lt 14; then
39 AC_MSG_RESULT(Nope. Version number too low.)
40 ra_cv_lib_guile=no
41 else
42 AC_DEFINE_UNQUOTED(GUILE_VERSION, $GUILE_VERSION,
43 [Guile version number: MAX*10 + MIN])
44 AC_MSG_RESULT(OK)
45 save_LIBS=$LIBS
46 save_CFLAGS=$CFLAGS
47 LIBS="$LIBS $GUILE_LIBS"
48 CFLAGS="$CFLAGS $GUILE_INCLUDES"
49 AC_TRY_LINK([#include <libguile.h>],
50 ifelse([$1], , scm_shell(0, NULL);, [$1]),
51 [ra_cv_lib_guile=yes],
52 [ra_cv_lib_guile=no])
53 LIBS=$save_LIBS
54 CFLAGS=$save_CFLAGS
55 fi ;;
56 *) AC_MSG_RESULT(Nope. Unknown version number)
57 ra_cv_lib_guile=no;;
58 esac
59 fi
60 else
61 cached=" (cached) "
62 GUILE_INCLUDES=`guile-config compile`
63 GUILE_LIBS=`guile-config link`
64 fi
65 AC_MSG_CHECKING(whether to build guile support)
66 RA_RESULT_ACTIONS([ra_cv_lib_guile],[LIBGUILE],[$2],[$3])
67 AC_MSG_RESULT(${cached}$ra_cv_lib_guile)
68 if test $ra_cv_lib_guile = yes; then
69 if test $GUILE_VERSION -gt 14; then
70 LIBS="$LIBS $GUILE_LIBS"
71 CFLAGS="$CFLAGS $GUILE_INCLUDES"
72 AC_CHECK_FUNCS(scm_long2num scm_cell scm_list_1 scm_list_n scm_c_define\
73 scm_c_lookup)
74 if test $ac_cv_func_scm_cell = no; then
75 AC_MSG_CHECKING(for inline scm_cell)
76 AC_TRY_LINK([#include <libguile.h>],
77 [scm_cell(SCM_EOL, SCM_EOL)],
78 [ac_cv_func_scm_cell=yes
79 AC_DEFINE(HAVE_SCM_CELL,1,
80 Define if you have scm_cell function)])
81 AC_MSG_RESULT($ac_cv_func_scm_cell)
82 fi
83 CFLAGS=$save_CFLAGS
84 LIBS=$save_LIBS
85 fi
86 fi
87])
88
89
90
diff --git a/m4/lib.m4 b/m4/lib.m4
new file mode 100644
index 0000000..1ecb33c
--- /dev/null
+++ b/m4/lib.m4
@@ -0,0 +1,26 @@
1dnl Arguments:
2dnl $1 -- Library to look for
3dnl $2 -- Function to check in the library
4dnl $3 -- Any additional libraries that might be needed
5dnl $4 -- Action to be taken when test succeeds
6dnl $5 -- Action to be taken when test fails
7dnl $6 -- Directories where the library may reside
8AC_DEFUN([RA_CHECK_LIB],
9[
10 save_LIBS=$LIBS
11 AC_CACHE_CHECK([for -l$1], ra_cv_lib_$1,
12 [
13 for path in $6
14 do
15 LIBS="$save_LIBS $3 -L$path -l$1"
16 AC_TRY_LINK_FUNC($2,
17 [ra_cv_lib_$1="$3 -L$path -l$1"
18 break],
19 [ra_cv_lib_$1=no],$3)
20 done
21 ])
22 RA_RESULT_ACTIONS([ra_cv_lib_$1],[LIB$1],[$4],[$5])
23 LIBS=$save_LIBS
24])
25
26

Return to:

Send suggestions and report system problems to the System administrator.