]> granicus.if.org Git - jq/commitdiff
Preserve precious vars in configure.ac (fix #795)
authorNicolas Williams <nico@cryptonector.com>
Sun, 26 Feb 2017 03:49:38 +0000 (21:49 -0600)
committerNicolas Williams <nico@cryptonector.com>
Sun, 26 Feb 2017 03:49:38 +0000 (21:49 -0600)
configure.ac

index 06eca332fa92e57fae821d2d28289ec83ea13419..871900f32c6be410027cf55895fb550a5110e00c 100644 (file)
@@ -230,6 +230,8 @@ AC_ARG_WITH([oniguruma],
       [try this for a non-standard install prefix of the oniguruma library])], ,
    [with_oniguruma=yes])
 
+onig_CFLAGS=
+onig_LDFLAGS=
 build_oniguruma=no
 AS_IF([test "x$with_oniguruma" != xno], [
    save_CFLAGS="$CFLAGS"
@@ -240,17 +242,14 @@ AS_IF([test "x$with_oniguruma" != xno], [
       ], [
           onig_CFLAGS="-I${with_oniguruma}/include"
           onig_LDFLAGS="-L${with_oniguruma}/lib"
-          CFLAGS="$CFLAGS $onig_CFLAGS"
-          LDFLAGS="$LDFLAGS $onig_LDFLAGS"
       ])
    ])
    AS_IF([test "x$build_oniguruma" = xno], [
-       # check for ONIGURUMA library
+       # check for ONIGURUMA library, either in /usr or where requested
+       CFLAGS="$CFLAGS $onig_CFLAGS"
+       LDFLAGS="$LDFLAGS $onig_LDFLAGS"
        AC_CHECK_HEADER("oniguruma.h",
           AC_CHECK_LIB([onig],[onig_version]))
-       CFLAGS="$save_CFLAGS"
-       LDFLAGS="$save_LDFLAGS"
-
        # handle check results
        AS_IF([test "x$ac_cv_lib_onig_onig_version" != "xyes"], [
           build_oniguruma=yes
@@ -260,14 +259,14 @@ AS_IF([test "x$with_oniguruma" != xno], [
    AS_IF([test "x$build_oniguruma" = xyes], [
        onig_CFLAGS="-I${srcdir}/modules/oniguruma/src"
        onig_LDFLAGS="-L${srcdir}/modules/oniguruma/src -Wl,-rpath,${libdir}"
-       CFLAGS="$CFLAGS $onig_CFLAGS"
-       LDFLAGS="$LDFLAGS $onig_LDFLAGS"
        AC_CONFIG_SUBDIRS([modules/oniguruma])
        AC_DEFINE([HAVE_LIBONIG],1,[Define to 1 if the system includes libonig])
    ])
-   AC_SUBST(onig_CFLAGS)
-   AC_SUBST(onig_LDFLAGS)
+   CFLAGS="$save_CFLAGS"
+   LDFLAGS="$save_LDFLAGS"
 ])
+AC_SUBST(onig_CFLAGS)
+AC_SUBST(onig_LDFLAGS)
 
 AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes])
 AC_SUBST([BUNDLER], ["$bundle_cmd"])