summaryrefslogtreecommitdiff
path: root/m4/ac_path_generic.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/ac_path_generic.m4')
-rw-r--r--m4/ac_path_generic.m4137
1 files changed, 0 insertions, 137 deletions
diff --git a/m4/ac_path_generic.m4 b/m4/ac_path_generic.m4
deleted file mode 100644
index d427241..0000000
--- a/m4/ac_path_generic.m4
+++ /dev/null
@@ -1,137 +0,0 @@
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,
39 [ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)],
40 DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
41AC_ARG_WITH(DOWN-exec-prefix,
42 [ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)],
43 DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
44
45 if test x$DOWN[]_config_exec_prefix != x ; then
46 DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
47 if test x${UP[]_CONFIG+set} != xset ; then
48 UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
49 fi
50 fi
51 if test x$DOWN[]_config_prefix != x ; then
52 DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
53 if test x${UP[]_CONFIG+set} != xset ; then
54 UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
55 fi
56 fi
57
58 AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no)
59 ifelse([$2], ,
60 AC_MSG_CHECKING(for $1),
61 AC_MSG_CHECKING(for $1 - version >= $2)
62 )
63 no_[]DOWN=""
64 if test "$UP[]_CONFIG" = "no" ; then
65 no_[]DOWN=yes
66 else
67 UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
68 UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
69 ifelse([$2], , ,[
70 DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \
71 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
72 DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \
73 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
74 DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \
75 --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
76 DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])"
77 DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])"
78 DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])"
79
80 # Compare wanted version to what config script returned.
81 # If I knew what library was being run, i'd probably also compile
82 # a test program at this point (which also extracted and tested
83 # the version in some library-specific way)
84 if test "$DOWN[]_config_major_version" -lt \
85 "$DOWN[]_wanted_major_version" \
86 -o \( "$DOWN[]_config_major_version" -eq \
87 "$DOWN[]_wanted_major_version" \
88 -a "$DOWN[]_config_minor_version" -lt \
89 "$DOWN[]_wanted_minor_version" \) \
90 -o \( "$DOWN[]_config_major_version" -eq \
91 "$DOWN[]_wanted_major_version" \
92 -a "$DOWN[]_config_minor_version" -eq \
93 "$DOWN[]_wanted_minor_version" \
94 -a "$DOWN[]_config_micro_version" -lt \
95 "$DOWN[]_wanted_micro_version" \) ; then
96 # older version found
97 no_[]DOWN=yes
98 echo -n "*** An old version of $1 "
99 echo -n "($DOWN[]_config_major_version"
100 echo -n ".$DOWN[]_config_minor_version"
101 echo ".$DOWN[]_config_micro_version) was found."
102 echo -n "*** You need a version of $1 newer than "
103 echo -n "$DOWN[]_wanted_major_version"
104 echo -n ".$DOWN[]_wanted_minor_version"
105 echo ".$DOWN[]_wanted_micro_version."
106 echo "***"
107 echo "*** If you have already installed a sufficiently new version, this error"
108 echo "*** probably means that the wrong copy of the DOWN-config shell script is"
109 echo "*** being found. The easiest way to fix this is to remove the old version"
110 echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the"
111 echo "*** correct copy of DOWN-config. (In this case, you will have to"
112 echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf"
113 echo "*** so that the correct libraries are found at run-time)"
114 fi
115 ])
116 fi
117 if test "x$no_[]DOWN" = x ; then
118 AC_MSG_RESULT(yes)
119 ifelse([$3], , :, [$3])
120 else
121 AC_MSG_RESULT(no)
122 if test "$UP[]_CONFIG" = "no" ; then
123 echo "*** The DOWN-config script installed by $1 could not be found"
124 echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in"
125 echo "*** your path, or set the UP[]_CONFIG environment variable to the"
126 echo "*** full path to DOWN-config."
127 fi
128 UP[]_CFLAGS=""
129 UP[]_LIBS=""
130 ifelse([$4], , :, [$4])
131 fi
132 AC_SUBST(UP[]_CFLAGS)
133 AC_SUBST(UP[]_LIBS)
134
135 popdef([UP])
136 popdef([DOWN])
137])