summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2004-11-25 03:37:45 +0000
committerCarsten Haitzler <raster@rasterman.com>2004-11-25 03:37:45 +0000
commit5e2388c886b15923f2b1350191524f40b0e9050a (patch)
treeeeb93c0db03cb87075ed74cc31367f669e5f2e72 /m4
parentf2b45ed47126d12986591cb02a6fcfc5908255fe (diff)
_ _ _ _ _____ ___
| | | | ___| | | | ___| __ ___ ___ _______ ___ / _ \__ _____ _ __ | |_| |/ _ \ | | | |_ | '__/ _ \/ _ \_ / _ \/ __| | | | \ \ / / _ \ '__| | _ | __/ | | | _|| | | __/ __// / __/\__ \ | |_| |\ V / __/ | |_| |_|\___|_|_| |_| |_| \___|\___/___\___||___/ \___/ \_/ \___|_| I put E17's wm code into cvs. Hell is freezing over. Duke Nukem Forever will be out next week. Snowballls take up residence in Hell. The Fat Lady sings. The End is nigh... :) SVN revision: 12247
Diffstat (limited to 'm4')
-rw-r--r--m4/ac_expand_dir.m414
-rw-r--r--m4/ac_path_generic.m4136
2 files changed, 150 insertions, 0 deletions
diff --git a/m4/ac_expand_dir.m4 b/m4/ac_expand_dir.m4
new file mode 100644
index 000000000..b5599a074
--- /dev/null
+++ b/m4/ac_expand_dir.m4
@@ -0,0 +1,14 @@
1dnl AC_EXPAND_DIR(VARNAME, DIR)
2dnl expands occurrences of ${prefix} and ${exec_prefix} in the given DIR,
3dnl and assigns the resulting string to VARNAME
4dnl example: AC_DEFINE_DIR(DATADIR, "$datadir")
5dnl by Alexandre Oliva <oliva@dcc.unicamp.br>
6AC_DEFUN([AC_EXPAND_DIR], [
7 $1=$2
8 $1=`(
9 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
10 test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
11 eval echo \""[$]$1"\"
12 )`
13])
14
diff --git a/m4/ac_path_generic.m4 b/m4/ac_path_generic.m4
new file mode 100644
index 000000000..27b55b3ff
--- /dev/null
+++ b/m4/ac_path_generic.m4
@@ -0,0 +1,136 @@
1dnl @synopsis AC_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2dnl
3dnl Runs a LIBRARY-config script and defines LIBRARY_CFLAGS and LIBRARY_LIBS
4dnl
5dnl The script must support `--cflags' and `--libs' args.
6dnl If MINIMUM-VERSION is specified, the script must also support the
7dnl `--version' arg.
8dnl If the `--with-library-[exec-]prefix' arguments to ./configure are given,
9dnl it must also support `--prefix' and `--exec-prefix'.
10dnl (In other words, it must be like gtk-config.)
11dnl
12dnl For example:
13dnl
14dnl AC_PATH_GENERIC(Foo, 1.0.0)
15dnl
16dnl would run `foo-config --version' and check that it is at least 1.0.0
17dnl
18dnl If so, the following would then be defined:
19dnl
20dnl FOO_CFLAGS to `foo-config --cflags`
21dnl FOO_LIBS to `foo-config --libs`
22dnl
23dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK)
24dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount)
25dnl
26dnl @author Angus Lees <gusl@cse.unsw.edu.au>
27
28AC_DEFUN([AC_PATH_GENERIC],
29[dnl
30dnl we're going to need uppercase, lowercase and user-friendly versions of the
31dnl string `LIBRARY'
32pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
33pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
34
35dnl
36dnl Get the cflags and libraries from the LIBRARY-config script
37dnl
38AC_ARG_WITH(DOWN-prefix,[ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)],
39 DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
40AC_ARG_WITH(DOWN-exec-prefix,[ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)],
41 DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
42
43 if test x$DOWN[]_config_exec_prefix != x ; then
44 DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
45 if test x${UP[]_CONFIG+set} != xset ; then
46 UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
47 fi
48 fi
49 if test x$DOWN[]_config_prefix != x ; then
50 DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
51 if test x${UP[]_CONFIG+set} != xset ; then
52 UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
53 fi
54 fi
55
56 AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no)
57 ifelse([$2], ,
58 AC_MSG_CHECKING(for $1),
59 AC_MSG_CHECKING(for $1 - version >= $2)
60 )
61 no_[]DOWN=""
62 if test "$UP[]_CONFIG" = "no" ; then
63 no_[]DOWN=yes
64 else
65 UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
66 UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
67 ifelse([$2], , ,[
68 DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \
69 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
70 DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \
71 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
72 DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \
73 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
74 DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])"
75 DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])"
76 DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])"
77
78 # Compare wanted version to what config script returned.
79 # If I knew what library was being run, i'd probably also compile
80 # a test program at this point (which also extracted and tested
81 # the version in some library-specific way)
82 if test "$DOWN[]_config_major_version" -lt \
83 "$DOWN[]_wanted_major_version" \
84 -o \( "$DOWN[]_config_major_version" -eq \
85 "$DOWN[]_wanted_major_version" \
86 -a "$DOWN[]_config_minor_version" -lt \
87 "$DOWN[]_wanted_minor_version" \) \
88 -o \( "$DOWN[]_config_major_version" -eq \
89 "$DOWN[]_wanted_major_version" \
90 -a "$DOWN[]_config_minor_version" -eq \
91 "$DOWN[]_wanted_minor_version" \
92 -a "$DOWN[]_config_micro_version" -lt \
93 "$DOWN[]_wanted_micro_version" \) ; then
94 # older version found
95 no_[]DOWN=yes
96 echo -n "*** An old version of $1 "
97 echo -n "($DOWN[]_config_major_version"
98 echo -n ".$DOWN[]_config_minor_version"
99 echo ".$DOWN[]_config_micro_version) was found."
100 echo -n "*** You need a version of $1 newer than "
101 echo -n "$DOWN[]_wanted_major_version"
102 echo -n ".$DOWN[]_wanted_minor_version"
103 echo ".$DOWN[]_wanted_micro_version."
104 echo "***"
105 echo "*** If you have already installed a sufficiently new version, this error"
106 echo "*** probably means that the wrong copy of the DOWN-config shell script is"
107 echo "*** being found. The easiest way to fix this is to remove the old version"
108 echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the"
109 echo "*** correct copy of DOWN-config. (In this case, you will have to"
110 echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf"
111 echo "*** so that the correct libraries are found at run-time)"
112 fi
113 ])
114 fi
115 if test "x$no_[]DOWN" = x ; then
116 AC_MSG_RESULT(yes)
117 ifelse([$3], , :, [$3])
118 else
119 AC_MSG_RESULT(no)
120 if test "$UP[]_CONFIG" = "no" ; then
121 echo "*** The DOWN-config script installed by $1 could not be found"
122 echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in"
123 echo "*** your path, or set the UP[]_CONFIG environment variable to the"
124 echo "*** full path to DOWN-config."
125 fi
126 UP[]_CFLAGS=""
127 UP[]_LIBS=""
128 ifelse([$4], , :, [$4])
129 fi
130 AC_SUBST(UP[]_CFLAGS)
131 AC_SUBST(UP[]_LIBS)
132
133 popdef([UP])
134 popdef([DOWN])
135])
136