configure: make iconv tests aware of user arguments
--with-iconv is now taken into account when doing the tests for iconv. If the user requests alternate handling for libiconv, the -liconv test is run before the -lc test. Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ben Walton committed
Mar 12, 2009 at 15:20 UTC
a8304f7a70832a8e333fcf547589bc9d3bc0ca3c
1 file changed
+34
-14
configure.ac
+34
-14
@@ -375,20 +375,35 @@ int main(void)
375
return 0;
376
}
377
])
378
-AC_MSG_CHECKING([for iconv in -lc])
379
-AC_LINK_IFELSE(ICONVTEST_SRC,
378
+
379
+if test -n "$ICONVDIR"; then
380
+ lib_order="-liconv -lc"
381
+else
382
+ lib_order="-lc -liconv"
383
+fi
384
+
385
+NO_ICONV=YesPlease
386
+
387
+for l in $lib_order; do
388
+ if test "$l" = "-liconv"; then
389
+ NEEDS_LIBICONV=YesPlease
390
+ else
391
+ NEEDS_LIBICONV=
392
+ fi
393
+
394
+ old_LIBS="$LIBS"
395
+ LIBS="$LIBS $l"
396
+ AC_MSG_CHECKING([for iconv in $l])
397
+ AC_LINK_IFELSE(ICONVTEST_SRC,
398
[AC_MSG_RESULT([yes])
381
- NEEDS_LIBICONV=],
382
- [AC_MSG_RESULT([no])
383
- old_LIBS="$LIBS"
384
- LIBS="$LIBS -liconv"
385
- AC_MSG_CHECKING([for iconv in -liconv])
386
- AC_LINK_IFELSE(ICONVTEST_SRC,
387
- [AC_MSG_RESULT([yes])
388
- NEEDS_LIBICONV=YesPlease],
389
- [AC_MSG_RESULT([no])
390
- NO_ICONV=YesPlease])
391
- LIBS="$old_LIBS"])
399
+ NO_ICONV=
400
+ break],
401
+ [AC_MSG_RESULT([no])])
402
+ LIBS="$old_LIBS"
403
+done
404
+
405
+#in case of break
406
+LIBS="$old_LIBS"
407
408
GIT_UNSTASH_FLAGS($ICONVDIR)
409
@@ -455,13 +470,18 @@ int main(void)
470
return 0;
471
}
472
]])
473
+
474
+GIT_STASH_FLAGS($ICONVDIR)
475
+
476
AC_MSG_CHECKING([for old iconv()])
477
AC_COMPILE_IFELSE(OLDICONVTEST_SRC,
478
[AC_MSG_RESULT([no])],
479
[AC_MSG_RESULT([yes])
480
OLD_ICONV=UnfortunatelyYes])
463
-AC_SUBST(OLD_ICONV)
481
482
+GIT_UNSTASH_FLAGS($ICONVDIR)
483
+
484
+AC_SUBST(OLD_ICONV)
485
486
## Checks for typedefs, structures, and compiler characteristics.
487
AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])