]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/libsdl/libsdl-qpe-1.2.7/acinclude.m4
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / libsdl / libsdl-qpe-1.2.7 / acinclude.m4
1 # Local macros for the SDL configure.in script
2
3 dnl Function to link an architecture specific file
4 dnl LINK_ARCH_SRC(source_dir, arch, source_file)
5 AC_DEFUN([COPY_ARCH_SRC],
6 [
7   old="$srcdir/$1/$2/$3"
8   new="$1/$3"
9   if test ! -d $1; then
10     echo "Creating directory $1"
11     mkdir -p $1
12   fi
13   echo "Copying $old -> $new"
14   cat >$new <<__EOF__
15 /* WARNING:  This file was automatically generated!
16  * Original: $old
17  */
18 __EOF__
19   cat >>$new <$old
20 ])
21
22 #
23 # --- esd.m4 ---
24 #
25 # Configure paths for ESD
26 # Manish Singh    98-9-30
27 # stolen back from Frank Belew
28 # stolen from Manish Singh
29 # Shamelessly stolen from Owen Taylor
30
31 dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
32 dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
33 dnl
34 AC_DEFUN([AM_PATH_ESD],
35 [dnl 
36 dnl Get the cflags and libraries from the esd-config script
37 dnl
38 AC_ARG_WITH(esd-prefix,[  --with-esd-prefix=PFX   Prefix where ESD is installed (optional)],
39             esd_prefix="$withval", esd_prefix="")
40 AC_ARG_WITH(esd-exec-prefix,[  --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
41             esd_exec_prefix="$withval", esd_exec_prefix="")
42 AC_ARG_ENABLE(esdtest, [  --disable-esdtest       Do not try to compile and run a test ESD program],
43                     , enable_esdtest=yes)
44
45   if test x$esd_exec_prefix != x ; then
46      esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
47      if test x${ESD_CONFIG+set} != xset ; then
48         ESD_CONFIG=$esd_exec_prefix/bin/esd-config
49      fi
50   fi
51   if test x$esd_prefix != x ; then
52      esd_args="$esd_args --prefix=$esd_prefix"
53      if test x${ESD_CONFIG+set} != xset ; then
54         ESD_CONFIG=$esd_prefix/bin/esd-config
55      fi
56   fi
57
58   AC_PATH_PROG(ESD_CONFIG, esd-config, no)
59   min_esd_version=ifelse([$1], ,0.2.7,$1)
60   AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
61   no_esd=""
62   if test "$ESD_CONFIG" = "no" ; then
63     no_esd=yes
64   else
65     ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
66     ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
67
68     esd_major_version=`$ESD_CONFIG $esd_args --version | \
69            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
70     esd_minor_version=`$ESD_CONFIG $esd_args --version | \
71            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
72     esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
73            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
74     if test "x$enable_esdtest" = "xyes" ; then
75       ac_save_CFLAGS="$CFLAGS"
76       ac_save_LIBS="$LIBS"
77       CFLAGS="$CFLAGS $ESD_CFLAGS"
78       LIBS="$LIBS $ESD_LIBS"
79 dnl
80 dnl Now check if the installed ESD is sufficiently new. (Also sanity
81 dnl checks the results of esd-config to some extent
82 dnl
83       rm -f conf.esdtest
84       AC_TRY_RUN([
85 #include <stdio.h>
86 #include <stdlib.h>
87 #include <string.h>
88 #include <esd.h>
89
90 char*
91 my_strdup (char *str)
92 {
93   char *new_str;
94   
95   if (str)
96     {
97       new_str = malloc ((strlen (str) + 1) * sizeof(char));
98       strcpy (new_str, str);
99     }
100   else
101     new_str = NULL;
102   
103   return new_str;
104 }
105
106 int main ()
107 {
108   int major, minor, micro;
109   char *tmp_version;
110
111   system ("touch conf.esdtest");
112
113   /* HP/UX 9 (%@#!) writes to sscanf strings */
114   tmp_version = my_strdup("$min_esd_version");
115   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
116      printf("%s, bad version string\n", "$min_esd_version");
117      exit(1);
118    }
119
120    if (($esd_major_version > major) ||
121       (($esd_major_version == major) && ($esd_minor_version > minor)) ||
122       (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
123     {
124       return 0;
125     }
126   else
127     {
128       printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
129       printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
130       printf("*** best to upgrade to the required version.\n");
131       printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
132       printf("*** to point to the correct copy of esd-config, and remove the file\n");
133       printf("*** config.cache before re-running configure\n");
134       return 1;
135     }
136 }
137
138 ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
139        CFLAGS="$ac_save_CFLAGS"
140        LIBS="$ac_save_LIBS"
141      fi
142   fi
143   if test "x$no_esd" = x ; then
144      AC_MSG_RESULT(yes)
145      ifelse([$2], , :, [$2])     
146   else
147      AC_MSG_RESULT(no)
148      if test "$ESD_CONFIG" = "no" ; then
149        echo "*** The esd-config script installed by ESD could not be found"
150        echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
151        echo "*** your path, or set the ESD_CONFIG environment variable to the"
152        echo "*** full path to esd-config."
153      else
154        if test -f conf.esdtest ; then
155         :
156        else
157           echo "*** Could not run ESD test program, checking why..."
158           CFLAGS="$CFLAGS $ESD_CFLAGS"
159           LIBS="$LIBS $ESD_LIBS"
160           AC_TRY_LINK([
161 #include <stdio.h>
162 #include <esd.h>
163 ],      [ return 0; ],
164         [ echo "*** The test program compiled, but did not run. This usually means"
165           echo "*** that the run-time linker is not finding ESD or finding the wrong"
166           echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
167           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
168           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
169           echo "*** is required on your system"
170           echo "***"
171           echo "*** If you have an old version installed, it is best to remove it, although"
172           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
173         [ echo "*** The test program failed to compile or link. See the file config.log for the"
174           echo "*** exact error that occured. This usually means ESD was incorrectly installed"
175           echo "*** or that you have moved ESD since it was installed. In the latter case, you"
176           echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
177           CFLAGS="$ac_save_CFLAGS"
178           LIBS="$ac_save_LIBS"
179        fi
180      fi
181      ESD_CFLAGS=""
182      ESD_LIBS=""
183      ifelse([$3], , :, [$3])
184   fi
185   AC_SUBST(ESD_CFLAGS)
186   AC_SUBST(ESD_LIBS)
187   rm -f conf.esdtest
188 ])
189