• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl acinclude.m4. Change *this* file to add new or change macros.
2dnl When changes have been made, delete aclocal.m4 and run
3dnl "aclocal".
4dnl
5dnl DO NOT change aclocal.m4 !
6dnl
7
8dnl * LA_SEARCH_FILE(variable, filename, PATH)
9dnl * Search "filename" in the specified "PATH", "variable" will
10dnl * contain the full pathname or the empty string
11dnl * PATH is space-separated list of directories.
12dnl * by Florian Bomers
13
14AC_DEFUN([LA_SEARCH_FILE],[
15  $1=
16  dnl hack: eliminate line feeds in $2
17  for FILE in $2; do
18    for DIR in $3; do
19      dnl use PATH in order
20      if test ".$1"="." && test -f "$DIR/$FILE"; then
21        $1=$DIR
22      fi
23    done
24  done
25])
26
27dnl * LA_SEARCH_LIB(lib-variable, include-variable, lib-filename, header-filename, prefix)
28dnl * looks for "lib-filename" and "header-filename" in the area of "prefix".
29dnl * if found, "lib-variable" and "include-variable" are set to the
30dnl * respective paths.
31dnl * prefix is a single path
32dnl * libs are searched in prefix, prefix/lib, prefix/.., prefix/../lib
33dnl * headers are searched in prefix, prefix/include, prefix/.., prefix/../include
34dnl *
35dnl * If one of them is not found, both "lib-variable", "include-variable" are
36dnl * set to the empty string.
37dnl *
38dnl * TODO: assert function call to verify lib
39dnl *
40dnl * by Florian Bomers
41
42AC_DEFUN([LA_SEARCH_LIB],[
43  dnl look for lib
44  LA_SEARCH_FILE($1, $3, $5 $5/lib $5/.. $5/../lib)
45  dnl look for header.
46  LA_SEARCH_FILE($2, $4, $5 $5/include $5/.. $5/../include)
47  if test ".$1" = "." || test ".$2" = "."; then
48    $1=
49    $2=
50  fi
51])
52
53
54
55
56# alex_IEEE854_FLOAT80
57# ------------
58AC_DEFUN([alex_IEEE854_FLOAT80],
59[AC_CACHE_CHECK(for IEEE854 compliant 80 bit floats, alex_cv_ieee854_float80,
60[AC_TRY_RUN([
61int   float2long_IEEE_compliance ( void )
62{
63    struct {
64        long padding; /* to prevent unaligned access */
65        float  f;
66    } s;
67    s.f = 12582912.; if ( *(long*)(&s.f) != 1262485504l ) return 0;
68    s.f = 12615679.; if ( *(long*)(&s.f) != 1262518271l ) return 0;
69    s.f = 13582912.; if ( *(long*)(&s.f) != 1263485504l ) return 0;
70    s.f = 12550145.; if ( *(long*)(&s.f) != 1262452737l ) return 0;
71    s.f = 11582912.; if ( *(long*)(&s.f) != 1261485504l ) return 0;
72    return 1;
73}
74
75int main(void)
76{
77    int retval;
78
79    retval = float2long_IEEE_compliance();
80
81    /* no error return -> success */
82    return !retval;
83}
84], alex_cv_ieee854_float80=yes, alex_cv_ieee854_float80=no,
85[AC_MSG_WARN(can't check for IEEE854 compliant 80 bit floats)]
86)])]) # alex_IEEE854_FLOAT80
87
88# Configure paths for GTK+
89# Owen Taylor     97-11-3
90
91dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
92dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
93dnl
94AC_DEFUN([AM_PATH_GTK],
95[dnl
96dnl Get the cflags and libraries from the gtk-config script
97dnl
98AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
99            gtk_config_prefix="$withval", gtk_config_prefix="")
100AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
101            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
102AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
103        , enable_gtktest=yes)
104
105  for module in . $4
106  do
107      case "$module" in
108         gthread)
109             gtk_config_args="$gtk_config_args gthread"
110         ;;
111      esac
112  done
113
114  if test x$gtk_config_exec_prefix != x ; then
115     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
116     if test x${GTK_CONFIG+set} != xset ; then
117        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
118     fi
119  fi
120  if test x$gtk_config_prefix != x ; then
121     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
122     if test x${GTK_CONFIG+set} != xset ; then
123        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
124     fi
125  fi
126
127  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
128  min_gtk_version=ifelse([$1], ,0.99.7,$1)
129  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
130  no_gtk=""
131  if test "$GTK_CONFIG" = "no" ; then
132    no_gtk=yes
133  else
134    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
135    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
136    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
137           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
138    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
139           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
140    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
141           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
142    if test "x$enable_gtktest" = "xyes" ; then
143      ac_save_CFLAGS="$CFLAGS"
144      ac_save_LIBS="$LIBS"
145      CFLAGS="$CFLAGS $GTK_CFLAGS"
146      LIBS="$GTK_LIBS $LIBS"
147dnl
148dnl Now check if the installed GTK is sufficiently new. (Also sanity
149dnl checks the results of gtk-config to some extent
150dnl
151      rm -f conf.gtktest
152      AC_TRY_RUN([
153#include <gtk/gtk.h>
154#include <stdio.h>
155#include <stdlib.h>
156
157int
158main ()
159{
160  int major, minor, micro;
161  char *tmp_version;
162
163  system ("touch conf.gtktest");
164
165  /* HP/UX 9 (%@#!) writes to sscanf strings */
166  tmp_version = g_strdup("$min_gtk_version");
167  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
168     printf("%s, bad version string\n", "$min_gtk_version");
169     exit(1);
170   }
171
172  if ((gtk_major_version != $gtk_config_major_version) ||
173      (gtk_minor_version != $gtk_config_minor_version) ||
174      (gtk_micro_version != $gtk_config_micro_version))
175    {
176      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
177             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
178             gtk_major_version, gtk_minor_version, gtk_micro_version);
179      printf ("*** was found! If gtk-config was correct, then it is best\n");
180      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
181      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
182      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
183      printf("*** required on your system.\n");
184      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
185      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
186      printf("*** before re-running configure\n");
187    }
188#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
189  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
190     (gtk_minor_version != GTK_MINOR_VERSION) ||
191           (gtk_micro_version != GTK_MICRO_VERSION))
192    {
193      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
194       GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
195      printf("*** library (version %d.%d.%d)\n",
196       gtk_major_version, gtk_minor_version, gtk_micro_version);
197    }
198#endif /* defined (GTK_MAJOR_VERSION) ... */
199  else
200    {
201      if ((gtk_major_version > major) ||
202        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
203        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
204      {
205        return 0;
206       }
207     else
208      {
209        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
210               gtk_major_version, gtk_minor_version, gtk_micro_version);
211        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
212         major, minor, micro);
213        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
214        printf("***\n");
215        printf("*** If you have already installed a sufficiently new version, this error\n");
216        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
217        printf("*** being found. The easiest way to fix this is to remove the old version\n");
218        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
219        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
220        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
221        printf("*** so that the correct libraries are found at run-time))\n");
222      }
223    }
224  return 1;
225}
226],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
227       CFLAGS="$ac_save_CFLAGS"
228       LIBS="$ac_save_LIBS"
229     fi
230  fi
231  if test "x$no_gtk" = x ; then
232     AC_MSG_RESULT(yes)
233     ifelse([$2], , :, [$2])
234  else
235     AC_MSG_RESULT(no)
236     if test "$GTK_CONFIG" = "no" ; then
237       echo "*** The gtk-config script installed by GTK could not be found"
238       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
239       echo "*** your path, or set the GTK_CONFIG environment variable to the"
240       echo "*** full path to gtk-config."
241     else
242       if test -f conf.gtktest ; then
243        :
244       else
245          echo "*** Could not run GTK test program, checking why..."
246          CFLAGS="$CFLAGS $GTK_CFLAGS"
247          LIBS="$LIBS $GTK_LIBS"
248          AC_TRY_LINK([
249#include <gtk/gtk.h>
250#include <stdio.h>
251],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
252        [ echo "*** The test program compiled, but did not run. This usually means"
253          echo "*** that the run-time linker is not finding GTK or finding the wrong"
254          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
255          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
256          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
257          echo "*** is required on your system"
258    echo "***"
259          echo "*** If you have an old version installed, it is best to remove it, although"
260          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
261          echo "***"
262          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
263          echo "*** came with the system with the command"
264          echo "***"
265          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
266        [ echo "*** The test program failed to compile or link. See the file config.log for the"
267          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
268          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
269          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
270          CFLAGS="$ac_save_CFLAGS"
271          LIBS="$ac_save_LIBS"
272       fi
273     fi
274     GTK_CFLAGS=""
275     GTK_LIBS=""
276     ifelse([$3], , :, [$3])
277  fi
278  AC_SUBST(GTK_CFLAGS)
279  AC_SUBST(GTK_LIBS)
280  rm -f conf.gtktest
281])
282