4 [https://bugs.freedesktop.org/enter_bug.cgi?product=pkg-config],
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_SRCDIR([main.c])
10 dnl Initialize automake and libtool
11 AM_INIT_AUTOMAKE([1.11])
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
18 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
20 dnl Check for programs
22 AC_CHECK_PROG([LN], [ln], [ln], [cp -Rp])
25 AC_CHECK_HEADERS([dirent.h unistd.h sys/wait.h malloc.h])
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])
36 dnl Default pkg-config search path
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])],
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'
49 pc_path='${libdir}/pkgconfig:${datadir}/pkgconfig'
52 AC_MSG_RESULT([$pc_path])
56 dnl System default -I paths
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])
68 dnl System default -L paths
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"],
76 pc_lib_sfx=`echo "$libdir" | sed 's:.*/lib::'`
79 system_library_path="/usr/lib:/lib"
82 system_library_path="/usr/lib$pc_lib_sfx:/lib$pc_lib_sfx:/usr/lib:/lib"
86 AC_MSG_RESULT([$system_library_path])
87 AC_SUBST([system_library_path])
89 dnl Code taken from gtk+-2.0's configure.in.
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
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])
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.])
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
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
121 *) AC_MSG_ERROR([Value given to --enable-indirect-deps must be one of yes, no
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])
132 dnl Choose default CFLAGS and warnings depending on compiler.
135 if test "${GCC}" = "yes" && test "${ac_env_CFLAGS_set}" != "set"; then
136 WARN_CFLAGS="-g -Wall -O2"
138 AC_SUBST(WARN_CFLAGS)
140 AC_MSG_CHECKING([for Win32])
149 AC_MSG_RESULT([$native_win32])
150 AM_CONDITIONAL(NATIVE_WIN32, [test "x$native_win32" = xyes])
153 dnl Find glib or use internal copy. Required version is 2.16 for
154 dnl g_win32_get_package_installation_directory_of_module().
156 dnl Pull in pkg-config macros to find external glib.
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
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])
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.])])])
181 AC_SUBST(GLIB_CFLAGS)
184 dnl Optional gcov test coverage usage
187 [AS_HELP_STRING([--with-gcov], [gcov test coverage @<:@default=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])
195 AC_PATH_PROG([GCOV], [gcov], [AC_MSG_ERROR([could not find gcov program])])
196 GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
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"
202 AC_SUBST([GCOV_CFLAGS])
204 dnl See if the user wants a host- prefixed tool
205 dnl (e.g. i686-pc-linux-gnu-pkg-config) to be installed.
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@:>@])],
212 [enable_host_tool=yes])
213 AC_MSG_RESULT([$enable_host_tool])
214 AM_CONDITIONAL([HOST_TOOL], [test "x$enable_host_tool" = xyes])