1dnl -*- m4 -*-
2dnl
3dnl libid3tag - ID3 tag manipulation library
4dnl Copyright (C) 2000-2004 Underbit Technologies, Inc.
5dnl
6dnl This program is free software; you can redistribute it and/or modify
7dnl it under the terms of the GNU General Public License as published by
8dnl the Free Software Foundation; either version 2 of the License, or
9dnl (at your option) any later version.
10dnl
11dnl This program is distributed in the hope that it will be useful,
12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14dnl GNU General Public License for more details.
15dnl
16dnl You should have received a copy of the GNU General Public License
17dnl along with this program; if not, write to the Free Software
18dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19dnl
20AC_REVISION([$Id: configure.ac,v 1.12 2004/01/23 23:22:46 rob Exp $])dnl
21
22dnl Process this file with autoconf to produce a configure script.
23
24AC_INIT([ID3 Tag], [0.15.1b], [support@underbit.com], [libid3tag])
25AC_PREREQ(2.53)
26
27AC_CONFIG_SRCDIR([id3tag.h])
28
29AM_INIT_AUTOMAKE
30
31AM_CONFIG_HEADER([config.h])
32
33dnl System type.
34
35AC_CANONICAL_HOST
36
37dnl Checks for programs.
38
39AC_PROG_CC
40
41if test "$GCC" = yes
42then
43    case "$host" in
44	*-*-mingw*)
45	    case "$build" in
46		*-*-cygwin*)
47		    CPPFLAGS="$CPPFLAGS -mno-cygwin"
48		    LDFLAGS="$LDFLAGS -mno-cygwin"
49		    ;;
50	    esac
51    esac
52
53dnl    case "$host" in
54dnl	*-*-cygwin* | *-*-mingw*)
55dnl	    LDFLAGS="$LDFLAGS -no-undefined -mdll"
56dnl	    ;;
57dnl    esac
58fi
59
60dnl Support for libtool.
61
62dnl AC_DISABLE_SHARED
63dnl AC_LIBTOOL_WIN32_DLL
64AC_PROG_LIBTOOL
65
66AC_SUBST(LIBTOOL_DEPS)
67
68dnl Compiler options.
69
70arch=""
71debug=""
72optimize=""
73profile=""
74
75set -- $CFLAGS
76CFLAGS=""
77
78if test "$GCC" = yes
79then
80    CFLAGS="-Wall"
81fi
82
83while test $# -gt 0
84do
85    case "$1" in
86	-Wall)
87	    if test "$GCC" = yes
88	    then
89		:
90	    else
91		CFLAGS="$CFLAGS $1"
92	    fi
93	    shift
94	    ;;
95	-g)
96	    debug="-g"
97	    shift
98	    ;;
99	-mno-cygwin)
100	    shift
101	    ;;
102	-m*)
103	    arch="$arch $1"
104	    shift
105	    ;;
106	-fomit-frame-pointer)
107	    shift
108	    ;;
109	-O*|-f*)
110	    optimize="$1"
111	    shift
112	    ;;
113	*)
114	    CFLAGS="$CFLAGS $1"
115	    shift
116	    ;;
117    esac
118done
119
120dnl Checks for header files.
121
122AC_HEADER_STDC
123AC_CHECK_HEADERS(assert.h unistd.h)
124
125AC_CHECK_HEADER(zlib.h, [], [
126	AC_MSG_ERROR([zlib.h was not found
127*** You must first install zlib (libz) before you can build this package.
128*** If zlib is already installed, you may need to use the CPPFLAGS
129*** environment variable to specify its installed location, e.g. -I<dir>.])
130])
131
132dnl Checks for typedefs, structures, and compiler characteristics.
133
134AC_C_CONST
135AC_C_INLINE
136
137dnl Checks for library functions.
138
139AC_CHECK_FUNCS(ftruncate)
140
141AC_CHECK_LIB(z, compress2, [], [
142	AC_MSG_ERROR([libz was not found
143*** You must first install zlib (libz) before you can build this package.
144*** If zlib is already installed, you may need to use the LDFLAGS
145*** environment variable to specify its installed location, e.g. -L<dir>.])
146])
147
148dnl handle --enable and --disable options
149
150AC_CACHE_SAVE
151
152AC_MSG_CHECKING([whether to enable profiling])
153AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling],
154			 [generate profiling code]),
155[
156    case "$enableval" in
157	yes) profile="-pg" ;;
158    esac
159])
160AC_MSG_RESULT(${enable_profiling-no})
161
162AC_MSG_CHECKING([whether to enable debugging])
163AC_ARG_ENABLE(debugging, AC_HELP_STRING([--enable-debugging],
164			 [enable diagnostic debugging support])
165AC_HELP_STRING([--disable-debugging],
166	       [do not enable debugging and use more optimization]),
167[
168    case "$enableval" in
169	yes)
170	    AC_DEFINE(DEBUG, 1,
171		[Define to enable diagnostic debugging support.])
172	    optimize=""
173	    ;;
174	no)
175	    if test -n "$profile"
176	    then
177    AC_MSG_ERROR(--enable-profiling and --disable-debugging are incompatible)
178	    fi
179
180	    AC_DEFINE(NDEBUG, 1,
181		[Define to disable debugging assertions.])
182	    debug=""
183	    if test "$GCC" = yes
184	    then
185		optimize="$optimize -fomit-frame-pointer"
186	    fi
187	    ;;
188    esac
189])
190AC_MSG_RESULT(${enable_debugging-default})
191AM_CONDITIONAL(DEBUG, test ${enable_debugging-default} = yes)
192
193dnl Create output files.
194
195test -n "$arch"     && CFLAGS="$CFLAGS $arch"
196test -n "$debug"    && CFLAGS="$CFLAGS $debug"
197test -n "$optimize" && CFLAGS="$CFLAGS $optimize"
198test -n "$profile"  && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile"
199
200dnl LTLIBOBJS=`echo "$LIBOBJS" | sed -e 's/\.o/.lo/g'`
201dnl AC_SUBST(LTLIBOBJS)
202
203AC_CONFIG_FILES([Makefile msvc++/Makefile  \
204	libid3tag.list])
205AC_OUTPUT
206