summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 5fb37e86217118ec45225e5ade36e7d61d131636 (plain)
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
ENV_CFLAGS=$CFLAGS
CFLAGS=""

AC_PREREQ(2.59)
dnl Update it right before the release since $pkgver_foo are all _post_ release snapshots
AC_INIT([Pacman package manager], 3.0.0, [pacman-dev@archlinux.org], pacman)
AC_LANG(C)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.13.1)

dnl Host dependant flags
case "${host}" in
	*-*-cygwin*)
		ENV_CFLAGS="$ENV_CFLAGS -DCYGWIN"
		;;
esac

dnl Define here the libalpm version number
PM_MAJOR_VERSION=0
PM_MINOR_VERSION=1
PM_MICRO_VERSION=0
PM_VERSION=$PM_MAJOR_VERSION.$PM_MINOR_VERSION.$PM_MICRO_VERSION
dnl Needed for libtool to create proper shared lib version
PM_VERSION_INFO=`expr $PM_MAJOR_VERSION + $PM_MINOR_VERSION`:$PM_MICRO_VERSION:$PM_MINOR_VERSION

AC_SUBST(PM_MAJOR_VERSION)
AC_SUBST(PM_MINOR_VERSION)
AC_SUBST(PM_MICRO_VERSION)
AC_SUBST(PM_VERSION)
AC_SUBST(PM_VERSION_INFO)

dnl Put out version numbers to config.h
AC_DEFINE_UNQUOTED([PM_VERSION], ["$PM_VERSION"], [libalpm version number])

dnl Configuration files
dnl AC_CONFIG_FILES([etc/makepkg.conf] [etc/pacman.conf])

AC_PROG_CC
AC_HEADER_STDC
AC_PROG_INSTALL
AC_CHECK_FUNCS([strverscmp])
AM_PROG_LIBTOOL
AM_CONDITIONAL(LINKSTATIC, test "$enable_static" = "yes")

dnl Humor lowers blood pressure
AC_MSG_CHECKING(your blood pressure)
AC_MSG_RESULT([a bit high, but we can proceed])

dnl Help line for man2html
AC_ARG_ENABLE(man2html,
    AC_HELP_STRING([--enable-man2html], [Build html docs via man2html]),
    [wantman2html=$enableval], [wantman2html=no])

dnl Help line for po4a
AC_ARG_ENABLE(po4a,
    AC_HELP_STRING([--disable-po4a], [Build localized manpages via po4a]),
    [wantpo4a=$enableval], [wantpo4a=yes])

dnl Help line for doxygen
AC_ARG_ENABLE(doxygen,
    AC_HELP_STRING([--disable-doxygen], [Build API docs via Doxygen]),
    [wantdoxygen=$enableval], [wantdoxygen=yes])

dnl Help line for python
AC_ARG_ENABLE(python,
    AC_HELP_STRING([--disable-python], [Build Python bindings]),
    [wantpython=$enableval], [wantpython=yes])

dnl Help line for perl
AC_ARG_ENABLE(perl,
    AC_HELP_STRING([--disable-perl], [Build Perl bindings]),
    [wantperl=$enableval], [wantperl=yes])

dnl Help line for java
AC_ARG_ENABLE(java,
    AC_HELP_STRING([--disable-java], [Build Java bindings]),
    [wantjava=$enableval], [wantjava=yes])

