Debian Codegraph @

m4/gauche.m4

raw
1 dnl -*- mode: autoconf -*-
2 dnl Gauche-specific autoconf macros.
3 dnl
4 dnl NB: As of 0.8.6, use of Gauche-specific macros is deprecated.
5 dnl The 'gauche-package' program can generate template configure.ac
6 dnl that doesn't have any Gauche-specific macros. We still keep
7 dnl this for backward compatibility, but will remove it after some time.
8
9 #serial 1
10
11 dnl AC_GAUCHE_INIT_EXT
12 dnl Sets some parameters about installed Gauche package.
13 dnl
14 dnl GOSH - Path of gosh executable
15 dnl GAUCHE_CONFIG - Path of gauche-config program
16 dnl GAUCHE_PACKAGE - Path of gauche-package program
17 dnl GAUCHE_INSTALL - Path of gauche-install program
18 dnl GAUCHE_CESCONV - Path of gauche-cesconv program
19 dnl GAUCHE_INC - '-I' macros required to compile extensions.
20 dnl GAUCHE_LIB - '-L' macros required to link extensions.
21 dnl GAUCHE_VERSION - The version of Gauche.
22 AC_DEFUN([AC_GAUCHE_INIT_EXT],
23 [
24 AC_PATH_PROG([GOSH], gosh)
25 AC_PATH_PROG([GAUCHE_CONFIG], gauche-config)
26 AC_PATH_PROG([GAUCHE_PACKAGE], gauche-package)
27 AC_PATH_PROG([GAUCHE_INSTALL], gauche-install)
28 AC_PATH_PROG([GAUCHE_CESCONV], gauche-cesconv)
29 GAUCHE_TOP=
30 GAUCHE_INC="`gauche-config -I`"
31 GAUCHE_LIB="`gauche-config -L`"
32 AC_SUBST(GAUCHE_INC)
33 AC_SUBST(GAUCHE_LIB)
34 GAUCHE_VERSION=`$GAUCHE_CONFIG -V`
35 AC_SUBST(GAUCHE_VERSION)
36 AC_DEFINE_UNQUOTED(GAUCHE_VERSION, "$GAUCHE_VERSION", [Gauche version string])
37 ])
38
39 dnl AC_GAUCHE_INSTALL_TYPE(TYPE)
40 dnl Sets the default value of INSTALL_TYPE macro. TYPE must be either
41 dnl sys or site.
42 AC_DEFUN([AC_GAUCHE_INSTALL_TYPE],
43 [
44 : ${INSTALL_TYPE=$1}
45 AS_IF([test "X$INSTALL_TYPE" != "Xsys" -a "X$INSTALL_TYPE" != "Xsite"],
46 [AC_MSG_ERROR([INSTALL_TYPE must be either 'sys' or 'site'])])
47 AC_SUBST(INSTALL_TYPE)
48 ])
49
50 dnl AC_GAUCHE_CC
51 dnl Gets compiler parameters which Gauche has been compiled with.
52 AC_DEFUN([AC_GAUCHE_CC],
53 [
54 CC="`$GAUCHE_CONFIG --cc`"
55 AC_SUBST(CC)
56 # adds default CFLAGS if it has not been set.
57 ac_gauche_CFLAGS=${CFLAGS+set}
58 AS_IF([test -z "$ac_gauche_CFLAGS"],
59 [CFLAGS="`$GAUCHE_CONFIG --default-cflags`"])
60 # adds default OBJEXT if it has not been set.
61 ac_gauche_OBJEXT=${OBJEXT+set}
62 AS_IF([test -z "$ac_gauche_OBJEXT"],
63 [OBJEXT="`$GAUCHE_CONFIG --object-suffix`"])
64 ac_gauche_EXEEXT=${EXEEXT+set}
65 AS_IF([test -z "$ac_gauche_EXEEXT"],
66 [EXEEXT="`$GAUCHE_CONFIG --executable-suffix`"])
67 ac_gauche_SOEXT=${SOEXT+set}
68 AS_IF([test -z "$ac_gauche_SOEXT"],
69 [SOEXT="`$GAUCHE_CONFIG --so-suffix`"])
70 ac_gauche_DYLIBEXT=${DYLIBEXT+set}
71 AS_IF([test -z "$ac_gauche_DYLIBEXT"],
72 [DYLIBEXT="`$GAUCHE_CONFIG --dylib-suffix`"])
73 AC_SUBST(OBJEXT)
74 AC_SUBST(EXEEXT)
75 AC_SUBST(SOEXT)
76 AC_SUBST(DYLIBEXT)
77 ])
78
79 dnl AC_GAUCHE_FLAGS
80 dnl Sets CFLAGS, CPPFLAGS and LDFLAGS appropriate for furthre testing.
81 dnl This should come before any testings that require those flags to be set.
82 AC_DEFUN([AC_GAUCHE_FLAGS],
83 [
84 CFLAGS="$CFLAGS $GAUCHE_INC"
85 AC_SUBST(CFLAGS)
86 CPPFLAGS="$CPPFLAGS $GAUCHE_INC" # some test requires this
87 LDFLAGS="$LDFLAGS `$GAUCHE_CONFIG --local-libdir`"
88 AC_GAUCHE_OPTFLAGS
89 ])
90
91 dnl AC_GAUCHE_OPTFLAGS
92 dnl Sets OPTFLAGS with some optimization flags using heuristics.
93 dnl If you use AC_GAUCHE_FLAGS, this test is included.
94 dnl The main configure and gc's configure also use this.
95 AC_DEFUN([AC_GAUCHE_OPTFLAGS],
96 [
97 AC_ARG_ENABLE([heuristic-optimization],
98 AS_HELP_STRING([--enable-heuristic-optimization],
99 [Sets some architecture specific optimization flags using heuristics (default: enable)]),
100 [USE_HEURISTIC_OPTIMIZATION=$enableval],
101 [USE_HEURISTIC_OPTIMIZATION=yes])
102 AS_IF([test "x$USE_HEURISTIC_OPTIMIZATION" = xyes],[
103 AS_CASE(["$target"],
104 [i686-*], [I686OPT="-DUSE_I686_PREFETCH"])
105 AS_CASE(["$CC"],
106 [gcc*], [ dnl some systems may have gcc-2.95, gcc-3, etc.
107 AS_CASE(["$target"],
108 [*mingw*], [],
109 [GCCOPT="-fomit-frame-pointer"])
110 AS_CASE(["$target"],
111 [i586-*], [GCCOPT="$GCCOPT -march=i586"],
112 [i686-*], [GCCOPT="$GCCOPT -march=i686"])])])
113 OPTFLAGS="$GCCOPT $I686OPT"
114 AC_SUBST(OPTFLAGS)
115 ])
116
117 dnl AC_GAUCHE_FIX_LIBS
118 dnl Sets LDFLAGS and LIBS to generate shared library.
119 dnl This has to come after all the tests that require linking, or those test
120 dnl will fail because they can't generate stand-alone executable.
121 AC_DEFUN([AC_GAUCHE_FIX_LIBS],
122 [
123 LDFLAGS="$LDFLAGS `$GAUCHE_CONFIG --so-ldflags`"
124 LIBS="$GAUCHE_LIB `$GAUCHE_CONFIG -l` $LIBS"
125 AC_SUBST(LDFLAGS)
126 ])
127
128 dnl AC_GAUCHE_EXT_FIXUP(FILE [, MODULE])
129 dnl OBSOLETED - used to generate a guard file for GC. No longer needed.
130 AC_DEFUN([AC_GAUCHE_EXT_FIXUP], [])
131
132 dnl AC_GAUCHE_MAKE_GPD
133 dnl Creates a Gauche package description file.
134 dnl
135 AC_DEFUN([AC_GAUCHE_MAKE_GPD],
136 [
137 GAUCHE_PACKAGE_CONFIGURE_ARGS=`echo "$ac_configure_args" | sed 's/@<:@\\"\`\$@:>@/\\\\&/g'`
138 AC_MSG_NOTICE([creating ${PACKAGE_NAME}.gpd])
139 $GAUCHE_PACKAGE make-gpd "$PACKAGE_NAME" \
140 -version "$PACKAGE_VERSION" \
141 -configure "./configure $GAUCHE_PACKAGE_CONFIGURE_ARGS"
142 ])