Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 127 lines (105 sloc) 4.165 kB
9c0d10b Massive reorganization. Works this time! A good handful of code has b…
Zack Moratto authored
1 dnl __BEGIN_LICENSE__
772763d @novas0x2a LICENSING MEGA-COMMIT
novas0x2a authored
2 dnl Copyright (C) 2006-2009 United States Government as represented by
9c0d10b Massive reorganization. Works this time! A good handful of code has b…
Zack Moratto authored
3 dnl the Administrator of the National Aeronautics and Space Administration.
4 dnl All Rights Reserved.
5 dnl __END_LICENSE__
6
772763d @novas0x2a LICENSING MEGA-COMMIT
novas0x2a authored
7
bf8e60a Bringing ASP's build system up to VW standards
Zack Moratto authored
8 m4_ifdef([_AX_FIXUPS], [], [m4_include([m4/fixups.m4])])
9
9c0d10b Massive reorganization. Works this time! A good handful of code has b…
Zack Moratto authored
10 # Usage: AX_MODULE(<name>, <directory>, <library>, <default>, <prerequisites>, <required dependencies>[, <optional dependencies>])
11 AC_DEFUN([AX_MODULE],
12 [
13 m4_ifdef([_AX_MODULE_PREPARE], [],
14 [
15 abspath() {
16 if test ${1#/} = [$]1; then
17 echo "$PWD/[$]1"
18 else
19 echo [$]1
20 fi
21 }
22
23 var_uniq() {
24 echo -n "[$]*" | sed 's/ \+/\n/g' | sed -n 'G; s/\n/&&/; /^\(@<:@^\n@:>@*\n\).*\n\1/d; s/\n//; h; P' | tr '\n' ' '
25 }
26
27 get_rpath() {
28 for i in "[$]@"; do
29 case [$i] in
30 -L*) v="`abspath ${i#-L}`"; if test -n "$v"; then echo -n " -R$v"; fi;;
31 esac
32 done
33 echo
34 }
35 m4_define([_AX_MODULE_PREPARE], [1])
36 ])
37
38 # Silently ignore modules that don't exist in this distribution
39 if test -d "$srcdir/$2" ; then
40
41 HAVE_PKG_$1_SRC=yes
42
bf8e60a Bringing ASP's build system up to VW standards
Zack Moratto authored
43 m4_divert_once([INIT_PREPARE], [dnl
8ee47c9 @novas0x2a make sure WANT_APP_* runs first, to fix request modules
novas0x2a authored
44 # Silently ignore modules that don't exist in this distribution
45 # I'm diverting the output, so i need to do this twice.
46 if test -d "$srcdir/$2" ; then
47
48 if test -n "$ENABLE_MODULE_$1"; then
49 WANT_MODULE_$1="$ENABLE_MODULE_$1"
50 fi
51 fi
bf8e60a Bringing ASP's build system up to VW standards
Zack Moratto authored
52
53 AC_ARG_ENABLE([module-]my_tolower([$1]),
54 AS_HELP_STRING([--enable-module-]my_tolower([$1]), [enable the $1 module @<:@$4@:>@]),
55 [ ENABLE_MODULE_$1=$enableval; WANT_MODULE_$1=$enableval; ],
56 [ if test x"$ENABLE_MODULE_$1" = x; then ENABLE_MODULE_$1=`/bin/echo -n $4 | tr [A-Z] [a-z]` ; fi ]
57 )])
9c0d10b Massive reorganization. Works this time! A good handful of code has b…
Zack Moratto authored
58
59 AC_MSG_CHECKING([whether to build module $1])
60 ax_module_enable=$ENABLE_MODULE_$1
61
62 # Create a variable to store missing
63 AS_VAR_PUSHDEF([missing], [ax_module_]$1[_missing])
64
65 # Load args 5 and 6 as required deps, and capture missing deps in missing var.
66 # If missing is populated, bail out. Then load the optional deps
67 AS_IF([test x"$ax_module_enable" != "xyes"], [AC_MSG_RESULT([no (disabled)])],
68 [AX_LOAD_DEPS([$1], [$5 $6], [missing]) # Load required deps
69 AS_IF([test -n "$missing"], [AC_MSG_RESULT([no ([missing] $missing)]); ax_module_enable=no],
70 [AX_LOAD_DEPS([$1], [$7]) # Load optional deps
71 MODULE_$1_CPPFLAGS="$PKG_$1_CPPFLAGS"
72 if test x"$ENABLE_RPATH" = "xyes"; then
73 PKG_$1_LIBS="$PKG_$1_LIBS `var_uniq \`get_rpath ${PKG_$1_LIBS}\``"
74 fi
75 MODULE_$1_LIBS="$PKG_$1_LIBS"
bf8e60a Bringing ASP's build system up to VW standards
Zack Moratto authored
76 m4_ifval([$3], [PKG_$1_LIBS="\$(top_builddir)/$2/$3 $PKG_$1_LIBS"])
9c0d10b Massive reorganization. Works this time! A good handful of code has b…
Zack Moratto authored
77 AC_MSG_RESULT([yes])])])
78
79 AS_VAR_POPDEF([missing])
80
81 else
82 HAVE_PKG_$1_SRC=no
83 ax_module_enable=no
84 MODULE_$1_LIBS=
85 PKG_$1_LIBS=
86 MODULE_$1_CPPFLAGS=
87 PKG_$1_CPPFLAGS=
88 fi
89
90 AC_SUBST(MODULE_$1_CPPFLAGS)
91 AC_SUBST(PKG_$1_CPPFLAGS)
92 AC_SUBST(MODULE_$1_LIBS)
93 AC_SUBST(PKG_$1_LIBS)
94
95 HAVE_PKG_$1=${ax_module_enable}
96 MAKE_MODULE_$1=${ax_module_enable}
97 AC_SUBST(MAKE_MODULE_$1)
98
99 if test -n "$WANT_MODULE_$1"; then
100 if test x"$MAKE_MODULE_$1" != x"$WANT_MODULE_$1"; then
101 AC_MSG_ERROR([You said ENABLE_MODULE_]$1[=$WANT_MODULE_]$1[, but I decided $MAKE_MODULE_]$1)
102 fi
103 fi
104
105 if test "${HAVE_PKG_$1}" = "yes" ; then
106 ax_have_pkg_bool=1
107 else
108 ax_have_pkg_bool=0
109 fi
110 AC_DEFINE_UNQUOTED(HAVE_PKG_$1,
111 [$ax_have_pkg_bool],
112 [Define to 1 if the $1 module is available.])
113
114 if test "$HAVE_PKG_$1_SRC" = "yes" ; then
115 AX_LOG([MAKE_MODULE_]$1[ = $MAKE_MODULE_]$1)
116 AX_LOG([HAVE_PKG_]$1[ = $HAVE_PKG_]$1)
117 AX_LOG([MODULE_]$1[_CPPFLAGS = $MODULE_]$1[_CPPFLAGS])
118 AX_LOG([PKG_]$1[_CPPFLAGS = $PKG_]$1[_CPPFLAGS])
119 AX_LOG([MODULE_]$1[_LIBS = $MODULE_]$1[_LIBS])
120 AX_LOG([PKG_]$1[_LIBS = $PKG_]$1[_LIBS])
121 fi
122
123 # We're putting these in configure.ac manually by now, for
124 # backwards compatability with older versions of automake.
125 # AM_CONDITIONAL([MAKE_MODULE_$1], [test "$MAKE_MODULE_$1" = "yes"])
126 ])
Something went wrong with that request. Please try again.