dnl Check for architecture
case "$host" in
	i686-*) AC_DEFINE_UNQUOTED([CARCH], ["i686"], [Architecture])
		AC_DEFINE_UNQUOTED([CARCHFLAGS], ["i686"], [Architecture])
		AC_DEFINE_UNQUOTED([MARCHFLAG], ["march"], [Architecture])
		CARCH="i686"
		CARCHFLAGS="i686"
		MARCHFLAG="march"
		CHOST="${host}"
		;;
	x86_64-*) AC_DEFINE_UNQUOTED([CARCH], ["x86_64"], [Architecture])
		AC_DEFINE_UNQUOTED([CARCHFLAGS], ["k8"], [Architecture])
		AC_DEFINE_UNQUOTED([MARCHFLAG], ["march"], [Architecture])
		CARCH="x86_64"
		CARCHFLAGS="k8"
		MARCHFLAG="march"
		CHOST="${host}"
		;;
	ia64-*) AC_DEFINE_UNQUOTED([CARCH], ["ia64"], [Architecture])
		AC_DEFINE_UNQUOTED([CARCHFLAGS], ["ia64"], [Architecture])
		AC_DEFINE_UNQUOTED([MARCHFLAG], ["march"], [Architecture])
		CARCH="ia64"
		CARCHFLAGS="ia64"
		MARCHFLAG="march"
		CHOST="${host}"
		;;
	sparc-*) AC_DEFINE_UNQUOTED([CARCH], ["sparc"], [Architecture])
		AC_DEFINE_UNQUOTED([CARCHFLAGS], ["v9"], [Architecture])
		AC_DEFINE_UNQUOTED([MARCHFLAG], ["mcpu"], [Architecture])
		CARCH="sparc"
		CARCHFLAGS="v9"
		MARCHFLAG="mcpu"
		CHOST="${host}"
		;;
	ppc-* | powerpc-*)
		AC_DEFINE_UNQUOTED([CARCH], ["ppc"], [Architecture])
		AC_DEFINE_UNQUOTED([CARCHFLAGS], ["750"], [Architecture])
		AC_DEFINE_UNQUOTED([MARCHFLAG], ["mcpu"], [Architecture])
		CARCH="ppc"
		CARCHFLAGS="750"
		MARCHFLAG="mcpu"
		CHOST="${host}"
		;;
	i386-*) AC_DEFINE_UNQUOTED([CARCH], ["i386"], [Architecture])
		AC_DEFINE_UNQUOTED([CARCHFLAGS], ["i386"], [Architecture])
		AC_DEFINE_UNQUOTED([MARCHFLAG], ["march"], [Architecture])
		CARCH="i386"
		CARCHFLAGS="i386"
		MARCHFLAG="march"
		CHOST="${host}"
		;;
	*)
		AC_MSG_ERROR([Your architecture is not supported])
		;;
esac

AC_SUBST(CARCH)
AC_SUBST(CARCHFLAGS)
AC_SUBST(MARCHFLAG)
AC_SUBST(CHOST)

