]>
Commit | Line | Data |
---|---|---|
a728ae5d JB |
1 | --- autotrace-0.31.1/acinclude.m4.orig Thu Jan 1 01:00:00 1970 |
2 | +++ autotrace-0.31.1/acinclude.m4 Wed Dec 18 22:37:33 2002 | |
3 | @@ -0,0 +1,160 @@ | |
4 | +# a macro to get the libs/cflags for libpstoedit | |
5 | +# Copyed from gdk-pixbuf.m4 | |
6 | + | |
7 | +dnl AM_PATH_PSTOEDIT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
8 | +dnl Test to see if libpstoedit is installed, and define PSTOEDIT_CFLAGS, LIBS | |
9 | +dnl | |
10 | +AC_DEFUN(AM_PATH_PSTOEDIT, | |
11 | +[dnl | |
12 | +dnl Get the cflags and libraries from the pstoedit-config script | |
13 | +dnl | |
14 | +AC_ARG_WITH(pstoedit-prefix,[ --with-pstoedit-prefix=PFX Prefix where Pstoedit is installed (optional)], | |
15 | + pstoedit_prefix="$withval", pstoedit_prefix="") | |
16 | +AC_ARG_WITH(pstoedit-exec-prefix,[ --with-pstoedit-exec-prefix=PFX Exec prefix where Pstoedit is installed (optional)], | |
17 | + pstoedit_exec_prefix="$withval", pstoedit_exec_prefix="") | |
18 | +AC_ARG_ENABLE(pstoedittest, [ --disable-pstoedittest Do not try to compile and run a test Pstoedit program], | |
19 | + , enable_pstoedittest=yes) | |
20 | + | |
21 | + if test x$pstoedit_exec_prefix != x ; then | |
22 | + pstoedit_args="$pstoedit_args --exec_prefix=$pstoedit_exec_prefix" | |
23 | + if test x${PSTOEDIT_CONFIG+set} != xset ; then | |
24 | + PSTOEDIT_CONFIG=$pstoedit_exec_prefix/bin/pstoedit-config | |
25 | + fi | |
26 | + fi | |
27 | + if test x$pstoedit_prefix != x ; then | |
28 | + pstoedit_args="$pstoedit_args --prefix=$pstoedit_prefix" | |
29 | + if test x${PSTOEDIT_CONFIG+set} != xset ; then | |
30 | + PSTOEDIT_CONFIG=$pstoedit_prefix/bin/pstoedit-config | |
31 | + fi | |
32 | + fi | |
33 | + | |
34 | + AC_PATH_PROG(PSTOEDIT_CONFIG, pstoedit-config, no) | |
35 | + min_pstoedit_version=ifelse([$1], ,3.32.0,$1) | |
36 | + AC_MSG_CHECKING(for PSTOEDIT - version >= $min_pstoedit_version) | |
37 | + no_pstoedit="" | |
38 | + if test "$PSTOEDIT_CONFIG" = "no" ; then | |
39 | + no_pstoedit=yes | |
40 | + else | |
41 | + PSTOEDIT_CFLAGS=`$PSTOEDIT_CONFIG $pstoedit_args --cflags` | |
42 | + PSTOEDIT_LIBS=`$PSTOEDIT_CONFIG $pstoedit_args --libs` | |
43 | + | |
44 | + pstoedit_major_version=`$PSTOEDIT_CONFIG $pstoedit_args --version | \ | |
45 | + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
46 | + pstoedit_minor_version=`$PSTOEDIT_CONFIG $pstoedit_args --version | \ | |
47 | + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
48 | + pstoedit_micro_version=`$PSTOEDIT_CONFIG $pstoedit_args --version | \ | |
49 | + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
50 | + if test "x$enable_pstoedittest" = "xyes" ; then | |
51 | + ac_save_CFLAGS="$CFLAGS" | |
52 | + ac_save_LIBS="$LIBS" | |
53 | + CFLAGS="$CFLAGS $PSTOEDIT_CFLAGS" | |
54 | + LIBS="$PSTOEDIT_LIBS $LIBS" | |
55 | +dnl | |
56 | +dnl Now check if the installed PSTOEDIT is sufficiently new. (Also sanity | |
57 | +dnl checks the results of pstoedit-config to some extent | |
58 | +dnl | |
59 | + rm -f conf.pstoedittest | |
60 | + AC_TRY_RUN([ | |
61 | +#include <stdio.h> | |
62 | +#include <stdlib.h> | |
63 | +#include <string.h> | |
64 | +#include <pstoedit/pstoedit.h> | |
65 | + | |
66 | +char* | |
67 | +my_strdup (char *str) | |
68 | +{ | |
69 | + char *new_str; | |
70 | + | |
71 | + if (str) | |
72 | + { | |
73 | + new_str = malloc ((strlen (str) + 1) * sizeof(char)); | |
74 | + strcpy (new_str, str); | |
75 | + } | |
76 | + else | |
77 | + new_str = NULL; | |
78 | + | |
79 | + return new_str; | |
80 | +} | |
81 | + | |
82 | +int main () | |
83 | +{ | |
84 | + int major, minor, micro; | |
85 | + char *tmp_version; | |
86 | + | |
87 | + system ("touch conf.pstoedittest"); | |
88 | + | |
89 | + /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
90 | + tmp_version = my_strdup("$min_pstoedit_version"); | |
91 | + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
92 | + printf("%s, bad version string\n", "$min_pstoedit_version"); | |
93 | + exit(1); | |
94 | + } | |
95 | + | |
96 | + if (($pstoedit_major_version > major) || | |
97 | + (($pstoedit_major_version == major) && ($pstoedit_minor_version > minor)) || | |
98 | + (($pstoedit_major_version == major) && ($pstoedit_minor_version == minor) && ($pstoedit_micro_version >= micro))) | |
99 | + { | |
100 | + return 0; | |
101 | + } | |
102 | + else | |
103 | + { | |
104 | + printf("\n*** 'pstoedit-config --version' returned %d.%d.%d, but the minimum version\n", $pstoedit_major_version, $pstoedit_minor_version, $pstoedit_micro_version); | |
105 | + printf("*** of PSTOEDIT required is %d.%d.%d. If pstoedit-config is correct, then it is\n", major, minor, micro); | |
106 | + printf("*** best to upgrade to the required version.\n"); | |
107 | + printf("*** If pstoedit-config was wrong, set the environment variable PSTOEDIT_CONFIG\n"); | |
108 | + printf("*** to point to the correct copy of pstoedit-config, and remove the file\n"); | |
109 | + printf("*** config.cache before re-running configure\n"); | |
110 | + return 1; | |
111 | + } | |
112 | +} | |
113 | +],, no_pstoedit=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
114 | + CFLAGS="$ac_save_CFLAGS" | |
115 | + LIBS="$ac_save_LIBS" | |
116 | + fi | |
117 | + fi | |
118 | + if test "x$no_pstoedit" = x ; then | |
119 | + AC_MSG_RESULT(yes) | |
120 | + ifelse([$2], , :, [$2]) | |
121 | + else | |
122 | + AC_MSG_RESULT(no) | |
123 | + if test "$PSTOEDIT_CONFIG" = "no" ; then | |
124 | + echo "*** The pstoedit-config script installed by PSTOEDIT could not be found" | |
125 | + echo "*** If PSTOEDIT was installed in PREFIX, make sure PREFIX/bin is in" | |
126 | + echo "*** your path, or set the PSTOEDIT_CONFIG environment variable to the" | |
127 | + echo "*** full path to pstoedit-config." | |
128 | + else | |
129 | + if test -f conf.pstoedittest ; then | |
130 | + : | |
131 | + else | |
132 | + echo "*** Could not run PSTOEDIT test program, checking why..." | |
133 | + CFLAGS="$CFLAGS $PSTOEDIT_CFLAGS" | |
134 | + LIBS="$LIBS $PSTOEDIT_LIBS" | |
135 | + AC_TRY_LINK([ | |
136 | +#include <stdio.h> | |
137 | +#include <pstoedit/pstoedit.h> | |
138 | +], [ return 0; ], | |
139 | + [ echo "*** The test program compiled, but did not run. This usually means" | |
140 | + echo "*** that the run-time linker is not finding PSTOEDIT or finding the wrong" | |
141 | + echo "*** version of PSTOEDIT. If it is not finding PSTOEDIT, you'll need to set your" | |
142 | + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
143 | + echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
144 | + echo "*** is required on your system" | |
145 | + echo "***" | |
146 | + echo "*** If you have an old version installed, it is best to remove it, although" | |
147 | + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |
148 | + [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
149 | + echo "*** exact error that occured. This usually means PSTOEDIT was incorrectly installed" | |
150 | + echo "*** or that you have moved PSTOEDIT since it was installed. In the latter case, you" | |
151 | + echo "*** may want to edit the pstoedit-config script: $PSTOEDIT_CONFIG" ]) | |
152 | + CFLAGS="$ac_save_CFLAGS" | |
153 | + LIBS="$ac_save_LIBS" | |
154 | + fi | |
155 | + fi | |
156 | + PSTOEDIT_CFLAGS="" | |
157 | + PSTOEDIT_LIBS="" | |
158 | + ifelse([$3], , :, [$3]) | |
159 | + fi | |
160 | + AC_SUBST(PSTOEDIT_CFLAGS) | |
161 | + AC_SUBST(PSTOEDIT_LIBS) | |
162 | + rm -f conf.pstoedittest | |
163 | +]) |