Update to 0.28
[platform/upstream/pkg-config.git] / configure.ac
1 AC_PREREQ([2.62])
2 AC_INIT([pkg-config],
3         [0.28],
4         [https://bugs.freedesktop.org/enter_bug.cgi?product=pkg-config],
5         [pkg-config])
6
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_SRCDIR([main.c])
9
10 dnl Initialize automake and libtool
11 AM_INIT_AUTOMAKE([1.11])
12 LT_PREREQ([2.2])
13 LT_INIT
14
15 dnl Support silent build rules, requires at least automake-1.11. Disable
16 dnl by either passing --disable-silent-rules to configure or passing V=1
17 dnl to make
18 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
19
20 dnl Check for programs
21 AC_PROG_CC
22 AC_CHECK_PROG([LN], [ln], [ln], [cp -Rp])
23
24 dnl Check for headers
25 AC_CHECK_HEADERS([dirent.h unistd.h sys/wait.h malloc.h])
26
27 dnl A POSIX shell is required for the tests. If TEST_SHELL hasn't been
28 dnl set on the command line then we try to find bash or ksh or sh from
29 dnl the path. If none of those are available, we just use whatever
30 dnl autoconf detected for configure.
31 AC_ARG_VAR([TESTS_SHELL], [Path to a POSIX shell to be used for testing])
32 conf_path="$PATH:`getconf PATH 2>/dev/null`"
33 AC_PATH_PROGS([TESTS_SHELL], [bash ksh sh], [$CONFIG_SHELL], [$conf_path])
34
35 dnl
36 dnl Default pkg-config search path
37 dnl
38 AC_MSG_CHECKING([for default search path for .pc files])
39 AC_ARG_WITH([pc_path],
40   [AS_HELP_STRING([--with-pc-path],
41     [default search path for .pc files])],
42   [pc_path="$withval"],
43   [
44 # This is slightly wrong, but hopefully causes less confusion than
45 # people being unable to find their .pc files in the standard location.
46 if test "${prefix}" = "NONE"; then
47         pc_path='${libdir}/pkgconfig:${datadir}/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig'
48 else
49         pc_path='${libdir}/pkgconfig:${datadir}/pkgconfig'
50 fi
51 ])
52 AC_MSG_RESULT([$pc_path])
53 AC_SUBST([pc_path])
54
55 dnl
56 dnl System default -I paths
57 dnl
58 AC_MSG_CHECKING([for system include path to avoid -I flags])
59 AC_ARG_WITH([system_include_path],
60   [AS_HELP_STRING([--with-system-include-path],
61     [avoid -I flags from the given path])],
62   [system_include_path="$withval"],
63   [system_include_path="/usr/include"])
64 AC_MSG_RESULT([$system_include_path])
65 AC_SUBST([system_include_path])
66
67 dnl
68 dnl System default -L paths
69 dnl
70 AC_MSG_CHECKING([for system library path to avoid -L flags])
71 AC_ARG_WITH([system_library_path],
72   [AS_HELP_STRING([--with-system-library-path],
73     [avoid -L flags from the given path])],
74   [system_library_path="$withval"],
75   [
76 pc_lib_sfx=`echo "$libdir" | sed 's:.*/lib::'`
77 case "$pc_lib_sfx" in
78 */*|"")
79   system_library_path="/usr/lib:/lib"
80   ;;
81 *)
82   system_library_path="/usr/lib$pc_lib_sfx:/lib$pc_lib_sfx:/usr/lib:/lib"
83   ;;
84 esac
85 ])
86 AC_MSG_RESULT([$system_library_path])
87 AC_SUBST([system_library_path])
88
89 dnl Code taken from gtk+-2.0's configure.in.
90 dnl
91 dnl This causes pkg-config to not list private dependencies (a very
92 dnl common example is libm) on platforms which support inter-library
93 dnl dependencies.
94 dnl
95 dnl When using libtool 2.x, we need to force libtool to be created
96 dnl early so we can use it here.
97 m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
98
99 AC_ARG_ENABLE([indirect-deps],
100     [AS_HELP_STRING([--enable-indirect-deps],
101                     [list both direct and indirect dependencies.])
102      AS_HELP_STRING([--disable-indirect-deps],
103                     [only list direct dependencies.])
104     [default=auto]],
105     [use_indirect_deps=$enableval],
106     [use_indirect_deps=auto])
107 echo use_indirect_deps=$use_indirect_deps >&AS_MESSAGE_LOG_FD
108 AC_MSG_CHECKING([whether to list both direct and indirect dependencies])
109 case $use_indirect_deps in
110   auto)
111     deplibs_check_method=`(./libtool --config; echo eval echo '\"$deplibs_check_method\"') | sh`
112     if test "X$deplibs_check_method" = Xnone; then
113     echo "foo: $deplibs_check_method" >&AS_MESSAGE_LOG_FD
114       use_indirect_deps=yes
115     else
116       use_indirect_deps=no
117     fi
118   ;;
119   yes|no)
120   ;;
121   *) AC_MSG_ERROR([Value given to --enable-indirect-deps must be one of yes, no
122 or auto])
123   ;;
124 esac
125 AC_MSG_RESULT($use_indirect_deps)
126 AC_DEFINE_UNQUOTED([ENABLE_INDIRECT_DEPS],
127     [`test $use_indirect_deps = yes && echo TRUE || echo FALSE`],
128     [Link library to all dependent libraries, not only directly needed ones])
129 AC_SUBST([use_indirect_deps])
130
131 dnl
132 dnl Choose default CFLAGS and warnings depending on compiler.
133 dnl
134 WARN_CFLAGS=""
135 if test "${GCC}" = "yes" && test "${ac_env_CFLAGS_set}" != "set"; then
136    WARN_CFLAGS="-g -Wall -O2"
137 fi
138 AC_SUBST(WARN_CFLAGS)
139
140 AC_MSG_CHECKING([for Win32])
141 case "$build" in
142   *-*-mingw*)
143     native_win32=yes
144   ;;
145   *)
146     native_win32=no
147   ;;
148 esac
149 AC_MSG_RESULT([$native_win32])
150 AM_CONDITIONAL(NATIVE_WIN32, [test "x$native_win32" = xyes])
151
152 dnl
153 dnl Find glib or use internal copy. Required version is 2.16 for
154 dnl g_win32_get_package_installation_directory_of_module().
155 dnl
156 dnl Pull in pkg-config macros to find external glib.
157 dnl
158 m4_include([pkg.m4])
159 m4_define([glib_module], [glib-2.0 >= 2.16])
160 AC_ARG_WITH([internal-glib],
161   [AS_HELP_STRING([--with-internal-glib], [use internal glib])],
162   [with_internal_glib="$withval"],
163   [with_internal_glib=no])
164 AM_CONDITIONAL([INTERNAL_GLIB], [test "x$with_internal_glib" = xyes])
165 AC_MSG_CHECKING([if internal glib should be used])
166 if test "x$with_internal_glib" = xyes; then
167   AC_MSG_RESULT([yes])
168   GLIB_CFLAGS='-I$(top_srcdir)/glib -I$(top_srcdir)/glib/glib \
169     -I$(top_builddir)/glib/glib'
170   GLIB_LIBS='$(top_builddir)/glib/glib/libglib-2.0.la'
171   AC_CONFIG_SUBDIRS([glib])
172 else
173   AC_MSG_RESULT([no])
174   PKG_CHECK_MODULES([GLIB], glib_module, [], [AC_MSG_ERROR([]dnl
175 [m4_normalize([Either a previously installed pkg-config or "]glib_module["
176               could not be found. Please set GLIB_CFLAGS and GLIB_LIBS to
177               the correct values or pass --with-internal-glib to configure
178               to use the bundled copy.])])])
179 fi
180 AC_SUBST(GLIB_LIBS)
181 AC_SUBST(GLIB_CFLAGS)
182
183 dnl
184 dnl Optional gcov test coverage usage
185 dnl
186 AC_ARG_WITH([gcov],
187   [AS_HELP_STRING([--with-gcov], [gcov test coverage @<:@default=no@:>@])],
188   [],
189   [with_gcov=no])
190 if test "x$with_gcov" = xyes; then
191   if test "$GCC" = no; then
192     AC_MSG_ERROR([gcov test coverage can only be used with GCC])
193   fi
194
195   AC_PATH_PROG([GCOV], [gcov], [AC_MSG_ERROR([could not find gcov program])])
196   GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
197
198   # Ensure there's no optimizing since last -O wins and CFLAGS is used
199   # at the end of COMPILE/LTCOMPILE.
200   CFLAGS="${CFLAGS+$CFLAGS }-O0"
201 fi
202 AC_SUBST([GCOV_CFLAGS])
203
204 dnl See if the user wants a host- prefixed tool
205 dnl (e.g. i686-pc-linux-gnu-pkg-config) to be installed.
206 dnl
207 AC_MSG_CHECKING([if host- prefixed tool should be installed])
208 AC_ARG_ENABLE([host-tool],
209   [AS_HELP_STRING([--disable-host-tool],
210     [install link to pkg-config with $host- prefix @<:@default=yes@:>@])],
211   [],
212   [enable_host_tool=yes])
213 AC_MSG_RESULT([$enable_host_tool])
214 AM_CONDITIONAL([HOST_TOOL], [test "x$enable_host_tool" = xyes])
215
216 AC_CONFIG_FILES([
217 Makefile
218 check/Makefile
219 check/config.sh
220 ])
221 AC_OUTPUT