[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to convert fowlloing code from configure to meson.build
From: |
Yonggang Luo |
Subject: |
How to convert fowlloing code from configure to meson.build |
Date: |
Fri, 18 Sep 2020 16:47:20 +0800 |
##########################################
# iconv probe
if test "$iconv" != "no" ; then
cat > $TMPC << EOF
#include <iconv.h>
int main(void) {
iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
return conv != (iconv_t) -1;
}
EOF
iconv_prefix_list="/usr/local:/usr"
iconv_lib_list=":-liconv"
IFS=:
for iconv_prefix in $iconv_prefix_list; do
IFS=:
iconv_cflags="-I$iconv_prefix/include"
iconv_ldflags="-L$iconv_prefix/lib"
for iconv_link in $iconv_lib_list; do
unset IFS
iconv_lib="$iconv_ldflags $iconv_link"
echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log
if compile_prog "$iconv_cflags" "$iconv_lib" ; then
iconv_found=yes
break
fi
done
if test "$iconv_found" = yes ; then
break
fi
done
if test "$iconv_found" = "yes" ; then
iconv=yes
else
if test "$iconv" = "yes" ; then
feature_not_found "iconv" "Install iconv devel"
fi
iconv=no
fi
fi
##########################################
# curses probe
if test "$iconv" = "no" ; then
# curses will need iconv
curses=no
fi
if test "$curses" != "no" ; then
if test "$mingw32" = "yes" ; then
curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null)
$($pkg_config --cflags ncursesw 2>/dev/null)"
curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null)
$($pkg_config --libs ncursesw 2>/dev/null)
-lpdcurses"
else
curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null)
-I/usr/include/ncursesw:"
curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null)
-lncursesw
-lcursesw"
fi
curses_found=no
cat > $TMPC << EOF
#include <locale.h>
#include <curses.h>
#include <wchar.h>
int main(void) {
wchar_t wch = L'w';
setlocale(LC_ALL, "");
resize_term(0, 0);
addwstr(L"wide chars\n");
addnwstr(&wch, 1);
add_wch(WACS_DEGREE);
return 0;
}
EOF
IFS='
' # turn off variable value expansion except for splitting at newlines
for curses_inc in $curses_inc_list; do
# Make sure we get the wide character prototypes
curses_inc="-DNCURSES_WIDECHAR $curses_inc"
IFS='
' # turn off variable value expansion except for splitting at newlines
for curses_lib in $curses_lib_list; do
unset IFS
if compile_prog "$curses_inc" "$curses_lib" ; then
curses_found=yes
break
fi
done
if test "$curses_found" = yes ; then
break
fi
done
unset IFS
if test "$curses_found" = "yes" ; then
curses=yes
else
if test "$curses" = "yes" ; then
feature_not_found "curses" "Install ncurses devel"
fi
curses=no
fi
fi
seems that need compile a program, but I didn't found a demo
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
- How to convert fowlloing code from configure to meson.build,
Yonggang Luo <=