OSDN Git Service

TiMidity++-2.11.2
[timidity41/timidity41.git] / aclocal.m4
1 # aclocal.m4 generated automatically by aclocal 1.5
2
3 # Copyright 1996, 1997, 1998, 1999, 2000, 2001
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 dnl TiMidity++ -- MIDI to WAVE converter and player
15 dnl Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
16 dnl Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
17 dnl 
18 dnl This program is free software; you can redistribute it and/or modify
19 dnl it under the terms of the GNU General Public License as published by
20 dnl the Free Software Foundation; either version 2 of the License, or
21 dnl (at your option) any later version.
22 dnl 
23 dnl This program is distributed in the hope that it will be useful,
24 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
25 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 dnl GNU General Public License for more details.
27 dnl 
28 dnl You should have received a copy of the GNU General Public License
29 dnl along with this program; if not, write to the Free Software
30 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
32 dnl MY_DEFINE(VARIABLE)
33 AC_DEFUN(MY_DEFINE,
34 [cat >> confdefs.h <<EOF
35 [#define] $1 1
36 EOF
37 ])
38
39 dnl CONFIG_INTERFACE(package,macro_name,interface_id,help
40 dnl                  $1      $2         $3           $4
41 dnl                  action-if-yes-or-dynamic,
42 dnl                  $5
43 dnl                  action-if-yes,action-if-dynamic,action-if-no)
44 dnl                  $6            $7                $8
45 AC_DEFUN(CONFIG_INTERFACE,
46 [AC_ARG_ENABLE($1,[$4],
47 [case "x$enable_$1" in xyes|xdynamic) $5 ;; esac])
48 case "x$enable_$1" in
49 xyes)
50   MY_DEFINE(IA_$2)
51   AM_CONDITIONAL(ENABLE_$2, true)
52   $6
53   ;;
54 xdynamic)
55   dynamic_targets="$dynamic_targets interface_$3.\$(so)"
56   $7
57   ;;
58 *)
59   $8
60   ;;
61 esac
62 AC_SUBST($3_so_libs)
63 ])
64
65
66 dnl alsa.m4 starts form here
67 dnl Configure Paths for Alsa
68 dnl Christopher Lansdown (lansdoct@cs.alfred.edu)
69 dnl 29/10/1998
70 dnl modified for TiMidity++ by Isaku Yamahata(yamahata@kusm.kyoto-u.ac.jp)
71 dnl 16/12/1998
72 dnl AM_PATH_ALSA_LOCAL(MINIMUM-VERSION)
73 dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
74 dnl if there exit ALSA, define have_alsa=yes, otherwise no.
75 dnl enables arguments --with-alsa-prefix= --with-alsa-enc-prefix= --disable-alsatest
76 dnl
77 AC_DEFUN(AM_PATH_ALSA_LOCAL,
78 [dnl
79 dnl Get the clfags and libraries for alsa
80 dnl
81 have_alsa=no
82 AC_ARG_WITH(alsa-prefix,[  --with-alsa-prefix=PFX  Prefix where Alsa library is installed(optional)],
83         [alsa_prefix="$withval"], [alsa_prefix=""])
84 AC_ARG_WITH(alsa-inc-prefix, [  --with-alsa-inc-prefix=PFX  Prefix where include libraries are (optional)],
85         [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
86 AC_ARG_ENABLE(alsatest, [  --disable-alsatest      Do not try to compile and run a test Alsa program], [enable_alsatest=no], [enable_alsatest=yes])
87
88 dnl Add any special include directories
89 AC_MSG_CHECKING(for ALSA CFLAGS)
90 if test "$alsa_inc_prefix" != "" ; then
91         ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
92         CFLAGS="$CFLAGS -I$alsa_inc_prefix"
93 fi
94 AC_MSG_RESULT($ALSA_CFLAGS)
95
96 dnl add any special lib dirs
97 AC_MSG_CHECKING(for ALSA LDFLAGS)
98 if test "$alsa_prefix" != "" ; then
99         ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
100         LIBS="-L$alsa_prefix"
101 fi
102
103 dnl add the alsa library
104 ALSA_LIBS="$ALSA_LIBS -lasound"
105 AC_MSG_RESULT($ALSA_LIBS)
106
107 dnl Check for the presence of the library
108 dnl if test $enable_alsatest = yes; then
109 dnl   AC_MSG_CHECKING(for working libasound)
110 dnl   KEEP_LDFLAGS="$LDFLAGS"
111 dnl   LDFLAGS="$LDFLAGS $ALSA_LIBS"
112 dnl   AC_TRY_RUN([
113 dnl #include <sys/asoundlib.h>
114 dnl void main(void)
115 dnl {
116 dnl   snd_cards();
117 dnl   exit(0);
118 dnl }
119 dnl ],
120 dnl    [AC_MSG_RESULT("present")],
121 dnl    [AC_MSG_RESULT("not found. ")
122 dnl    AC_MSG_ERROR(Fatal error: Install alsa-lib package or use --with-alsa-prefix option...)],
123 dnl    [AC_MSG_RESULT(unsopported)
124 dnl     AC_MSG_ERROR(Cross-compiling isn't supported...)]
125 dnl  )
126 dnl   LDFLAGS="$KEEP_LDFLAGS"
127 dnl fi
128
129 dnl Check for a working version of libasound that is of the right version.
130 min_alsa_version=ifelse([$1], ,0.1.1,$1)
131 AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
132 no_alsa=""
133     alsa_min_major_version=`echo $min_alsa_version | \
134            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
135     alsa_min_minor_version=`echo $min_alsa_version | \
136            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
137     alsa_min_micro_version=`echo $min_alsa_version | \
138            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
139
140 AC_TRY_COMPILE([
141 #include <sys/asoundlib.h>
142 ], [
143 /* ensure backward compatibility */
144 #if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
145 #define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
146 #endif
147 #if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
148 #define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
149 #endif
150 #if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
151 #define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
152 #endif
153
154 #  if(SND_LIB_MAJOR > $alsa_min_major_version)
155   exit(0);
156 #  else
157 #    if(SND_LIB_MAJOR < $alsa_min_major_version)
158 #       error not present
159 #    endif
160
161 #   if(SND_LIB_MINOR > $alsa_min_minor_version)
162   exit(0);
163 #   else
164 #     if(SND_LIB_MINOR < $alsa_min_minor_version)
165 #          error not present
166 #      endif
167
168 #      if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
169 #        error not present
170 #      endif
171 #    endif
172 #  endif
173 exit(0);
174 ],
175   [AC_MSG_RESULT(found.)
176    have_alsa=yes],
177   [AC_MSG_RESULT(not present.)]
178 )
179
180 dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
181 AC_CHECK_LIB([asound], [snd_cards],,
182         [AC_MSG_RESULT(No linkable libasound was found.)]
183 )
184
185 dnl That should be it.  Now just export out symbols:
186 AC_SUBST(ALSA_CFLAGS)
187 AC_SUBST(ALSA_LIBS)
188 ])
189 dnl alsa.m4 ends here
190
191 # Configure paths for ESD
192 # Manish Singh    98-9-30
193 # stolen back from Frank Belew
194 # stolen from Manish Singh
195 # Shamelessly stolen from Owen Taylor
196
197 dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
198 dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
199 dnl
200 AC_DEFUN(AM_PATH_ESD,
201 [dnl 
202 dnl Get the cflags and libraries from the esd-config script
203 dnl
204 AC_ARG_WITH(esd-prefix,[  --with-esd-prefix=PFX   Prefix where ESD is installed (optional)],
205             esd_prefix="$withval", esd_prefix="")
206 AC_ARG_WITH(esd-exec-prefix,[  --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
207             esd_exec_prefix="$withval", esd_exec_prefix="")
208 AC_ARG_ENABLE(esdtest, [  --disable-esdtest       Do not try to compile and run a test ESD program],
209                     , enable_esdtest=yes)
210
211   if test x$esd_exec_prefix != x ; then
212      esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
213      if test x${ESD_CONFIG+set} != xset ; then
214         ESD_CONFIG=$esd_exec_prefix/bin/esd-config
215      fi
216   fi
217   if test x$esd_prefix != x ; then
218      esd_args="$esd_args --prefix=$esd_prefix"
219      if test x${ESD_CONFIG+set} != xset ; then
220         ESD_CONFIG=$esd_prefix/bin/esd-config
221      fi
222   fi
223
224   AC_PATH_PROG(ESD_CONFIG, esd-config, no)
225   min_esd_version=ifelse([$1], ,0.2.7,$1)
226   AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
227   no_esd=""
228   if test "$ESD_CONFIG" = "no" ; then
229     no_esd=yes
230   else
231     ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
232     ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
233
234     esd_major_version=`$ESD_CONFIG $esd_args --version | \
235            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
236     esd_minor_version=`$ESD_CONFIG $esd_args --version | \
237            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
238     esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
239            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
240     if test "x$enable_esdtest" = "xyes" ; then
241       ac_save_CFLAGS="$CFLAGS"
242       ac_save_LIBS="$LIBS"
243       CFLAGS="$CFLAGS $ESD_CFLAGS"
244       LIBS="$LIBS $ESD_LIBS"
245 dnl
246 dnl Now check if the installed ESD is sufficiently new. (Also sanity
247 dnl checks the results of esd-config to some extent
248 dnl
249       rm -f conf.esdtest
250       AC_TRY_RUN([
251 #include <stdio.h>
252 #include <stdlib.h>
253 #include <string.h>
254 #include <esd.h>
255
256 char*
257 my_strdup (char *str)
258 {
259   char *new_str;
260   
261   if (str)
262     {
263       new_str = malloc ((strlen (str) + 1) * sizeof(char));
264       strcpy (new_str, str);
265     }
266   else
267     new_str = NULL;
268   
269   return new_str;
270 }
271
272 int main ()
273 {
274   int major, minor, micro;
275   char *tmp_version;
276
277   system ("touch conf.esdtest");
278
279   /* HP/UX 9 (%@#!) writes to sscanf strings */
280   tmp_version = my_strdup("$min_esd_version");
281   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
282      printf("%s, bad version string\n", "$min_esd_version");
283      exit(1);
284    }
285
286    if (($esd_major_version > major) ||
287       (($esd_major_version == major) && ($esd_minor_version > minor)) ||
288       (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
289     {
290       return 0;
291     }
292   else
293     {
294       printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
295       printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
296       printf("*** best to upgrade to the required version.\n");
297       printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
298       printf("*** to point to the correct copy of esd-config, and remove the file\n");
299       printf("*** config.cache before re-running configure\n");
300       return 1;
301     }
302 }
303
304 ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
305        CFLAGS="$ac_save_CFLAGS"
306        LIBS="$ac_save_LIBS"
307      fi
308   fi
309   if test "x$no_esd" = x ; then
310      AC_MSG_RESULT(yes)
311      ifelse([$2], , :, [$2])     
312   else
313      AC_MSG_RESULT(no)
314      if test "$ESD_CONFIG" = "no" ; then
315        echo "*** The esd-config script installed by ESD could not be found"
316        echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
317        echo "*** your path, or set the ESD_CONFIG environment variable to the"
318        echo "*** full path to esd-config."
319      else
320        if test -f conf.esdtest ; then
321         :
322        else
323           echo "*** Could not run ESD test program, checking why..."
324           CFLAGS="$CFLAGS $ESD_CFLAGS"
325           LIBS="$LIBS $ESD_LIBS"
326           AC_TRY_LINK([
327 #include <stdio.h>
328 #include <esd.h>
329 ],      [ return 0; ],
330         [ echo "*** The test program compiled, but did not run. This usually means"
331           echo "*** that the run-time linker is not finding ESD or finding the wrong"
332           echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
333           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
334           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
335           echo "*** is required on your system"
336           echo "***"
337           echo "*** If you have an old version installed, it is best to remove it, although"
338           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
339         [ echo "*** The test program failed to compile or link. See the file config.log for the"
340           echo "*** exact error that occured. This usually means ESD was incorrectly installed"
341           echo "*** or that you have moved ESD since it was installed. In the latter case, you"
342           echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
343           CFLAGS="$ac_save_CFLAGS"
344           LIBS="$ac_save_LIBS"
345        fi
346      fi
347      ESD_CFLAGS=""
348      ESD_LIBS=""
349      ifelse([$3], , :, [$3])
350   fi
351   AC_SUBST(ESD_CFLAGS)
352   AC_SUBST(ESD_LIBS)
353   rm -f conf.esdtest
354 ])
355
356 dnl CHECK_DLSYM_UNDERSCORE([ACTION-IF-NEED [, ACTION IF-NOT-NEED]])
357 dnl variable input:
358 dnl   CC CFLAGS CPPFLAGS LDFLAGS LIBS SHCFLAGS SHLD SHLDFLAGS
359 dnl   ac_cv_header_dlfcn_h lib_dl_opt so
360 AC_DEFUN(CHECK_DLSYM_UNDERSCORE,
361 [dnl Check if dlsym need a leading underscore
362 AC_MSG_CHECKING(whether your dlsym() needs a leading underscore)
363 AC_CACHE_VAL(timidity_cv_func_dlsym_underscore,
364 [case "$ac_cv_header_dlfcn_h" in
365 yes) i_dlfcn=define;;
366 *)   i_dlfcn=undef;;
367 esac
368 cat > dyna.c <<EOM
369 fred () { }
370 EOM
371
372 cat > fred.c <<EOM
373 #include <stdio.h>
374 #$i_dlfcn I_DLFCN
375 #ifdef I_DLFCN
376 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
377 #else
378 #include <sys/types.h>
379 #include <nlist.h>
380 #include <link.h>
381 #endif
382
383 extern int fred() ;
384
385 main()
386 {
387     void * handle ;
388     void * symbol ;
389 #ifndef RTLD_LAZY
390     int mode = 1 ;
391 #else
392     int mode = RTLD_LAZY ;
393 #endif
394     handle = dlopen("./dyna.$so", mode) ;
395     if (handle == NULL) {
396         printf ("1\n") ;
397         fflush (stdout) ;
398         exit(0);
399     }
400     symbol = dlsym(handle, "fred") ;
401     if (symbol == NULL) {
402         /* try putting a leading underscore */
403         symbol = dlsym(handle, "_fred") ;
404         if (symbol == NULL) {
405             printf ("2\n") ;
406             fflush (stdout) ;
407             exit(0);
408         }
409         printf ("3\n") ;
410     }
411     else
412         printf ("4\n") ;
413     fflush (stdout) ;
414     exit(0);
415 }
416 EOM
417 : Call the object file tmp-dyna.o in case dlext=o.
418 if ${CC-cc} $CFLAGS $SHCFLAGS $CPPFLAGS -c dyna.c > /dev/null 2>&1 &&
419         mv dyna.o tmp-dyna.o > /dev/null 2>&1 &&
420         $SHLD $SHLDFLAGS -o dyna.$so tmp-dyna.o > /dev/null 2>&1 &&
421         ${CC-cc} -o fred $CFLAGS $CPPFLAGS $LDFLAGS fred.c $LIBS $lib_dl_opt > /dev/null 2>&1; then
422         xxx=`./fred`
423         case $xxx in
424         1)      AC_MSG_WARN(Test program failed using dlopen.  Perhaps you should not use dynamic loading.)
425                 ;;
426         2)      AC_MSG_WARN(Test program failed using dlsym.  Perhaps you should not use dynamic loading.)
427                 ;;
428         3)      timidity_cv_func_dlsym_underscore=yes
429                 ;;
430         4)      timidity_cv_func_dlsym_underscore=no
431                 ;;
432         esac
433 else
434         AC_MSG_WARN(I can't compile and run the test program.)
435 fi
436 rm -f dyna.c dyna.o dyna.$so tmp-dyna.o fred.c fred.o fred
437 ])
438 case "x$timidity_cv_func_dlsym_underscore" in
439 xyes)   [$1]
440         AC_MSG_RESULT(yes)
441         ;;
442 xno)    [$2]
443         AC_MSG_RESULT(no)
444         ;;
445 esac
446 ])
447
448
449 dnl contains program from perl5
450 dnl CONTAINS_INIT()
451 AC_DEFUN(CONTAINS_INIT,
452 [dnl Some greps do not return status, grrr.
453 AC_MSG_CHECKING(whether grep returns status)
454 echo "grimblepritz" >grimble
455 if grep blurfldyick grimble >/dev/null 2>&1 ; then
456         contains="./contains"
457 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
458         contains=grep
459 else
460         contains="./contains"
461 fi
462 rm -f grimble
463 dnl the following should work in any shell
464 case "$contains" in
465 grep)   AC_MSG_RESULT(yes)
466         ;;
467 ./contains)
468         AC_MSG_RESULT(AGH!  Grep doesn't return a status.  Attempting remedial action.)
469         cat >./contains <<'EOSS'
470 grep "[$]1" "[$]2" >.greptmp && cat .greptmp && test -s .greptmp
471 EOSS
472         chmod +x "./contains"
473         ;;
474 esac
475 ])
476
477
478 dnl CONTAINS(word,filename,action-if-found,action-if-not-found)
479 AC_DEFUN(CONTAINS,
480 [if $contains "^[$1]"'[$]' $2 >/dev/null 2>&1; then
481   [$3]
482 else
483   [$4]
484 fi
485 ])
486
487
488 dnl SET_UNIQ_WORDS(shell-variable,words...)
489 AC_DEFUN(SET_UNIQ_WORDS,
490 [rm -f wordtmp >/dev/null 2>&1
491 val=''
492 for f in $2; do
493   CONTAINS([$f],wordtmp,:,[echo $f >>wordtmp; val="$val $f"])
494 done
495 $1="$val"
496 rm -f wordtmp >/dev/null 2>&1
497 ])
498
499
500 dnl WAPI_CHECK_FUNC(FUNCTION, INCLUDES, TEST-BODY,
501                     [ACTION-FI-FOUND [, ACTION-IF-NOT-FOUND]])
502 AC_DEFUN(WAPI_CHECK_FUNC,
503 [AC_MSG_CHECKING(for $1)
504 AC_CACHE_VAL(wapi_cv_func_$1,
505 [AC_TRY_LINK([#include <windows.h>
506 $2
507 ], [$3],
508 wapi_cv_func_$1=yes, wapi_cv_func_$1=no)])
509 if eval "test \"`echo '$wapi_cv_func_'$1`\" = yes"; then
510   AC_MSG_RESULT(yes)
511   ifelse([$4], , :, [$4])
512 else
513   AC_MSG_RESULT(no)
514 ifelse([$5], , , [$5
515 ])dnl
516 fi
517 ])
518
519
520 dnl WAPI_CHECK_LIB(LIBRARY, FUNCTION,
521 dnl             INCLUDES, TEST-BODY
522 dnl             [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
523 dnl             [, OTHER-LIBRARIES]]])
524 AC_DEFUN(WAPI_CHECK_LIB,
525 [AC_MSG_CHECKING([for $2 in -l$1])
526 ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
527 AC_CACHE_VAL(wapi_cv_lib_$ac_lib_var,
528 [ac_save_LIBS="$LIBS"
529 LIBS="-l$1 $7 $LIBS"
530 AC_TRY_LINK([#include <windows.h>
531 $3
532 ], [$4],
533 eval "wapi_cv_lib_$ac_lib_var=yes",
534 eval "wapi_cv_lib_$ac_lib_var=no")
535 LIBS="$ac_save_LIBS"
536 ])dnl
537 if eval "test \"`echo '$wapi_cv_lib_'$ac_lib_var`\" = yes"; then
538   AC_MSG_RESULT(yes)
539   ifelse([$5], ,LIBS="-l$1 $LIBS", [$5])
540 else
541   AC_MSG_RESULT(no)
542 ifelse([$6], , , [$6
543 ])dnl
544 fi
545 ])
546
547
548 dnl EXTRACT_CPPFLAGS(CPPFLAGS-to-append,others-to-append,FLAGS)
549 AC_DEFUN(EXTRACT_CPPFLAGS,
550 [for f in $3; do
551     case ".$f" in
552         .-I?*|.-D?*)    $1="[$]$1 $f" ;;
553         *)              $2="[$]$1 $f" ;;
554     esac
555 done
556 ])
557
558
559 dnl CHECK_COMPILER_OPTION(OPTIONS [, ACTION-IF-SUCCEED [, ACTION-IF-FAILED]])
560 AC_DEFUN(CHECK_COMPILER_OPTION,
561 [AC_MSG_CHECKING([whether -$1 option is recognized])
562 ac_ccoption=`echo $1 | sed 'y%./+-%__p_%'`
563 AC_CACHE_VAL(timidity_cv_ccoption_$ac_ccoption,
564 [cat > conftest.$ac_ext <<EOF
565 int main() {return 0;}
566 EOF
567 if ${CC-cc} $LDFLAGS $CFLAGS -o conftest${ac_exeext} -$1 conftest.$ac_ext > conftest.out 2>&1; then
568     if test -s conftest.out; then
569         eval "timidity_cv_ccoption_$ac_ccoption=no"
570     else
571         eval "timidity_cv_ccoption_$ac_ccoption=yes"
572     fi
573 else
574     eval "timidity_cv_ccoption_$ac_ccoption=no"
575 fi
576 ])
577 if eval "test \"`echo '$timidity_cv_ccoption_'$ac_ccoption`\" = yes"; then
578   AC_MSG_RESULT(yes)
579   ifelse([$2], , , [$2
580 ])
581 else
582   AC_MSG_RESULT(no)
583 ifelse([$3], , , [$3
584 ])
585 fi
586 ])
587
588
589 dnl MY_SEARCH_LIBS(FUNCTION, LIBRARIES [, ACTION-IF-FOUND
590 dnl            [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
591 dnl Search for a library defining FUNC, if it's not already available.
592
593 AC_DEFUN(MY_SEARCH_LIBS,
594 [AC_CACHE_CHECK([for library containing $1], [timidity_cv_search_$1],
595 [ac_func_search_save_LIBS="$LIBS"
596 timidity_cv_search_$1="no"
597 for i in $2; do
598   LIBS="$i $5 $ac_func_search_save_LIBS"
599   AC_TRY_LINK_FUNC([$1], [timidity_cv_search_$1="$i"; break])
600 done
601 LIBS="$ac_func_search_save_LIBS"])
602 if test "$timidity_cv_search_$1" != "no"; then
603   $3
604 else :
605   $4
606 fi])
607
608
609 # beginning of gtk.m4
610 # Configure paths for GTK+
611 # Owen Taylor     97-11-3
612
613 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
614 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
615 dnl
616 AC_DEFUN(AM_PATH_GTK,
617 [dnl 
618 dnl Get the cflags and libraries from the gtk-config script
619 dnl
620 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
621             gtk_config_prefix="$withval", gtk_config_prefix="")
622 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
623             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
624 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
625                     , enable_gtktest=yes)
626
627   if test x$gtk_config_exec_prefix != x ; then
628      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
629      if test x${GTK_CONFIG+set} != xset ; then
630         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
631      fi
632   fi
633   if test x$gtk_config_prefix != x ; then
634      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
635      if test x${GTK_CONFIG+set} != xset ; then
636         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
637      fi
638   fi
639
640   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
641   min_gtk_version=ifelse([$1], ,0.99.7,$1)
642   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
643   no_gtk=""
644   if test "$GTK_CONFIG" = "no" ; then
645     no_gtk=yes
646   else
647     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
648     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
649     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
650            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
651     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
652            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
653     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
654            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
655     if test "x$enable_gtktest" = "xyes" ; then
656       ac_save_CFLAGS="$CFLAGS"
657       ac_save_LIBS="$LIBS"
658       CFLAGS="$CFLAGS $GTK_CFLAGS"
659       LIBS="$LIBS $GTK_LIBS"
660 dnl
661 dnl Now check if the installed GTK is sufficiently new. (Also sanity
662 dnl checks the results of gtk-config to some extent
663 dnl
664       rm -f conf.gtktest
665       AC_TRY_RUN([
666 #include <gtk/gtk.h>
667 #include <stdio.h>
668
669 int 
670 main ()
671 {
672   int major, minor, micro;
673   char *tmp_version;
674
675   system ("touch conf.gtktest");
676
677   /* HP/UX 9 (%@#!) writes to sscanf strings */
678   tmp_version = g_strdup("$min_gtk_version");
679   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
680      printf("%s, bad version string\n", "$min_gtk_version");
681      exit(1);
682    }
683
684   if ((gtk_major_version != $gtk_config_major_version) ||
685       (gtk_minor_version != $gtk_config_minor_version) ||
686       (gtk_micro_version != $gtk_config_micro_version))
687     {
688       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
689              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
690              gtk_major_version, gtk_minor_version, gtk_micro_version);
691       printf ("*** was found! If gtk-config was correct, then it is best\n");
692       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
693       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
694       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
695       printf("*** required on your system.\n");
696       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
697       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
698       printf("*** before re-running configure\n");
699     } 
700   else
701     {
702       if ((gtk_major_version > major) ||
703         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
704         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
705       {
706         return 0;
707        }
708      else
709       {
710         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
711                gtk_major_version, gtk_minor_version, gtk_micro_version);
712         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
713                major, minor, micro);
714         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
715         printf("***\n");
716         printf("*** If you have already installed a sufficiently new version, this error\n");
717         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
718         printf("*** being found. The easiest way to fix this is to remove the old version\n");
719         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
720         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
721         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
722         printf("*** so that the correct libraries are found at run-time))\n");
723       }
724     }
725   return 1;
726 }
727 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
728        CFLAGS="$ac_save_CFLAGS"
729        LIBS="$ac_save_LIBS"
730      fi
731   fi
732   if test "x$no_gtk" = x ; then
733      AC_MSG_RESULT(yes)
734      ifelse([$2], , :, [$2])     
735   else
736      AC_MSG_RESULT(no)
737      if test "$GTK_CONFIG" = "no" ; then
738        echo "*** The gtk-config script installed by GTK could not be found"
739        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
740        echo "*** your path, or set the GTK_CONFIG environment variable to the"
741        echo "*** full path to gtk-config."
742      else
743        if test -f conf.gtktest ; then
744         :
745        else
746           echo "*** Could not run GTK test program, checking why..."
747           CFLAGS="$CFLAGS $GTK_CFLAGS"
748           LIBS="$LIBS $GTK_LIBS"
749           AC_TRY_LINK([
750 #include <gtk/gtk.h>
751 #include <stdio.h>
752 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
753         [ echo "*** The test program compiled, but did not run. This usually means"
754           echo "*** that the run-time linker is not finding GTK or finding the wrong"
755           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
756           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
757           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
758           echo "*** is required on your system"
759           echo "***"
760           echo "*** If you have an old version installed, it is best to remove it, although"
761           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
762           echo "***"
763           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
764           echo "*** came with the system with the command"
765           echo "***"
766           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
767         [ echo "*** The test program failed to compile or link. See the file config.log for the"
768           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
769           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
770           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
771           CFLAGS="$ac_save_CFLAGS"
772           LIBS="$ac_save_LIBS"
773        fi
774      fi
775      GTK_CFLAGS=""
776      GTK_LIBS=""
777      ifelse([$3], , :, [$3])
778   fi
779   AC_SUBST(GTK_CFLAGS)
780   AC_SUBST(GTK_LIBS)
781   rm -f conf.gtktest
782 ])
783
784 # end of gtk.m4
785
786
787 # Configure paths for libogg
788 # Jack Moffitt <jack@icecast.org> 10-21-2000
789 # Shamelessly stolen from Owen Taylor and Manish Singh
790
791 dnl AM_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
792 dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
793 dnl
794 AC_DEFUN(AM_PATH_OGG,
795 [dnl 
796 dnl Get the cflags and libraries
797 dnl
798 AC_ARG_WITH(ogg-prefix,[  --with-ogg-prefix=PFX   Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
799 AC_ARG_ENABLE(oggtest, [  --disable-oggtest       Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
800
801   if test "x$ogg_prefix" != "x"; then
802     ogg_args="$ogg_args --prefix=$ogg_prefix"
803     OGG_CFLAGS="-I$ogg_prefix/include"
804     OGG_LIBS="-L$ogg_prefix/lib"
805   elif test "x$prefix" != "xNONE"; then
806     ogg_args="$ogg_args --prefix=$prefix"
807     OGG_CFLAGS="-I$prefix/include"
808     OGG_LIBS="-L$prefix/lib"
809   fi
810
811   OGG_LIBS="$OGG_LIBS -logg"
812
813   AC_MSG_CHECKING(for Ogg)
814   no_ogg=""
815
816
817   if test "x$enable_oggtest" = "xyes" ; then
818     ac_save_CFLAGS="$CFLAGS"
819     ac_save_LIBS="$LIBS"
820     CFLAGS="$CFLAGS $OGG_CFLAGS"
821     LIBS="$LIBS $OGG_LIBS"
822 dnl
823 dnl Now check if the installed Ogg is sufficiently new.
824 dnl
825       rm -f conf.oggtest
826       AC_TRY_RUN([
827 #include <stdio.h>
828 #include <stdlib.h>
829 #include <string.h>
830 #include <ogg/ogg.h>
831
832 int main ()
833 {
834   system("touch conf.oggtest");
835   return 0;
836 }
837
838 ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
839        CFLAGS="$ac_save_CFLAGS"
840        LIBS="$ac_save_LIBS"
841   fi
842
843   if test "x$no_ogg" = "x" ; then
844      AC_MSG_RESULT(yes)
845      ifelse([$1], , :, [$1])     
846   else
847      AC_MSG_RESULT(no)
848      if test -f conf.oggtest ; then
849        :
850      else
851        echo "*** Could not run Ogg test program, checking why..."
852        CFLAGS="$CFLAGS $OGG_CFLAGS"
853        LIBS="$LIBS $OGG_LIBS"
854        AC_TRY_LINK([
855 #include <stdio.h>
856 #include <ogg/ogg.h>
857 ],     [ return 0; ],
858        [ echo "*** The test program compiled, but did not run. This usually means"
859        echo "*** that the run-time linker is not finding Ogg or finding the wrong"
860        echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
861        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
862        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
863        echo "*** is required on your system"
864        echo "***"
865        echo "*** If you have an old version installed, it is best to remove it, although"
866        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
867        [ echo "*** The test program failed to compile or link. See the file config.log for the"
868        echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
869        echo "*** or that you have moved Ogg since it was installed. In the latter case, you"
870        echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ])
871        CFLAGS="$ac_save_CFLAGS"
872        LIBS="$ac_save_LIBS"
873      fi
874      OGG_CFLAGS=""
875      OGG_LIBS=""
876      ifelse([$2], , :, [$2])
877   fi
878   AC_SUBST(OGG_CFLAGS)
879   AC_SUBST(OGG_LIBS)
880   rm -f conf.oggtest
881 ])
882
883 # end of ogg.m4
884
885
886 # Configure paths for libvorbis
887 # Jack Moffitt <jack@icecast.org> 10-21-2000
888 # Shamelessly stolen from Owen Taylor and Manish Singh
889
890 dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
891 dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
892 dnl
893 AC_DEFUN(AM_PATH_VORBIS,
894 [dnl 
895 dnl Get the cflags and libraries
896 dnl
897 AC_ARG_WITH(vorbis-prefix,[  --with-vorbis-prefix=PFX   Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
898 AC_ARG_ENABLE(vorbistest, [  --disable-vorbistest       Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
899
900   if test "x$vorbis_prefix" != "x" ; then
901     vorbis_args="$vorbis_args --prefix=$vorbis_prefix"
902     VORBIS_CFLAGS="-I$vorbis_prefix/include"
903     VORBIS_LIBDIR="-L$vorbis_prefix/lib"
904   elif test "x$prefix" != "xNONE"; then
905     vorbis_args="$vorbis_args --prefix=$prefix"
906     VORBIS_CFLAGS="-I$prefix/include"
907     VORBIS_LIBDIR="-L$prefix/lib"
908   fi
909
910   VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm"
911   VORBISFILE_LIBS="-lvorbisfile"
912   VORBISENC_LIBS="-lvorbisenc"
913
914   AC_MSG_CHECKING(for Vorbis)
915   no_vorbis=""
916
917
918   if test "x$enable_vorbistest" = "xyes" ; then
919     ac_save_CFLAGS="$CFLAGS"
920     ac_save_LIBS="$LIBS"
921     CFLAGS="$CFLAGS $VORBIS_CFLAGS"
922     LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
923 dnl
924 dnl Now check if the installed Vorbis is sufficiently new.
925 dnl
926       rm -f conf.vorbistest
927       AC_TRY_RUN([
928 #include <stdio.h>
929 #include <stdlib.h>
930 #include <string.h>
931 #include <vorbis/codec.h>
932
933 int main ()
934 {
935   system("touch conf.vorbistest");
936   return 0;
937 }
938
939 ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
940        CFLAGS="$ac_save_CFLAGS"
941        LIBS="$ac_save_LIBS"
942   fi
943
944   if test "x$no_vorbis" = "x" ; then
945      AC_MSG_RESULT(yes)
946      ifelse([$1], , :, [$1])     
947   else
948      AC_MSG_RESULT(no)
949      if test -f conf.vorbistest ; then
950        :
951      else
952        echo "*** Could not run Vorbis test program, checking why..."
953        CFLAGS="$CFLAGS $VORBIS_CFLAGS"
954        LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
955        AC_TRY_LINK([
956 #include <stdio.h>
957 #include <vorbis/codec.h>
958 ],     [ return 0; ],
959        [ echo "*** The test program compiled, but did not run. This usually means"
960        echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
961        echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
962        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
963        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
964        echo "*** is required on your system"
965        echo "***"
966        echo "*** If you have an old version installed, it is best to remove it, although"
967        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
968        [ echo "*** The test program failed to compile or link. See the file config.log for the"
969        echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
970        echo "*** or that you have moved Vorbis since it was installed." ])
971        CFLAGS="$ac_save_CFLAGS"
972        LIBS="$ac_save_LIBS"
973      fi
974      VORBIS_CFLAGS=""
975      VORBIS_LIBS=""
976      VORBISFILE_LIBS=""
977      VORBISENC_LIBS=""
978      ifelse([$2], , :, [$2])
979   fi
980   AC_SUBST(VORBIS_CFLAGS)
981   AC_SUBST(VORBIS_LIBS)
982   AC_SUBST(VORBISFILE_LIBS)
983   AC_SUBST(VORBISENC_LIBS)
984   rm -f conf.vorbistest
985 ])
986
987 # end of vorbis.m4
988 # serial 3
989
990 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
991 # -------------------------------------
992 # Define a conditional.
993 #
994 # FIXME: Once using 2.50, use this:
995 # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl
996 AC_DEFUN([AM_CONDITIONAL],
997 [ifelse([$1], [TRUE],
998         [errprint(__file__:__line__: [$0: invalid condition: $1
999 ])dnl
1000 m4exit(1)])dnl
1001 ifelse([$1], [FALSE],
1002        [errprint(__file__:__line__: [$0: invalid condition: $1
1003 ])dnl
1004 m4exit(1)])dnl
1005 AC_SUBST([$1_TRUE])
1006 AC_SUBST([$1_FALSE])
1007 if $2; then
1008   $1_TRUE=
1009   $1_FALSE='#'
1010 else
1011   $1_TRUE='#'
1012   $1_FALSE=
1013 fi])
1014
1015 # Do all the work for Automake.  This macro actually does too much --
1016 # some checks are only needed if your package does certain things.
1017 # But this isn't really a big deal.
1018
1019 # serial 5
1020
1021 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1022 # written in clear, in which case automake, when reading aclocal.m4,
1023 # will think it sees a *use*, and therefore will trigger all it's
1024 # C support machinery.  Also note that it means that autoscan, seeing
1025 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1026
1027
1028 # We require 2.13 because we rely on SHELL being computed by configure.
1029 AC_PREREQ([2.13])
1030
1031 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
1032 # -----------------------------------------------------------
1033 # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
1034 # The purpose of this macro is to provide the user with a means to
1035 # check macros which are provided without letting her know how the
1036 # information is coded.
1037 # If this macro is not defined by Autoconf, define it here.
1038 ifdef([AC_PROVIDE_IFELSE],
1039       [],
1040       [define([AC_PROVIDE_IFELSE],
1041               [ifdef([AC_PROVIDE_$1],
1042                      [$2], [$3])])])
1043
1044
1045 # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
1046 # ----------------------------------------------
1047 AC_DEFUN([AM_INIT_AUTOMAKE],
1048 [AC_REQUIRE([AC_PROG_INSTALL])dnl
1049 # test to see if srcdir already configured
1050 if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
1051    test -f $srcdir/config.status; then
1052   AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])
1053 fi
1054
1055 # Define the identity of the package.
1056 PACKAGE=$1
1057 AC_SUBST(PACKAGE)dnl
1058 VERSION=$2
1059 AC_SUBST(VERSION)dnl
1060 ifelse([$3],,
1061 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1062 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
1063
1064 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
1065 # the ones we care about.
1066 ifdef([m4_pattern_allow],
1067       [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl
1068
1069 # Autoconf 2.50 always computes EXEEXT.  However we need to be
1070 # compatible with 2.13, for now.  So we always define EXEEXT, but we
1071 # don't compute it.
1072 AC_SUBST(EXEEXT)
1073 # Similar for OBJEXT -- only we only use OBJEXT if the user actually
1074 # requests that it be used.  This is a bit dumb.
1075 : ${OBJEXT=o}
1076 AC_SUBST(OBJEXT)
1077
1078 # Some tools Automake needs.
1079 AC_REQUIRE([AM_SANITY_CHECK])dnl
1080 AC_REQUIRE([AC_ARG_PROGRAM])dnl
1081 AM_MISSING_PROG(ACLOCAL, aclocal)
1082 AM_MISSING_PROG(AUTOCONF, autoconf)
1083 AM_MISSING_PROG(AUTOMAKE, automake)
1084 AM_MISSING_PROG(AUTOHEADER, autoheader)
1085 AM_MISSING_PROG(MAKEINFO, makeinfo)
1086 AM_MISSING_PROG(AMTAR, tar)
1087 AM_PROG_INSTALL_SH
1088 AM_PROG_INSTALL_STRIP
1089 # We need awk for the "check" target.  The system "awk" is bad on
1090 # some platforms.
1091 AC_REQUIRE([AC_PROG_AWK])dnl
1092 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1093 AC_REQUIRE([AM_DEP_TRACK])dnl
1094 AC_REQUIRE([AM_SET_DEPDIR])dnl
1095 AC_PROVIDE_IFELSE([AC_PROG_][CC],
1096                   [_AM_DEPENDENCIES(CC)],
1097                   [define([AC_PROG_][CC],
1098                           defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
1099 AC_PROVIDE_IFELSE([AC_PROG_][CXX],
1100                   [_AM_DEPENDENCIES(CXX)],
1101                   [define([AC_PROG_][CXX],
1102                           defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
1103 ])
1104
1105 #
1106 # Check to make sure that the build environment is sane.
1107 #
1108
1109 # serial 3
1110
1111 # AM_SANITY_CHECK
1112 # ---------------
1113 AC_DEFUN([AM_SANITY_CHECK],
1114 [AC_MSG_CHECKING([whether build environment is sane])
1115 # Just in case
1116 sleep 1
1117 echo timestamp > conftest.file
1118 # Do `set' in a subshell so we don't clobber the current shell's
1119 # arguments.  Must try -L first in case configure is actually a
1120 # symlink; some systems play weird games with the mod time of symlinks
1121 # (eg FreeBSD returns the mod time of the symlink's containing
1122 # directory).
1123 if (
1124    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
1125    if test "$[*]" = "X"; then
1126       # -L didn't work.
1127       set X `ls -t $srcdir/configure conftest.file`
1128    fi
1129    rm -f conftest.file
1130    if test "$[*]" != "X $srcdir/configure conftest.file" \
1131       && test "$[*]" != "X conftest.file $srcdir/configure"; then
1132
1133       # If neither matched, then we have a broken ls.  This can happen
1134       # if, for instance, CONFIG_SHELL is bash and it inherits a
1135       # broken ls alias from the environment.  This has actually
1136       # happened.  Such a system could not be considered "sane".
1137       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1138 alias in your environment])
1139    fi
1140
1141    test "$[2]" = conftest.file
1142    )
1143 then
1144    # Ok.
1145    :
1146 else
1147    AC_MSG_ERROR([newly created file is older than distributed files!
1148 Check your system clock])
1149 fi
1150 AC_MSG_RESULT(yes)])
1151
1152
1153 # serial 2
1154
1155 # AM_MISSING_PROG(NAME, PROGRAM)
1156 # ------------------------------
1157 AC_DEFUN([AM_MISSING_PROG],
1158 [AC_REQUIRE([AM_MISSING_HAS_RUN])
1159 $1=${$1-"${am_missing_run}$2"}
1160 AC_SUBST($1)])
1161
1162
1163 # AM_MISSING_HAS_RUN
1164 # ------------------
1165 # Define MISSING if not defined so far and test if it supports --run.
1166 # If it does, set am_missing_run to use it, otherwise, to nothing.
1167 AC_DEFUN([AM_MISSING_HAS_RUN],
1168 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1169 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
1170 # Use eval to expand $SHELL
1171 if eval "$MISSING --run true"; then
1172   am_missing_run="$MISSING --run "
1173 else
1174   am_missing_run=
1175   am_backtick='`'
1176   AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
1177 fi
1178 ])
1179
1180 # AM_AUX_DIR_EXPAND
1181
1182 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
1183 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
1184 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
1185 #
1186 # Of course, Automake must honor this variable whenever it calls a
1187 # tool from the auxiliary directory.  The problem is that $srcdir (and
1188 # therefore $ac_aux_dir as well) can be either absolute or relative,
1189 # depending on how configure is run.  This is pretty annoying, since
1190 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
1191 # source directory, any form will work fine, but in subdirectories a
1192 # relative path needs to be adjusted first.
1193 #
1194 # $ac_aux_dir/missing
1195 #    fails when called from a subdirectory if $ac_aux_dir is relative
1196 # $top_srcdir/$ac_aux_dir/missing
1197 #    fails if $ac_aux_dir is absolute,
1198 #    fails when called from a subdirectory in a VPATH build with
1199 #          a relative $ac_aux_dir
1200 #
1201 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
1202 # are both prefixed by $srcdir.  In an in-source build this is usually
1203 # harmless because $srcdir is `.', but things will broke when you
1204 # start a VPATH build or use an absolute $srcdir.
1205 #
1206 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
1207 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
1208 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
1209 # and then we would define $MISSING as
1210 #   MISSING="\${SHELL} $am_aux_dir/missing"
1211 # This will work as long as MISSING is not called from configure, because
1212 # unfortunately $(top_srcdir) has no meaning in configure.
1213 # However there are other variables, like CC, which are often used in
1214 # configure, and could therefore not use this "fixed" $ac_aux_dir.
1215 #
1216 # Another solution, used here, is to always expand $ac_aux_dir to an
1217 # absolute PATH.  The drawback is that using absolute paths prevent a
1218 # configured tree to be moved without reconfiguration.
1219
1220 AC_DEFUN([AM_AUX_DIR_EXPAND], [
1221 # expand $ac_aux_dir to an absolute path
1222 am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
1223 ])
1224
1225 # AM_PROG_INSTALL_SH
1226 # ------------------
1227 # Define $install_sh.
1228 AC_DEFUN([AM_PROG_INSTALL_SH],
1229 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1230 install_sh=${install_sh-"$am_aux_dir/install-sh"}
1231 AC_SUBST(install_sh)])
1232
1233 # One issue with vendor `install' (even GNU) is that you can't
1234 # specify the program used to strip binaries.  This is especially
1235 # annoying in cross-compiling environments, where the build's strip
1236 # is unlikely to handle the host's binaries.
1237 # Fortunately install-sh will honor a STRIPPROG variable, so we
1238 # always use install-sh in `make install-strip', and initialize
1239 # STRIPPROG with the value of the STRIP variable (set by the user).
1240 AC_DEFUN([AM_PROG_INSTALL_STRIP],
1241 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1242 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
1243 AC_SUBST([INSTALL_STRIP_PROGRAM])])
1244
1245 # serial 4                                              -*- Autoconf -*-
1246
1247
1248
1249 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
1250 # written in clear, in which case automake, when reading aclocal.m4,
1251 # will think it sees a *use*, and therefore will trigger all it's
1252 # C support machinery.  Also note that it means that autoscan, seeing
1253 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
1254
1255
1256
1257 # _AM_DEPENDENCIES(NAME)
1258 # ---------------------
1259 # See how the compiler implements dependency checking.
1260 # NAME is "CC", "CXX" or "OBJC".
1261 # We try a few techniques and use that to set a single cache variable.
1262 #
1263 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
1264 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
1265 # dependency, and given that the user is not expected to run this macro,
1266 # just rely on AC_PROG_CC.
1267 AC_DEFUN([_AM_DEPENDENCIES],
1268 [AC_REQUIRE([AM_SET_DEPDIR])dnl
1269 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
1270 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
1271 AC_REQUIRE([AM_DEP_TRACK])dnl
1272
1273 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
1274        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
1275        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc']
1276        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
1277                    [depcc="$$1"   am_compiler_list=])
1278
1279 AC_CACHE_CHECK([dependency style of $depcc],
1280                [am_cv_$1_dependencies_compiler_type],
1281 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
1282   # We make a subdir and do the tests there.  Otherwise we can end up
1283   # making bogus files that we don't know about and never remove.  For
1284   # instance it was reported that on HP-UX the gcc test will end up
1285   # making a dummy file named `D' -- because `-MD' means `put the output
1286   # in D'.
1287   mkdir conftest.dir
1288   # Copy depcomp to subdir because otherwise we won't find it if we're
1289   # using a relative directory.
1290   cp "$am_depcomp" conftest.dir
1291   cd conftest.dir
1292
1293   am_cv_$1_dependencies_compiler_type=none
1294   if test "$am_compiler_list" = ""; then
1295      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
1296   fi
1297   for depmode in $am_compiler_list; do
1298     # We need to recreate these files for each test, as the compiler may
1299     # overwrite some of them when testing with obscure command lines.
1300     # This happens at least with the AIX C compiler.
1301     echo '#include "conftest.h"' > conftest.c
1302     echo 'int i;' > conftest.h
1303     echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
1304
1305     case $depmode in
1306     nosideeffect)
1307       # after this tag, mechanisms are not by side-effect, so they'll
1308       # only be used when explicitly requested
1309       if test "x$enable_dependency_tracking" = xyes; then
1310         continue
1311       else
1312         break
1313       fi
1314       ;;
1315     none) break ;;
1316     esac
1317     # We check with `-c' and `-o' for the sake of the "dashmstdout"
1318     # mode.  It turns out that the SunPro C++ compiler does not properly
1319     # handle `-M -o', and we need to detect this.
1320     if depmode=$depmode \
1321        source=conftest.c object=conftest.o \
1322        depfile=conftest.Po tmpdepfile=conftest.TPo \
1323        $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
1324        grep conftest.h conftest.Po > /dev/null 2>&1 &&
1325        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
1326       am_cv_$1_dependencies_compiler_type=$depmode
1327       break
1328     fi
1329   done
1330
1331   cd ..
1332   rm -rf conftest.dir
1333 else
1334   am_cv_$1_dependencies_compiler_type=none
1335 fi
1336 ])
1337 $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
1338 AC_SUBST([$1DEPMODE])
1339 ])
1340
1341
1342 # AM_SET_DEPDIR
1343 # -------------
1344 # Choose a directory name for dependency files.
1345 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
1346 AC_DEFUN([AM_SET_DEPDIR],
1347 [rm -f .deps 2>/dev/null
1348 mkdir .deps 2>/dev/null
1349 if test -d .deps; then
1350   DEPDIR=.deps
1351 else
1352   # MS-DOS does not allow filenames that begin with a dot.
1353   DEPDIR=_deps
1354 fi
1355 rmdir .deps 2>/dev/null
1356 AC_SUBST(DEPDIR)
1357 ])
1358
1359
1360 # AM_DEP_TRACK
1361 # ------------
1362 AC_DEFUN([AM_DEP_TRACK],
1363 [AC_ARG_ENABLE(dependency-tracking,
1364 [  --disable-dependency-tracking Speeds up one-time builds
1365   --enable-dependency-tracking  Do not reject slow dependency extractors])
1366 if test "x$enable_dependency_tracking" != xno; then
1367   am_depcomp="$ac_aux_dir/depcomp"
1368   AMDEPBACKSLASH='\'
1369 fi
1370 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
1371 pushdef([subst], defn([AC_SUBST]))
1372 subst(AMDEPBACKSLASH)
1373 popdef([subst])
1374 ])
1375
1376 # Generate code to set up dependency tracking.
1377 # This macro should only be invoked once -- use via AC_REQUIRE.
1378 # Usage:
1379 # AM_OUTPUT_DEPENDENCY_COMMANDS
1380
1381 #
1382 # This code is only required when automatic dependency tracking
1383 # is enabled.  FIXME.  This creates each `.P' file that we will
1384 # need in order to bootstrap the dependency handling code.
1385 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
1386 AC_OUTPUT_COMMANDS([
1387 test x"$AMDEP_TRUE" != x"" ||
1388 for mf in $CONFIG_FILES; do
1389   case "$mf" in
1390   Makefile) dirpart=.;;
1391   */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
1392   *) continue;;
1393   esac
1394   grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
1395   # Extract the definition of DEP_FILES from the Makefile without
1396   # running `make'.
1397   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
1398   test -z "$DEPDIR" && continue
1399   # When using ansi2knr, U may be empty or an underscore; expand it
1400   U=`sed -n -e '/^U = / s///p' < "$mf"`
1401   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
1402   # We invoke sed twice because it is the simplest approach to
1403   # changing $(DEPDIR) to its actual value in the expansion.
1404   for file in `sed -n -e '
1405     /^DEP_FILES = .*\\\\$/ {
1406       s/^DEP_FILES = //
1407       :loop
1408         s/\\\\$//
1409         p
1410         n
1411         /\\\\$/ b loop
1412       p
1413     }
1414     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
1415        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
1416     # Make sure the directory exists.
1417     test -f "$dirpart/$file" && continue
1418     fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
1419     $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
1420     # echo "creating $dirpart/$file"
1421     echo '# dummy' > "$dirpart/$file"
1422   done
1423 done
1424 ], [AMDEP_TRUE="$AMDEP_TRUE"
1425 ac_aux_dir="$ac_aux_dir"])])
1426
1427 # AM_MAKE_INCLUDE()
1428 # -----------------
1429 # Check to see how make treats includes.
1430 AC_DEFUN([AM_MAKE_INCLUDE],
1431 [am_make=${MAKE-make}
1432 cat > confinc << 'END'
1433 doit:
1434         @echo done
1435 END
1436 # If we don't find an include directive, just comment out the code.
1437 AC_MSG_CHECKING([for style of include used by $am_make])
1438 am__include='#'
1439 am__quote=
1440 _am_result=none
1441 # First try GNU make style include.
1442 echo "include confinc" > confmf
1443 # We grep out `Entering directory' and `Leaving directory'
1444 # messages which can occur if `w' ends up in MAKEFLAGS.
1445 # In particular we don't look at `^make:' because GNU make might
1446 # be invoked under some other name (usually "gmake"), in which
1447 # case it prints its new name instead of `make'.
1448 if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
1449    am__include=include
1450    am__quote=
1451    _am_result=GNU
1452 fi
1453 # Now try BSD make style include.
1454 if test "$am__include" = "#"; then
1455    echo '.include "confinc"' > confmf
1456    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
1457       am__include=.include
1458       am__quote='"'
1459       _am_result=BSD
1460    fi
1461 fi
1462 AC_SUBST(am__include)
1463 AC_SUBST(am__quote)
1464 AC_MSG_RESULT($_am_result)
1465 rm -f confinc confmf
1466 ])
1467
1468 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1469
1470 # serial 3
1471
1472 # When config.status generates a header, we must update the stamp-h file.
1473 # This file resides in the same directory as the config header
1474 # that is generated.  We must strip everything past the first ":",
1475 # and everything past the last "/".
1476
1477 AC_PREREQ([2.12])
1478
1479 AC_DEFUN([AM_CONFIG_HEADER],
1480 [ifdef([AC_FOREACH],dnl
1481          [dnl init our file count if it isn't already
1482          m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0]))
1483          dnl prepare to store our destination file list for use in config.status
1484          AC_FOREACH([_AM_File], [$1],
1485                     [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*]))
1486                     m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index))
1487                     dnl and add it to the list of files AC keeps track of, along
1488                     dnl with our hook
1489                     AC_CONFIG_HEADERS(_AM_File,
1490 dnl COMMANDS, [, INIT-CMDS]
1491 [# update the timestamp
1492 echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index["
1493 ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS
1494                     m4_popdef([_AM_Dest])])],dnl
1495 [AC_CONFIG_HEADER([$1])
1496   AC_OUTPUT_COMMANDS(
1497    ifelse(patsubst([$1], [[^ ]], []),
1498           [],
1499           [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
1500            patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl
1501 [am_indx=1
1502 for am_file in $1; do
1503   case " \$CONFIG_HEADERS " in
1504   *" \$am_file "*)
1505     am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\`
1506     if test -n "\$am_dir"; then
1507       am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\`
1508       for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do
1509         am_tmpdir=\$am_tmpdir\$am_subdir/
1510         if test ! -d \$am_tmpdir; then
1511           mkdir \$am_tmpdir
1512         fi
1513       done
1514     fi
1515     echo timestamp > "\$am_dir"stamp-h\$am_indx
1516     ;;
1517   esac
1518   am_indx=\`expr \$am_indx + 1\`
1519 done])
1520 ])]) # AM_CONFIG_HEADER
1521
1522 # _AM_DIRNAME(PATH)
1523 # -----------------
1524 # Like AS_DIRNAME, only do it during macro expansion
1525 AC_DEFUN([_AM_DIRNAME],
1526        [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
1527               m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1,
1528                     m4_if(m4_regexp([$1], [^/.*]), -1,
1529                           [.],
1530                           m4_patsubst([$1], [^\(/\).*], [\1])),
1531                     m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
1532               m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
1533 ]) # _AM_DIRNAME
1534
1535
1536 # serial 3
1537
1538 AC_DEFUN([AM_PATH_LISPDIR],
1539  [AC_ARG_WITH(lispdir, 
1540   [   --with-lispdir            Override the default lisp directory ],
1541   [ lispdir="$withval" 
1542     AC_MSG_CHECKING([where .elc files should go])
1543     AC_MSG_RESULT([$lispdir])],
1544   [
1545   # If set to t, that means we are running in a shell under Emacs.
1546   # If you have an Emacs named "t", then use the full path.
1547   test x"$EMACS" = xt && EMACS=
1548   AC_CHECK_PROGS(EMACS, emacs xemacs, no)
1549   if test $EMACS != "no"; then
1550     if test x${lispdir+set} != xset; then
1551       AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [dnl
1552         am_cv_lispdir=`$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' | sed -n -e 's,/$,,' -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}'`
1553         if test -z "$am_cv_lispdir"; then
1554           am_cv_lispdir='${datadir}/emacs/site-lisp'
1555         fi
1556       ])
1557       lispdir="$am_cv_lispdir"
1558     fi
1559   fi
1560  ])
1561  AC_SUBST(lispdir)])
1562