dnl Help line for config file
AC_ARG_WITH(config-file,
    AC_HELP_STRING([  --with-config-file=path], [Set the name and path for pacman's config file]),
    [configfile=$withval], [configfile=/etc/pacman.conf])

dnl Help line for debug
AC_ARG_ENABLE(debug,
    AC_HELP_STRING([--enable-debug], [Enable debugging support]),
    [debug=$enableval], [debug=no])

dnl Help line for fakeroot
AC_ARG_ENABLE(fakeroot,
    AC_HELP_STRING([--disable-fakeroot], [Disable fakeroot proof support]),
    [fakeroot=$enableval], [fakeroot=yes])

dnl Check for man2html binary
AC_MSG_CHECKING(for support man2html)
if test x$wantman2html = xyes ; then
    AC_CHECK_PROGS([MAN2HTML], [man2html])
    AM_CONDITIONAL(HAS_MAN2HTML, test $MAN2HTML)
    if test $MAN2HTML ; then
        AC_DEFINE([HAS_MAN2HTML], [TRUE], [Enabled HTML generation from man via man2html])
	AC_MSG_RESULT(yes)
    else
        AC_DEFINE([HAS_MAN2HTML], [FALSE], [Disabled HTML generation from man via man2html])
	AC_MSG_RESULT(no, man2html missing)
    fi
else
    AM_CONDITIONAL(HAS_MAN2HTML, test $MAN2HTML)
    AC_DEFINE([HAS_MAN2HTML], [FALSE], [Not specified at configure line])
    AC_MSG_RESULT(not requested by configure)
fi

dnl Check for po4a binary
AC_MSG_CHECKING(for support po4a)
if test x$wantpo4a = xyes ; then
    AC_CHECK_PROGS([PO4A], [po4a])
    AM_CONDITIONAL(HAS_PO4A, test $PO4A)
    if test $PO4A ; then
        AC_DEFINE([HAS_PO4A], [TRUE], [Enabled PO4A (localization support for manpages)])
	AC_MSG_RESULT(yes)
	POSTATUS="yes, path: `which $PO4A`"
    else
        AC_DEFINE([HAS_PO4A], [FALSE], [Disabled PO4A (localization support for manpages)])
	AC_MSG_RESULT(no, po4a binary missing)
	POSTATUS="no, missing po4a binary"
    fi
else
    AM_CONDITIONAL(HAS_PO4A, test $PO4A)
    AC_DEFINE([HAS_PO4A], [FALSE], [Not specified at configure line])
    AC_MSG_RESULT(not requested by configure)
    POSTATUS="no, disabled by configure"
fi

dnl Check for doxygen support
if test x$wantdoxygen = xyes ; then
    AC_CHECK_PROGS([DOXYGEN], [doxygen])
    if test $DOXYGEN ; then
	DOXYSTATUS="yes, path: `which $DOXYGEN`"
    else
	DOXYSTATUS="doxygen binary not found"
    fi
else
    DOXYSTATUS="no, disabled by configure"
fi
AM_CONDITIONAL(HAS_DOXYGEN, test $DOXYGEN)

dnl Check for math
AC_CHECK_LIB([m], [sqrt], [AC_CHECK_HEADER([math.h], [LIBM='-lm'])])
if test -z "$LIBM"; then
    AC_MSG_ERROR("math library needed to compile pacman!");
fi

dnl Check for libarchive
AC_CHECK_LIB([archive], [archive_read_data], [AC_CHECK_HEADER([archive.h], [LIBARCHIVE='-larchive'])])
if test -z "$LIBARCHIVE"; then
    AC_MSG_ERROR("libarchive is needed to compile pacman!");
fi

dnl Check for libdownload
AC_CHECK_LIB([download], [downloadParseURL], [AC_CHECK_HEADER([download.h], [LIBDOWNLOAD='-ldownload'])])
if test -z "$LIBDOWNLOAD"; then
    AC_MSG_ERROR("libdownload is needed to compile pacman!");
fi

dnl Set config location
AC_MSG_CHECKING(for configuration file name)
if test -n "$configfile"; then
    CFLAGS="$CFLAGS -D'PACCONF=\"$configfile\"'"
    AC_MSG_RESULT(["$configfile"])
else
    AC_MSG_ERROR(["pacman config file (--with-config-file is not set"])
fi

dnl Enable or disable debug code
AC_MSG_CHECKING(for debug mode request)
if test "$debug" = "yes" ; then
    AM_CONDITIONAL(PACMAN_DEBUG, test "$debug" = "yes")
	CFLAGS="$CFLAGS -g -Wall -Werror -std=c99 -DPACMAN_DEBUG"
	LDFLAGS="$LDFLAGS -lmcheck"
    AC_MSG_RESULT(yes)
else
    AM_CONDITIONAL(PACMAN_DEBUG, test "$debug" = "no")
	CFLAGS="$CFLAGS -Wall -std=c99"
    AC_MSG_RESULT(no)
fi

dnl Enable or disable fakeroot code
AC_MSG_CHECKING(for fakeroot proof support)
if test "$fakeroot" = "yes" ; then
	AC_MSG_RESULT(yes)
else
	CFLAGS="$CFLAGS -DFAKEROOT"
	AC_MSG_RESULT(no)
fi

dnl ==========================================================================

AC_OUTPUT([
lib/libalpm/Makefile
lib/libalpm/po/Makefile.in
src/pacman/Makefile
src/pacman/po/Makefile.in
src/util/Makefile
scripts/Makefile
doc/Makefile
doc/makepkg.8
doc/libalpm.3
doc/pacman.8
doc/hu/Makefile
etc/Makefile
etc/makepkg.conf
etc/pacman.conf
etc/pacman.d/Makefile
etc/pacman.d/mirrorlist
etc/abs/Makefile
bindings/perl/Makefile
bindings/python/Makefile
bindings/java/Makefile
Makefile
])

echo "
pacman-$VERSION:

    prefix                   : ${prefix}
    source code location     : ${srcdir}
    compiler                 : ${CC}
    compiler flags           : ${CFLAGS}

    libalpm version          : ${PM_VERSION}
    pacman.conf location     : ${configfile}

    Architecture CARCH       : ${CARCH}
    Architecture used cflag  : ${CARCHFLAGS}
    Architecture CHOST       : ${CHOST}

    Doxygen support          : ${DOXYSTATUS}
    Manpage localization     : ${POSTATUS}

    debug support            : ${debug}
"