diff --git pmount/configure.ac pmount/configure.ac index 054fa34..4b2967c 100644 --- pmount/configure.ac +++ pmount/configure.ac @@ -72,6 +72,21 @@ else fi AM_CONDITIONAL(PMOUNT_HAL, test -n "$BUILD_HAL") +AC_ARG_WITH(natspec, + AC_HELP_STRING([--with-natspec], [enable automatic iocharset mount option determination (default: no)]), + [], + [with_natspec=no] +) + +if test "$with_natspec" != "no"; then + AC_CHECK_HEADER(natspec.h, + [AC_CHECK_LIB(natspec, natspec_get_filename_encoding, + [LIBS="$LIBS -lnatspec"], + [AC_MSG_ERROR([Missing natspec library (install libnatspec-devel or similar?)])])], + [AC_MSG_ERROR([Missing /usr/include/natspec.h (install libnatspec-devel or similar?)])]) + AC_DEFINE(BUILD_NATSPEC, 1, [defined if natspec should be used]) +fi + AC_ARG_ENABLE(ruid-root-cryptsetup, AC_HELP_STRING([--enable-ruid-root-cryptsetup],[Run cryptsetup with RUID = root]), [case $enableval in diff --git pmount/src/pmount.c pmount/src/pmount.c index 2b2df4a..6795531 100644 --- pmount/src/pmount.c +++ pmount/src/pmount.c @@ -35,6 +35,12 @@ #include #endif +#ifdef BUILD_NATSPEC +#include "natspec.h" +#endif + + + /* Using our private realpath function */ #include "realpath.h" @@ -805,14 +811,23 @@ main( int argc, char** argv ) /* if no charset was set explicitly, autodetect UTF-8 */ if( !iocharset ) { const char* codeset; - codeset = nl_langinfo( CODESET ); +#ifdef BUILD_NATSPEC + codeset = natspec_get_filename_encoding(""); debug( "no iocharset given, current locale encoding is %s\n", codeset ); + debug("no iocharset given, using libnatspec: %s\n",codeset); + iocharset = strdup(codeset); +#else + codeset = nl_langinfo( CODESET ); + debug( "no iocharset given, current locale encoding is %s\n", codeset ); if( codeset && !strcmp( codeset, "UTF-8" ) ) { debug( "locale encoding uses UTF-8, setting iocharset to 'utf8'\n" ); iocharset = "utf8"; } +#endif + + } /* If user did not choose explicitly for or against utf8 */ if( utf8 == -1 ) {