1dnl aclocal.m4 generated automatically by aclocal 1.4-p5
2
3dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl -------------------------------------------------------------------------
14dnl Try to find a file (or one of more files in a list of dirs).
15dnl -------------------------------------------------------------------------
16
17AC_DEFUN(MY_FIND_FILE,
18    [
19    $3=NO
20    for i in $2;
21    do
22        for j in $1;
23        do
24	        if test -r "$i/$j"; then
25		        $3=$i
26                break 2
27            fi
28        done
29    done
30    ]
31)
32
33dnl -------------------------------------------------------------------------
34dnl Try to find SIDPLAY includes and library.
35dnl $my_have_sidplay will be "yes" or "no"
36dnl $(sidplay_libdir) will be path to libsidplay.*
37dnl $(sidplay_incdir) will be path to sidplay/*.h
38dnl @SIDPLAY_LDFLAGS@ will be substituted with -L$sidplay_libdir
39dnl @SIDPLAY_INCLUDES@ will be substituted with -I$sidplay_incdir
40dnl -------------------------------------------------------------------------
41
42AC_DEFUN(MY_PATH_LIBSIDPLAY,
43[
44    AC_MSG_CHECKING([for working SIDPLAY library and headers])
45
46    dnl Be pessimistic.
47    my_sidplay_library=NO
48    my_sidplay_includes=NO
49    sidplay_libdir=""
50    sidplay_incdir=""
51
52    AC_ARG_WITH(sidplay-includes,
53        [  --with-sidplay-includes=DIR
54                          where the sidplay includes are located],
55        [my_sidplay_includes="$withval"]
56    )
57
58    AC_ARG_WITH(sidplay-library,
59        [  --with-sidplay-library=DIR
60                          where the sidplay library is installed],
61        [my_sidplay_library="$withval"]
62    )
63
64    # Test compilation with library and headers in standard path.
65    my_sidplay_libadd=""
66    my_sidplay_incadd=""
67
68    # Use library path given by user (if any).
69    if test "$my_sidplay_library" != NO; then
70        my_sidplay_libadd="-L$my_sidplay_library"
71    fi
72
73    # Use include path given by user (if any).
74    if test "$my_sidplay_includes" != NO; then
75        my_sidplay_incadd="-I$my_sidplay_includes"
76    fi
77
78    # Run test compilation.
79    AC_CACHE_VAL(my_cv_libsidplay_works,
80    [
81        MY_TRY_LIBSIDPLAY
82        my_cv_libsidplay_works=$my_libsidplay_works
83    ])
84
85    if test "$my_cv_libsidplay_works" = no; then
86
87        # Test compilation failed.
88        # Need to search for library and headers.
89        AC_CACHE_VAL(my_cv_have_sidplay,
90        [
91            # Search common locations where header files might be stored.
92            sidplay_incdirs="$my_sidplay_includes /usr/include /usr/local/include /usr/lib/sidplay/include /usr/local/lib/sidplay/include"
93            MY_FIND_FILE(sidplay/sidtune.h,$sidplay_incdirs,sidplay_foundincdir)
94            my_sidplay_includes=$sidplay_foundincdir
95
96            # Search common locations where library might be stored.
97            sidplay_libdirs="$my_sidplay_library /usr/lib /usr/local/lib /usr/lib/sidplay /usr/local/lib/sidplay"
98            MY_FIND_FILE(libsidplay.so libsidplay.so.1 libsidplay.so.1.36 libsidplay.so.1.37,$sidplay_libdirs,sidplay_foundlibdir)
99            my_sidplay_library=$sidplay_foundlibdir
100
101            if test "$my_sidplay_includes" = NO || test "$my_sidplay_library" = NO; then
102                my_cv_have_sidplay="my_have_sidplay=no"
103            else
104                my_cv_have_sidplay="my_have_sidplay=yes"
105            fi
106        ])
107
108        eval "$my_cv_have_sidplay"
109        if test "$my_have_sidplay" = yes; then
110            sidplay_libadd="-L$my_sidplay_library"
111            sidplay_incadd="-I$my_sidplay_includes"
112
113            # Test compilation with found paths.
114            AC_CACHE_VAL(my_cv_found_libsidplay_works,
115            [
116                MY_TRY_LIBSIDPLAY
117                my_cv_found_libsidplay_works=$my_libsidplay_works
118            ])
119            my_have_sidplay=$my_cv_found_libsidplay_works
120
121            if test "$my_have_sidplay" = no; then
122                # Found library does not link without errors.
123                my_have_sidplay=no
124                AC_MSG_RESULT([$my_have_sidplay]);
125            else
126                AC_MSG_RESULT([library $my_sidplay_library, headers $my_sidplay_includes])
127            fi
128        else
129            # Either library or headers not found.
130            AC_MSG_RESULT([$my_have_sidplay]);
131        fi
132    else
133        # Simply print 'yes' without printing the standard path.
134        my_have_sidplay=yes
135        AC_MSG_RESULT([$my_have_sidplay]);
136    fi
137
138    AC_SUBST(sidplay_libdir)
139    AC_SUBST(sidplay_incdir)
140
141    SIDPLAY_LDFLAGS="$my_sidplay_libadd"
142    SIDPLAY_INCLUDES="$my_sidplay_incadd"
143
144    AC_SUBST(SIDPLAY_LDFLAGS)
145    AC_SUBST(SIDPLAY_INCLUDES)
146])
147
148dnl Function used by MY_PATH_LIBSIDPLAY.
149
150AC_DEFUN(MY_TRY_LIBSIDPLAY,
151[
152    my_cxxflags_save=$CXXFLAGS
153    my_ldflags_save=$LDFLAGS
154    my_libs_save=$LIBS
155
156    CXXFLAGS="$CXXFLAGS $my_sidplay_incadd"
157    LDFLAGS="$LDFLAGS $my_sidplay_libadd"
158    LIBS="-lsidplay"
159
160    AC_TRY_LINK(
161        [#include <sidplay/sidtune.h>],
162        [sidTune* myTest;],
163        [my_libsidplay_works=yes],
164        [my_libsidplay_works=no]
165    )
166
167    CXXFLAGS="$my_cxxflags_save"
168    LDFLAGS="$my_ldflags_save"
169    LIBS="$my_libs_save"
170])
171
172
173# Do all the work for Automake.  This macro actually does too much --
174# some checks are only needed if your package does certain things.
175# But this isn't really a big deal.
176
177# serial 1
178
179dnl Usage:
180dnl AM_INIT_AUTOMAKE(package,version, [no-define])
181
182AC_DEFUN([AM_INIT_AUTOMAKE],
183[AC_REQUIRE([AC_PROG_INSTALL])
184PACKAGE=[$1]
185AC_SUBST(PACKAGE)
186VERSION=[$2]
187AC_SUBST(VERSION)
188dnl test to see if srcdir already configured
189if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
190  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
191fi
192ifelse([$3],,
193AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
194AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
195AC_REQUIRE([AM_SANITY_CHECK])
196AC_REQUIRE([AC_ARG_PROGRAM])
197dnl FIXME This is truly gross.
198missing_dir=`cd $ac_aux_dir && pwd`
199AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
200AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
201AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
202AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
203AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
204AC_REQUIRE([AC_PROG_MAKE_SET])])
205
206#
207# Check to make sure that the build environment is sane.
208#
209
210AC_DEFUN([AM_SANITY_CHECK],
211[AC_MSG_CHECKING([whether build environment is sane])
212# Just in case
213sleep 1
214echo timestamp > conftestfile
215# Do `set' in a subshell so we don't clobber the current shell's
216# arguments.  Must try -L first in case configure is actually a
217# symlink; some systems play weird games with the mod time of symlinks
218# (eg FreeBSD returns the mod time of the symlink's containing
219# directory).
220if (
221   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
222   if test "[$]*" = "X"; then
223      # -L didn't work.
224      set X `ls -t $srcdir/configure conftestfile`
225   fi
226   if test "[$]*" != "X $srcdir/configure conftestfile" \
227      && test "[$]*" != "X conftestfile $srcdir/configure"; then
228
229      # If neither matched, then we have a broken ls.  This can happen
230      # if, for instance, CONFIG_SHELL is bash and it inherits a
231      # broken ls alias from the environment.  This has actually
232      # happened.  Such a system could not be considered "sane".
233      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
234alias in your environment])
235   fi
236
237   test "[$]2" = conftestfile
238   )
239then
240   # Ok.
241   :
242else
243   AC_MSG_ERROR([newly created file is older than distributed files!
244Check your system clock])
245fi
246rm -f conftest*
247AC_MSG_RESULT(yes)])
248
249dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
250dnl The program must properly implement --version.
251AC_DEFUN([AM_MISSING_PROG],
252[AC_MSG_CHECKING(for working $2)
253# Run test in a subshell; some versions of sh will print an error if
254# an executable is not found, even if stderr is redirected.
255# Redirect stdin to placate older versions of autoconf.  Sigh.
256if ($2 --version) < /dev/null > /dev/null 2>&1; then
257   $1=$2
258   AC_MSG_RESULT(found)
259else
260   $1="$3/missing $2"
261   AC_MSG_RESULT(missing)
262fi
263AC_SUBST($1)])
264
265