File: configure.ac

package info (click to toggle)
mpc 0.26-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 760 kB
  • ctags: 323
  • sloc: ansic: 3,046; sh: 1,541; makefile: 45
file content (173 lines) | stat: -rw-r--r-- 3,502 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
AC_PREREQ(2.60)
AC_INIT(mpc, 0.26, musicpd-dev-team@lists.sourceforge.net)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/main.c)
AM_INIT_AUTOMAKE([foreign 1.11 dist-xz silent-rules])
AC_CONFIG_HEADERS(config.h)


dnl
dnl programs
dnl

AC_PROG_CC_C99
AC_PROG_INSTALL
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG


dnl
dnl declare variables
dnl

AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)


dnl
dnl OS specific defaults
dnl

case "$host" in
*-mingw32* | *-windows* | *-cygwin*)
	AM_CFLAGS="$AM_CFLAGS -mms-bitfields -fno-strict-aliasing"
	;;
esac

if test -z "$prefix" || test "x$prefix" = xNONE; then
	local_lib=
	local_include=

	# aren't autotools supposed to be smart enough to figure this out?
	# oh well, the git-core Makefile managed to do some of the work for us :)
	case "`uname -s | tr A-Z a-z`" in
	darwin*)
		local_lib='/sw/lib /opt/local/lib'
		local_include='/sw/include /opt/local/include'
		;;
	freebsd* | openbsd*)
		local_lib=/usr/local/lib
		local_include=/usr/local/include
		;;
	netbsd*)
		local_lib=/usr/pkg/lib
		local_include=/usr/pkg/include
		LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/pkg/lib"
		;;
	esac

	for d in $local_lib; do
		if test -d "$d"; then
			LDFLAGS="$LDFLAGS -L$d"
			break
		fi
	done
	for d in $local_include; do
		if test -d "$d"; then
			CFLAGS="$CFLAGS -I$d"
			break
		fi
	done
fi


dnl
dnl libc features
dnl

PKG_CHECK_MODULES([LIBMPDCLIENT], [libmpdclient >= 2.3],,
	[AC_MSG_ERROR([libmpdclient 2.3 is required])])


dnl
dnl i18n / l10n (iconv)
dnl

AC_ARG_ENABLE(iconv,
	AS_HELP_STRING([--disable-iconv],
		[disable iconv support (default: enable)]),,
	[enable_iconv=yes])

if test x$enable_iconv = xyes; then
	AC_CHECK_FUNC(iconv,
		[ICONV_CFLAGS="" ICONV_LIBS=""],
		[AC_CHECK_LIB(intl, iconv,
			[ICONV_CFLAGS="" ICONV_LIBS="-lintl"],
			[enable_iconv=no])])
fi

if test x$enable_iconv = xyes; then
	AM_LANGINFO_CODESET
	if test x$am_cv_langinfo_codeset != xyes; then
		enable_iconv=no
		AC_MSG_WARN(nl_langinfo and CODESET not available - disabling iconv)
	fi
fi

if test x$enable_iconv = xyes; then
	AC_CHECK_HEADER([locale.h],, [enable_iconv=no])
	if test x$enable_iconv != xyes; then
		AC_MSG_WARN(locale.h not available - disabling iconv)
	fi
fi

if test x$enable_iconv = xyes; then
	AC_DEFINE(HAVE_ICONV, 1, [Define if iconv() support is enabled])
else
	ICONV_CPPFLAGS=""
	ICONV_LIBS=""
fi

AC_SUBST(ICONV_CPPFLAGS)
AC_SUBST(ICONV_LIBS)

AM_CONDITIONAL(HAVE_ICONV, test x$enable_iconv = xyes)


dnl
dnl CFLAGS
dnl

AX_APPEND_COMPILE_FLAGS([-Wall])
AX_APPEND_COMPILE_FLAGS([-Wextra])
AX_APPEND_COMPILE_FLAGS([-Wno-deprecated-declarations])
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes])
AX_APPEND_COMPILE_FLAGS([-Wshadow])
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes])
AX_APPEND_COMPILE_FLAGS([-Wcast-qual])
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])


dnl
dnl build options
dnl

AC_ARG_ENABLE(werror,
	AS_HELP_STRING([--enable-werror],
		[Treat warnings as errors @<:@default=disabled@:>@]),
	enable_werror=no)

if test "x$enable_werror" = xyes; then
	AM_CFLAGS="$AM_CFLAGS -Werror -pedantic-errors"
fi

AC_ARG_ENABLE(debug,
	AS_HELP_STRING([--enable-debug],
		[Enable debugging @<:@default=disabled@:>@]),
	enable_debug=no)

if test "x$enable_debug" = xno; then
	AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"

	AX_APPEND_COMPILE_FLAGS([-ffunction-sections])
	AX_APPEND_COMPILE_FLAGS([-fdata-sections])
	AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])

	AX_APPEND_LINK_FLAGS([-Wl,--gc-sections])
fi


dnl

AC_OUTPUT(Makefile)