Use host system pkg-config when (cross-)compiling and convert to PKG_CHECK_MODULES
authorHugh McMaster <hugh.mcmaster@outlook.com>
Sun, 03 Feb 2019 20:06:18 +1100
changeset 12638df6da910d4d8
parent 12637 39c6ac8d722f
child 12639 1e4dd5933351
Use host system pkg-config when (cross-)compiling and convert to PKG_CHECK_MODULES

Fixes Bug 3575
configure.in
     1.1 --- a/configure.in	Sat Mar 16 00:08:19 2019 -0400
     1.2 +++ b/configure.in	Sun Feb 03 20:06:18 2019 +1100
     1.3 @@ -56,6 +56,7 @@
     1.4  AC_PROG_INSTALL
     1.5  AC_PROG_MAKE_SET
     1.6  AC_CHECK_TOOL(WINDRES, [windres], [:])
     1.7 +PKG_PROG_PKG_CONFIG
     1.8  
     1.9  dnl Make sure that srcdir is a full pathname
    1.10  case "$host" in
    1.11 @@ -932,20 +933,7 @@
    1.12  AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]),
    1.13                    , enable_jack=yes)
    1.14      if test x$enable_audio = xyes -a x$enable_jack = xyes; then
    1.15 -        audio_jack=no
    1.16 -
    1.17 -        JACK_REQUIRED_VERSION=0.125
    1.18 -
    1.19 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    1.20 -        AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support)
    1.21 -        if test x$PKG_CONFIG != xno; then
    1.22 -        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then
    1.23 -                JACK_CFLAGS=`$PKG_CONFIG --cflags jack`
    1.24 -                JACK_LIBS=`$PKG_CONFIG --libs jack`
    1.25 -                audio_jack=yes
    1.26 -            fi
    1.27 -        fi
    1.28 -        AC_MSG_RESULT($audio_jack)
    1.29 +        PKG_CHECK_MODULES([JACK], [jack >= 0.125], audio_jack=yes, audio_jack=no)
    1.30  
    1.31          if test x$audio_jack = xyes; then
    1.32              AC_ARG_ENABLE(jack-shared,
    1.33 @@ -1024,20 +1012,7 @@
    1.34  AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
    1.35                    , enable_pulseaudio=yes)
    1.36      if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
    1.37 -        audio_pulseaudio=no
    1.38 -
    1.39 -        PULSEAUDIO_REQUIRED_VERSION=0.9
    1.40 -
    1.41 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    1.42 -        AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
    1.43 -        if test x$PKG_CONFIG != xno; then
    1.44 -            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
    1.45 -                PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
    1.46 -                PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
    1.47 -                audio_pulseaudio=yes
    1.48 -            fi
    1.49 -        fi
    1.50 -        AC_MSG_RESULT($audio_pulseaudio)
    1.51 +        PKG_CHECK_MODULES([PULSEAUDIO], [libpulse-simple >= 0.9], audio_pulseaudio=yes, audio_pulseaudio=no)
    1.52  
    1.53          if test x$audio_pulseaudio = xyes; then
    1.54              AC_ARG_ENABLE(pulseaudio-shared,
    1.55 @@ -1236,20 +1211,7 @@
    1.56  AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
    1.57                    , enable_fusionsound=no)
    1.58      if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
    1.59 -        fusionsound=no
    1.60 -
    1.61 -        FUSIONSOUND_REQUIRED_VERSION=1.1.1
    1.62 -
    1.63 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    1.64 -        AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
    1.65 -        if test x$PKG_CONFIG != xno; then
    1.66 -            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
    1.67 -                FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
    1.68 -                FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
    1.69 -                fusionsound=yes
    1.70 -            fi
    1.71 -        fi
    1.72 -        AC_MSG_RESULT($fusionsound)
    1.73 +        PKG_CHECK_MODULES([FUSIONSOUND], [fusionsound >= 1.1.1], fusionsound=yes, fusionsound=no)
    1.74  
    1.75          if test x$fusionsound = xyes; then
    1.76              AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
    1.77 @@ -1461,11 +1423,9 @@
    1.78                    ,enable_video_wayland_qt_touch=yes)
    1.79  
    1.80      if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
    1.81 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    1.82          AC_MSG_CHECKING(for Wayland support)
    1.83          video_wayland=no
    1.84 -        if  test x$PKG_CONFIG != xno && \
    1.85 -            test x$video_opengl_egl = xyes && \
    1.86 +        if  test x$video_opengl_egl = xyes && \
    1.87              test x$video_opengles_v2 = xyes; then
    1.88              if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then
    1.89                  WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
    1.90 @@ -1567,26 +1527,26 @@
    1.91  CheckRPI()
    1.92  {
    1.93      AC_ARG_ENABLE(video-rpi,
    1.94 -AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
    1.95 -                  , enable_video_rpi=yes)
    1.96 +AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=no]]]),
    1.97 +                  , enable_video_rpi=no)
    1.98      if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
    1.99 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   1.100 -        if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then
   1.101 -            RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl`
   1.102 -            RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl`
   1.103 -        elif test x$ARCH = xnetbsd; then
   1.104 -            RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
   1.105 -            RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
   1.106 -        else
   1.107 -            RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
   1.108 -            RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
   1.109 +        PKG_CHECK_MODULES([RPI], [bcm_host brcmegl], video_rpi=yes, video_rpi=no)
   1.110 +
   1.111 +        if test x$video_rpi = xno; then
   1.112 +            if test x$ARCH = xnetbsd; then
   1.113 +                RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
   1.114 +                RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
   1.115 +            else
   1.116 +                RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
   1.117 +                RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
   1.118 +            fi
   1.119          fi
   1.120  
   1.121          # Save the original compiler flags and libraries
   1.122          ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
   1.123  
   1.124          # Add the Raspberry Pi compiler flags and libraries
   1.125 -        CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
   1.126 +        CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS"
   1.127  
   1.128          AC_MSG_CHECKING(for Raspberry Pi)
   1.129          have_video_rpi=no
   1.130 @@ -1607,7 +1567,7 @@
   1.131              CFLAGS="$CFLAGS $RPI_CFLAGS"
   1.132              SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
   1.133              EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
   1.134 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
   1.135 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
   1.136              SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
   1.137              AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
   1.138              SUMMARY_video="${SUMMARY_video} rpi"
   1.139 @@ -2106,32 +2066,8 @@
   1.140  AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
   1.141                    , enable_video_directfb=no)
   1.142      if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
   1.143 -        video_directfb=no
   1.144 -
   1.145 -        DIRECTFB_REQUIRED_VERSION=1.0.0
   1.146 -        AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
   1.147 -        if test x$DIRECTFBCONFIG = xno; then
   1.148 -            AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   1.149 -            if test x$PKG_CONFIG != xno; then
   1.150 -                if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
   1.151 -                    DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
   1.152 -                    DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
   1.153 -                    DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
   1.154 -                    video_directfb=yes
   1.155 -                fi
   1.156 -            fi
   1.157 -        else
   1.158 -            set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
   1.159 -            NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
   1.160 -            set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
   1.161 -            HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
   1.162 -            if test $HAVE_VERSION -ge $NEED_VERSION; then
   1.163 -                DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
   1.164 -                DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
   1.165 -                DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
   1.166 -                video_directfb=yes
   1.167 -            fi
   1.168 -        fi
   1.169 +        PKG_CHECK_MODULES([DIRECTFB], [directfb >= 1.0.0], video_directfb=yes, video_directfb=no)
   1.170 +
   1.171          if test x$video_directfb = xyes; then
   1.172              # SuSE 11.1 installs directfb-config without directfb-devel
   1.173              save_CPPFLAGS="$CPPFLAGS"
   1.174 @@ -2140,8 +2076,6 @@
   1.175              CPPFLAGS="$save_CPPFLAGS"
   1.176              video_directfb=$have_directfb_hdr
   1.177          fi
   1.178 -        AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
   1.179 -        AC_MSG_RESULT($video_directfb)
   1.180  
   1.181          if test x$video_directfb = xyes; then
   1.182              AC_ARG_ENABLE(directfb-shared,
   1.183 @@ -2188,68 +2122,44 @@
   1.184  
   1.185      if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
   1.186          video_kmsdrm=no
   1.187 -        libdrm_avail=no
   1.188 -        libgbm_avail=no
   1.189 -
   1.190 -        LIBDRM_REQUIRED_VERSION=2.4.46
   1.191 -        LIBGBM_REQUIRED_VERSION=9.0.0
   1.192 -
   1.193 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   1.194 -        if test x$PKG_CONFIG != xno; then
   1.195 -            if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then
   1.196 -                if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then
   1.197 -                    LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm`
   1.198 -                    LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm`
   1.199 -                    LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm`
   1.200 -                    libdrm_avail=yes
   1.201 -                fi
   1.202 -                if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then
   1.203 -                    LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm`
   1.204 -                    LIBGBM_LIBS=`$PKG_CONFIG --libs gbm`
   1.205 -                    LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm`
   1.206 -                    libgbm_avail=yes
   1.207 -                fi
   1.208 -                if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
   1.209 -                    video_kmsdrm=yes
   1.210 -                fi
   1.211 - 
   1.212 -                AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support)
   1.213 -                AC_MSG_RESULT($libdrm_avail)
   1.214 -                AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support)
   1.215 -                AC_MSG_RESULT($libgbm_avail)
   1.216 -
   1.217 -                if test x$video_kmsdrm = xyes; then
   1.218 -                    AC_ARG_ENABLE(kmsdrm-shared,
   1.219 +
   1.220 +        PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.4.46], libdrm_avail=yes, libdrm_avail=no)
   1.221 +        PKG_CHECK_MODULES([LIBGBM], [gbm >= 9.0.0], libgbm_avail=yes, libgbm_avail=no)
   1.222 +
   1.223 +        if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
   1.224 +            video_kmsdrm=yes
   1.225 +        fi
   1.226 +
   1.227 +        if test x$video_kmsdrm = xyes; then
   1.228 +            AC_ARG_ENABLE(kmsdrm-shared,
   1.229  AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]),
   1.230 -                              , enable_kmsdrm_shared=yes)
   1.231 -
   1.232 -                    AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
   1.233 -                    SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
   1.234 -                    EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
   1.235 -
   1.236 -                    AC_MSG_CHECKING(for kmsdrm dynamic loading support)
   1.237 -                    kmsdrm_shared=no
   1.238 -                    drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
   1.239 -                    gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
   1.240 -                    if test x$have_loadso != xyes && \
   1.241 -                       test x$enable_kmsdrm_shared = xyes; then
   1.242 -                        AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
   1.243 -                    fi
   1.244 -                    if test x$have_loadso = xyes && \
   1.245 -                       test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
   1.246 -                        kmsdrm_shared=yes
   1.247 -                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
   1.248 -                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
   1.249 -                        AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
   1.250 -                        SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
   1.251 -                    else
   1.252 -                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
   1.253 -                        SUMMARY_video="${SUMMARY_video} kmsdrm"
   1.254 -                    fi
   1.255 -                    AC_MSG_RESULT($kmsdrm_shared)
   1.256 -                    have_video=yes
   1.257 -                fi
   1.258 +                , enable_kmsdrm_shared=yes)
   1.259 +
   1.260 +            AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
   1.261 +            SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
   1.262 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
   1.263 +
   1.264 +            AC_MSG_CHECKING(for kmsdrm dynamic loading support)
   1.265 +            kmsdrm_shared=no
   1.266 +            drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
   1.267 +            gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
   1.268 +            if test x$have_loadso != xyes && \
   1.269 +               test x$enable_kmsdrm_shared = xyes; then
   1.270 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
   1.271              fi
   1.272 +            if test x$have_loadso = xyes && \
   1.273 +               test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
   1.274 +                kmsdrm_shared=yes
   1.275 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
   1.276 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
   1.277 +                AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
   1.278 +                SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
   1.279 +            else
   1.280 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
   1.281 +                SUMMARY_video="${SUMMARY_video} kmsdrm"
   1.282 +            fi
   1.283 +            AC_MSG_RESULT($kmsdrm_shared)
   1.284 +            have_video=yes
   1.285          fi
   1.286      fi
   1.287  }
   1.288 @@ -2639,20 +2549,17 @@
   1.289  AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
   1.290                          , enable_dbus=yes)
   1.291      if test x$enable_dbus = xyes; then
   1.292 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   1.293 -        if test x$PKG_CONFIG != xno; then
   1.294 -            DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
   1.295 -            save_CFLAGS="$CFLAGS"
   1.296 -            CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
   1.297 -            AC_CHECK_HEADER(dbus/dbus.h,
   1.298 -                            have_dbus_dbus_h_hdr=yes,
   1.299 -                            have_dbus_dbus_h_hdr=no)
   1.300 -            CFLAGS="$save_CFLAGS"
   1.301 -            if test x$have_dbus_dbus_h_hdr = xyes; then
   1.302 -                AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
   1.303 -                EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
   1.304 -                SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
   1.305 -            fi
   1.306 +        PKG_CHECK_MODULES([DBUS], [dbus-1])
   1.307 +        save_CFLAGS="$CFLAGS"
   1.308 +        CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
   1.309 +        AC_CHECK_HEADER(dbus/dbus.h,
   1.310 +                        have_dbus_dbus_h_hdr=yes,
   1.311 +                        have_dbus_dbus_h_hdr=no)
   1.312 +        CFLAGS="$save_CFLAGS"
   1.313 +        if test x$have_dbus_dbus_h_hdr = xyes; then
   1.314 +            AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
   1.315 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
   1.316 +            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
   1.317          fi
   1.318      fi
   1.319  }
   1.320 @@ -2676,33 +2583,30 @@
   1.321  AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
   1.322                    , enable_ibus=yes)
   1.323      if test x$enable_ibus = xyes; then
   1.324 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   1.325 -        if test x$PKG_CONFIG != xno; then
   1.326 -            IBUS_CFLAGS=`$PKG_CONFIG --cflags ibus-1.0`
   1.327 -            save_CFLAGS="$CFLAGS"
   1.328 -            CFLAGS="$save_CFLAGS $IBUS_CFLAGS"
   1.329 -            AC_CHECK_HEADER(ibus-1.0/ibus.h,
   1.330 -                            have_ibus_ibus_h_hdr=yes,
   1.331 -                            have_ibus_ibus_h_hdr=no)
   1.332 -            AC_CHECK_HEADER(sys/inotify.h,
   1.333 -                            have_inotify_inotify_h_hdr=yes,
   1.334 -                            have_inotify_inotify_h_hdr=no)
   1.335 -            CFLAGS="$save_CFLAGS"
   1.336 -            if test x$have_ibus_ibus_h_hdr = xyes; then
   1.337 -                if test x$enable_ime != xyes; then
   1.338 -                    AC_MSG_WARN([IME support is required for IBus.])
   1.339 -                    have_ibus_ibus_h_hdr=no
   1.340 -                elif test x$enable_dbus != xyes; then
   1.341 -                    AC_MSG_WARN([DBus support is required for IBus.])
   1.342 -                    have_ibus_ibus_h_hdr=no
   1.343 -                elif test x$have_inotify_inotify_h_hdr != xyes; then
   1.344 -                    AC_MSG_WARN([INotify support is required for IBus.])
   1.345 -                    have_ibus_ibus_h_hdr=no
   1.346 -                else
   1.347 -                    AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
   1.348 -                    EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
   1.349 -                    SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
   1.350 -               fi
   1.351 +        PKG_CHECK_MODULES([IBUS], [ibus-1.0])
   1.352 +        save_CFLAGS="$CFLAGS"
   1.353 +        CFLAGS="$save_CFLAGS $IBUS_CFLAGS"
   1.354 +        AC_CHECK_HEADER(ibus-1.0/ibus.h,
   1.355 +                        have_ibus_ibus_h_hdr=yes,
   1.356 +                        have_ibus_ibus_h_hdr=no)
   1.357 +        AC_CHECK_HEADER(sys/inotify.h,
   1.358 +                        have_inotify_inotify_h_hdr=yes,
   1.359 +                        have_inotify_inotify_h_hdr=no)
   1.360 +        CFLAGS="$save_CFLAGS"
   1.361 +        if test x$have_ibus_ibus_h_hdr = xyes; then
   1.362 +            if test x$enable_ime != xyes; then
   1.363 +                AC_MSG_WARN([IME support is required for IBus.])
   1.364 +                have_ibus_ibus_h_hdr=no
   1.365 +            elif test x$enable_dbus != xyes; then
   1.366 +                AC_MSG_WARN([DBus support is required for IBus.])
   1.367 +                have_ibus_ibus_h_hdr=no
   1.368 +            elif test x$have_inotify_inotify_h_hdr != xyes; then
   1.369 +                AC_MSG_WARN([INotify support is required for IBus.])
   1.370 +                have_ibus_ibus_h_hdr=no
   1.371 +            else
   1.372 +                AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
   1.373 +                EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
   1.374 +                SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
   1.375              fi
   1.376          fi
   1.377      fi
   1.378 @@ -2715,26 +2619,23 @@
   1.379  AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
   1.380                    , enable_fcitx=yes)
   1.381      if test x$enable_fcitx = xyes; then
   1.382 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   1.383 -        if test x$PKG_CONFIG != xno; then
   1.384 -            FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
   1.385 -            CFLAGS="$CFLAGS $FCITX_CFLAGS"
   1.386 -            AC_CHECK_HEADER(fcitx/frontend.h,
   1.387 -                            have_fcitx_frontend_h_hdr=yes,
   1.388 -                            have_fcitx_frontend_h_hdr=no)
   1.389 -            CFLAGS="$save_CFLAGS"
   1.390 -            if test x$have_fcitx_frontend_h_hdr = xyes; then
   1.391 -                if test x$enable_ime != xyes; then
   1.392 -                    AC_MSG_WARN([IME support is required for fcitx.])
   1.393 -                    have_fcitx_frontend_h_hdr=no
   1.394 -                elif test x$enable_dbus != xyes; then
   1.395 -                    AC_MSG_WARN([DBus support is required for fcitx.])
   1.396 -                    have_fcitx_frontend_h_hdr=no
   1.397 -                else
   1.398 -                    AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ])
   1.399 -                    EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
   1.400 -                    SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
   1.401 -               fi
   1.402 +        PKG_CHECK_MODULES([FCITX], [fcitx])
   1.403 +        CFLAGS="$CFLAGS $FCITX_CFLAGS"
   1.404 +        AC_CHECK_HEADER(fcitx/frontend.h,
   1.405 +                        have_fcitx_frontend_h_hdr=yes,
   1.406 +                        have_fcitx_frontend_h_hdr=no)
   1.407 +        CFLAGS="$save_CFLAGS"
   1.408 +        if test x$have_fcitx_frontend_h_hdr = xyes; then
   1.409 +            if test x$enable_ime != xyes; then
   1.410 +                AC_MSG_WARN([IME support is required for fcitx.])
   1.411 +                have_fcitx_frontend_h_hdr=no
   1.412 +            elif test x$enable_dbus != xyes; then
   1.413 +                AC_MSG_WARN([DBus support is required for fcitx.])
   1.414 +                have_fcitx_frontend_h_hdr=no
   1.415 +            else
   1.416 +                AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ])
   1.417 +                EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
   1.418 +                SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
   1.419              fi
   1.420          fi
   1.421      fi
   1.422 @@ -3282,16 +3183,13 @@
   1.423  AC_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]),
   1.424                    , enable_hidapi=no)
   1.425      if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
   1.426 +        PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
   1.427          hidapi_support=no
   1.428 -        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   1.429 -        if test x$PKG_CONFIG != xno; then
   1.430 -            LIBUSB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0`
   1.431 -            LIBUSB_LDFLAGS=`$PKG_CONFIG --libs libusb-1.0`
   1.432 -            save_CFLAGS="$CFLAGS"
   1.433 -            CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
   1.434 -            AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
   1.435 -            CFLAGS="$save_CFLAGS"
   1.436 -        fi
   1.437 +        save_CFLAGS="$CFLAGS"
   1.438 +        CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
   1.439 +        AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
   1.440 +        CFLAGS="$save_CFLAGS"
   1.441 +
   1.442          if test x$have_libusb_h = xyes; then
   1.443              hidapi_support=yes
   1.444              AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
   1.445 @@ -3299,7 +3197,7 @@
   1.446              SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
   1.447              SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
   1.448              EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
   1.449 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LDFLAGS"
   1.450 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
   1.451          fi
   1.452          AC_MSG_CHECKING(for hidapi support)
   1.453          AC_MSG_RESULT($hidapi_support)