7
|
1 # sidplay.m4 - libSIDPlay 1.xx.xx checks
|
|
2 # Originally by Michael Schwendt
|
|
3 # Modified by Matti 'ccr' Hamalainen
|
|
4
|
|
5 dnl -------------------------------------------------------------------------
|
|
6 dnl Try to find a file (or one of more files in a list of dirs).
|
|
7 dnl -------------------------------------------------------------------------
|
1
|
8
|
|
9 AC_DEFUN(AC_FIND_FILE,
|
|
10 [
|
|
11 $3=NO
|
|
12 for i in $2;
|
|
13 do
|
|
14 for j in $1;
|
|
15 do
|
|
16 if test -r "$i/$j"; then
|
|
17 $3=$i
|
|
18 break 2
|
|
19 fi
|
|
20 done
|
|
21 done
|
|
22 ]
|
|
23 )
|
|
24
|
7
|
25
|
|
26 dnl -------------------------------------------------------------------------
|
|
27 dnl Try to find SIDPLAY includes and library.
|
|
28 dnl -------------------------------------------------------------------------
|
1
|
29 AC_DEFUN(AC_PATH_LIBSIDPLAY,
|
|
30 [
|
|
31 AC_MSG_CHECKING([for SIDPLAY includes and library])
|
|
32 AC_LANG_SAVE
|
|
33 AC_LANG_CPLUSPLUS
|
|
34 ac_sidplay_cflags=NO
|
|
35 ac_sidplay_library=NO
|
|
36 sidplay_cflags=""
|
|
37 sidplay_library=""
|
|
38
|
|
39 AC_ARG_WITH(sidplay-prefix,
|
|
40 [ --with-sidplay-prefix=DIR
|
|
41 where the sidplay includes and library are located],
|
|
42 [ac_sidplay_cflags="${withval}/include"
|
|
43 ac_sidplay_library="${withval}/lib"
|
|
44 ])
|
|
45
|
|
46 AC_ARG_WITH(sidplay-includes,
|
|
47 [ --with-sidplay-includes=DIR
|
|
48 where the sidplay includes are located],
|
|
49 [ac_sidplay_cflags="$withval"
|
|
50 ])
|
|
51
|
|
52 AC_ARG_WITH(sidplay-library,
|
|
53 [ --with-sidplay-library=DIR
|
|
54 where the sidplay library is installed],
|
|
55 [ac_sidplay_library="$withval"
|
|
56 ])
|
|
57
|
|
58 if test "$ac_sidplay_cflags" = NO || test "$ac_sidplay_library" = NO; then
|
7
|
59
|
|
60 # Search common locations
|
1
|
61
|
|
62 AC_CACHE_VAL(ac_cv_have_sidplay,
|
|
63 [
|
|
64 sidplay_incdirs="$ac_sidplay_cflags /usr/include /usr/local/include /usr/lib/sidplay/include /usr/local/lib/sidplay/include"
|
|
65 AC_FIND_FILE(sidplay/sidtune.h,$sidplay_incdirs,sidplay_foundincdir)
|
|
66 ac_sidplay_cflags=$sidplay_foundincdir
|
|
67
|
|
68 sidplay_libdirs="$ac_sidplay_library /usr/lib /usr/local/lib /usr/lib/sidplay /usr/local/lib/sidplay"
|
|
69 AC_FIND_FILE(libsidplay.so libsidplay.so.1 libsidplay.so.1.36 libsidplay.so.1.37,$sidplay_libdirs,sidplay_foundlibdir)
|
|
70 ac_sidplay_library=$sidplay_foundlibdir
|
|
71
|
|
72 if test "$ac_sidplay_cflags" = NO || test "$ac_sidplay_library" = NO; then
|
|
73 ac_cv_have_sidplay="have_sidplay=no"
|
|
74 ac_sidplay_notfound=""
|
|
75 if test "$ac_sidplay_cflags" = NO; then
|
|
76 if test "$ac_sidplay_library" = NO; then
|
|
77 ac_sidplay_notfound="(headers and library)";
|
|
78 else
|
|
79 ac_sidplay_notfound="(headers)";
|
|
80 fi
|
|
81 else
|
|
82 ac_sidplay_notfound="(library)";
|
|
83 fi
|
|
84 eval "$ac_cv_have_sidplay"
|
|
85 AC_MSG_RESULT([$have_sidplay])
|
|
86 else
|
|
87 have_sidplay=yes
|
|
88 fi
|
|
89
|
|
90 ]) dnl AC_CACHE_VAL(ac_cv_have_sidplay,
|
|
91 else
|
|
92 have_sidplay=yes
|
|
93 fi dnl if (have_to_search)
|
|
94
|
|
95 eval "$ac_cv_have_sidplay"
|
|
96
|
|
97 if test "$have_sidplay" != yes; then
|
|
98 AC_MSG_RESULT([$have_sidplay]);
|
|
99 else
|
|
100 ac_cv_have_sidplay="have_sidplay=yes \
|
|
101 ac_sidplay_cflags=$ac_sidplay_cflags ac_sidplay_library=$ac_sidplay_library"
|
|
102 AC_MSG_RESULT([library $ac_sidplay_library, headers $ac_sidplay_cflags])
|
|
103
|
|
104 sidplay_library=$ac_sidplay_library
|
|
105 sidplay_cflags=$ac_sidplay_cflags
|
|
106
|
|
107 SIDPLAY_LIBS="-L$sidplay_library -lsidplay"
|
|
108 all_libraries="$SIDPLAY_LIBS $all_libraries"
|
|
109 SIDPLAY_CFLAGS="-I$sidplay_cflags"
|
|
110 all_includes="$SIDPLAY_CFLAGS $all_includes"
|
|
111 fi
|
|
112
|
|
113
|
7
|
114 dnl ***
|
|
115 dnl *** Test compilation
|
|
116 dnl ***
|
1
|
117 AC_MSG_CHECKING([whether -lsidplay works])
|
|
118 ac_cxxflags_safe=$CXXFLAGS
|
|
119 ac_ldflags_safe=$LDFLAGS
|
|
120 ac_libs_safe=$LIBS
|
|
121
|
|
122 CXXFLAGS="$CXXFLAGS -I$sidplay_cflags"
|
|
123 LDFLAGS="$LDFLAGS -L$sidplay_library"
|
|
124 LIBS="-lsidplay"
|
|
125
|
|
126 AC_CACHE_VAL(ac_cv_sidplay_works,
|
|
127 [
|
|
128 AC_TRY_LINK(
|
|
129 [#include <sidplay/sidtune.h>],
|
|
130 [sidTune* myTest;],
|
|
131 [ac_cv_sidplay_works=yes],
|
|
132 [ac_cv_sidplay_works=no]
|
|
133 )
|
|
134 ])
|
|
135
|
|
136 CXXFLAGS="$ac_cxxflags_safe"
|
|
137 LDFLAGS="$ac_ldflags_safe"
|
|
138 LIBS="$ac_libs_safe"
|
|
139
|
|
140 AC_MSG_RESULT([$ac_cv_sidplay_works])
|
|
141 if test "$ac_cv_sidplay_works" != yes; then
|
|
142 have_sidplay=no
|
|
143 fi
|
|
144
|
7
|
145
|
|
146 dnl ***
|
|
147 dnl *** Substitute variables
|
|
148 dnl ***
|
1
|
149
|
|
150 AC_SUBST(SIDPLAY_CFLAGS)
|
|
151 AC_SUBST(SIDPLAY_LIBS)
|
|
152
|
|
153 AC_SUBST(sidplay_library)
|
|
154 AC_SUBST(sidplay_cflags)
|
|
155
|
|
156 AC_LANG_RESTORE
|
|
157
|
|
158 ])
|