From 8e2e05e4bd041b559a0352f0ad93729b7b65db91 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Fri, 7 Sep 2012 15:30:51 +0300 Subject: Rename configure.in to configure.ac --- configure.ac | 316 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 316 ----------------------------------------------------------- 2 files changed, 316 insertions(+), 316 deletions(-) create mode 100644 configure.ac delete mode 100644 configure.in diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..03cc091 --- /dev/null +++ b/configure.ac @@ -0,0 +1,316 @@ +AC_INIT(main.cc) +AM_INIT_AUTOMAKE(geresh, 0.6.3) +AM_CONFIG_HEADER(config.h) + +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CXX +AC_PROG_CXXCPP +AC_PROG_INSTALL + +AC_LANG_CPLUSPLUS + +AC_ARG_PROGRAM + +debugging_support=no +AC_ARG_ENABLE(debug, +[ --enable-debug Enable debugging support], +[ if test "$enableval" = yes; then + debugging_support=yes + AC_DEFINE(DEBUG) + fi +]) + +dnl ---- fribidi ---- + +if test "x$FRIBIDI_CONFIG" = x; then + AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config) +fi + +test "x$FRIBIDI_CONFIG" = x && AC_MSG_ERROR(Can't locate the fribidi-config program) +test ! -x "$FRIBIDI_CONFIG" && AC_MSG_ERROR(Can't execute the program '$FRIBIDI_CONFIG') + + +FRIBIDI_CXXFLAGS=`$FRIBIDI_CONFIG --cflags` +if test "x$FRIBIDI_CXXFLAGS" = x-I/usr/include; then + AC_CHECK_HEADER(fribidi/fribidi.h, , [CXXFLAGS="$CXXFLAGS $FRIBIDI_CXXFLAGS"]) +else + CXXFLAGS="$CXXFLAGS $FRIBIDI_CXXFLAGS" +fi +LDFLAGS="$LDFLAGS `$FRIBIDI_CONFIG --libs`" + +AC_CHECK_FUNCS(fribidi_log2vis fribidi_log2vis_get_embedding_levels, , + [AC_MSG_ERROR(A required FriBiDi function doesn't exist)]) + +AC_MSG_CHECKING(your FriBiDi library using a short test program) +AC_TRY_RUN( +[#include + +#include + +typedef FriBidiChar unichar; +typedef FriBidiCharType ctype_t; +typedef FriBidiLevel level_t; +typedef FriBidiStrIndex idx_t; + +int main() +{ + unichar unistr[] = { 0x5D0, 0x5D1, 0x5D2, 'A', 0 }; /* alef, bet, gimel, 'A' */ +#define UNISTRLEN 4 + level_t levels[UNISTRLEN]; + unichar deststr[UNISTRLEN + 1]; + ctype_t ctype; + ctype_t base_dir = FRIBIDI_TYPE_RTL; + unichar lparen = '('; + unichar lparen_mirror; + + /* make sure all these constants are defined. */ + ctype = FRIBIDI_TYPE_LTR | FRIBIDI_TYPE_RTL | FRIBIDI_TYPE_ON | FRIBIDI_TYPE_NSM; + + if (sizeof(unichar) != 4) { + printf("\nERROR: FriBiDi doesn't use UCS-4\n"); + /* I'm planning support for 16 bit chars someday. */ + return 1; + } + + ctype = fribidi_get_type(unistr[0]); + if (!FRIBIDI_IS_LETTER(ctype) || + !FRIBIDI_IS_RTL(ctype) || + FRIBIDI_IS_SPACE(ctype) || + FRIBIDI_IS_NUMBER(ctype)) + { + printf("\nERROR: Wrong properties for the Hebrew letter Alef\n"); + return 1; + } + + fribidi_log2vis_get_embedding_levels(unistr, UNISTRLEN, &base_dir, levels); + if (levels[0] != 1 || + levels[1] != 1 || + levels[2] != 1 || + levels[3] != 2) + { + printf("\nERROR: fribidi_log2vis_get_embedding_levels() " + "gives wrong results\n"); + return 1; + } + + fribidi_log2vis(unistr, UNISTRLEN, &base_dir, deststr, NULL, NULL, NULL); + if (deststr[0] != 'A' || + deststr[1] != 0x5D2 || + deststr[2] != 0x5D1 || + deststr[3] != 0x5D0) + { + printf("\nERROR: fribidi_log2vis() gives wrong results\n"); + return 1; + } + + if (!fribidi_get_mirror_char(lparen, &lparen_mirror) || + lparen_mirror != ')') + { + printf("\nERROR: fribidi_get_mirror_char() gives wrong results\n"); + return 1; + } + + return 0; +}], +[AC_MSG_RESULT(OK)], +[AC_MSG_ERROR(The test program failed; check 'config.log'. You probably have an old version of FriBiDi; please upgrade.)], +[AC_MSG_ERROR(Can't cross-compile this test)]) + +dnl ---- curses ---- + +AC_ARG_WITH(curses, +[ --with-curses=DIR Where [n]curses[w] is installed ], +[ + case $withval in + no) + AC_MSG_ERROR([I can only use curses, so don't specify --without-curses!]);; + yes) ;; + *) + if test "x$withval" != x/usr; then + LDFLAGS="-L${withval}/lib $LDFLAGS" + CPPFLAGS="$CPPFLAGS -I${withval}/include" + fi;; + esac +]) + +curses_lib=ncursesw +curses_header= + +# First, check for ncursesw + +AC_CHECK_LIB(ncursesw, waddnwstr, , [curses_lib=]) +if test "x$curses_lib" = xncursesw; then + # look for ncursesw headers + AC_CHECK_HEADERS(ncursesw/ncurses.h, [curses_header="ncursesw/ncurses.h"]) + if test "x$curses_header" = x; then + AC_CHECK_HEADERS(ncurses.h, [curses_header="ncurses.h"], + [AC_MSG_ERROR(Can't find ncursesw's header file!)]) + fi + # make sure it is indeed the header of the wchar_t version. + AC_TRY_LINK([#define _XOPEN_SOURCE_EXTENDED 1 + #include <$curses_header>], + [ + wchar_t ch; + waddnwstr((WINDOW*)0, &ch, 1); + ], , + [AC_MSG_ERROR(I can't find ncursesw's header file! please check config.log)]) + AC_DEFINE(HAVE_WIDE_CURSES) +else + curses_lib=ncurses + AC_CHECK_HEADERS(curses.h ncurses.h) + AC_CHECK_LIB(ncurses, initscr, , [curses_lib=]) + if test "x$curses_lib" = x; then + curses_lib=curses + AC_CHECK_LIB(curses, initscr, , [curses_lib=]) + fi + if test "x$curses_lib" = x; then + AC_MSG_ERROR(No curses/ncurses was found) + fi +fi + +# test for the existance of particular curses functions + +AC_CHECK_FUNCS(use_default_colors start_color curs_set) +if test "$ac_cv_func_start_color" = yes; then + AC_DEFINE(HAVE_COLOR, 1) +fi + +dnl ---- gettext ---- + +# rudimentary gettext check, till I utilize automake's gettext support + +AC_CHECK_HEADERS(libintl.h, [AC_CHECK_FUNCS(gettext, [AC_DEFINE(USE_GETTEXT)])]) + +# locale support + +AC_CHECK_HEADERS(locale.h) + +AC_CHECK_FUNCS(setlocale) + +AC_MSG_CHECKING(for nl_langinfo and CODESET) +AC_TRY_LINK([#include ], + [char* s = nl_langinfo(CODESET);], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LANGINFO_CODESET) + ], + [AC_MSG_RESULT(no)]) + +dnl ---- iconv ---- + +AC_ARG_WITH(iconv, +[ --with-iconv=DIR Where iconv is installed ], +[ + case $withval in + no) skip_iconv=yes ;; + yes) ;; + *) + if test "x$withval" != x/usr; then + LDFLAGS="-L${withval}/lib $LDFLAGS" + CPPFLAGS="$CPPFLAGS -I${withval}/include" + fi;; + esac +]) + +use_iconv=no +default_encoding=ISO-8859-8 + +if test "x$skip_iconv" != xyes; then +AC_CHECK_HEADERS(iconv.h, +[ + AC_C_BIGENDIAN + case $ac_cv_c_bigendian in + yes) internal_encoding=UCS-4BE ;; + no) internal_encoding=UCS-4LE ;; + *) AC_MSG_ERROR(Can't determine machine endianess) + esac + + AC_CHECK_LIB(iconv, iconv_open) + for encoding in UTF-8 ISO-8859-8 CP1255; do + tr_encoding=`echo $encoding | tr - _` + AC_MSG_CHECKING(whether iconv supports the $encoding encoding) + AC_TRY_RUN([#include + int main() + { + iconv_t cd = iconv_open("$internal_encoding", "$encoding"); + return (cd == (iconv_t)-1); + }], + [ + AC_MSG_RESULT(yes) + eval "have_encoding_${tr_encoding}=yes" + ], + [ + AC_MSG_RESULT(no) + eval "have_encoding_${tr_encoding}=no" + ], + [AC_MSG_ERROR(Can't cross-compile this test)] + ) + done + if test "$have_encoding_UTF_8" = yes -a "$have_encoding_ISO_8859_8" = yes; then + use_iconv=yes + if test "$have_encoding_CP1255" = yes; then + default_encoding=CP1255 + else + default_encoding=ISO-8859-8 + fi + + AC_MSG_CHECKING(whether your iconv() needs const) + iconv_const= + AC_TRY_LINK([#include + #include ], + [iconv((iconv_t)-1,(const char **)NULL,NULL,NULL,NULL);], + AC_TRY_LINK([#include + #include ], + [iconv((iconv_t)-1,(char **)NULL,NULL,NULL,NULL);], + , + iconv_const=const + ) + ) + AC_MSG_RESULT($iconv_const) + + AC_DEFINE(USE_ICONV) + AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const) + AC_DEFINE_UNQUOTED(INTERNAL_ENCODING, "$internal_encoding") + fi +]) +fi + +AC_DEFINE_UNQUOTED(DEFAULT_FILE_ENCODING, "$default_encoding") + +AC_CHECK_FUNCS(wctob btowc) + +dnl ---- misc ---- + +AC_CHECK_FUNCS(getopt_long) +AC_HEADER_DIRENT +dnl AC_CHEK_HEADERS(fcntl.h unistd.h) +AC_CHECK_FUNCS(strerror strstr strtol vprintf, , + AC_MSG_ERROR([A required function does not exist])) +AC_CHECK_FUNCS(vsnprintf vasprintf) +AC_TYPE_MODE_T + +dnl AC_TYPE_SIGNAL - fails on some systems, so: +AC_DEFINE(RETSIGTYPE, void) + +dnl ---- print out the results ---- + +cat < - -#include - -typedef FriBidiChar unichar; -typedef FriBidiCharType ctype_t; -typedef FriBidiLevel level_t; -typedef FriBidiStrIndex idx_t; - -int main() -{ - unichar unistr[] = { 0x5D0, 0x5D1, 0x5D2, 'A', 0 }; /* alef, bet, gimel, 'A' */ -#define UNISTRLEN 4 - level_t levels[UNISTRLEN]; - unichar deststr[UNISTRLEN + 1]; - ctype_t ctype; - ctype_t base_dir = FRIBIDI_TYPE_RTL; - unichar lparen = '('; - unichar lparen_mirror; - - /* make sure all these constants are defined. */ - ctype = FRIBIDI_TYPE_LTR | FRIBIDI_TYPE_RTL | FRIBIDI_TYPE_ON | FRIBIDI_TYPE_NSM; - - if (sizeof(unichar) != 4) { - printf("\nERROR: FriBiDi doesn't use UCS-4\n"); - /* I'm planning support for 16 bit chars someday. */ - return 1; - } - - ctype = fribidi_get_type(unistr[0]); - if (!FRIBIDI_IS_LETTER(ctype) || - !FRIBIDI_IS_RTL(ctype) || - FRIBIDI_IS_SPACE(ctype) || - FRIBIDI_IS_NUMBER(ctype)) - { - printf("\nERROR: Wrong properties for the Hebrew letter Alef\n"); - return 1; - } - - fribidi_log2vis_get_embedding_levels(unistr, UNISTRLEN, &base_dir, levels); - if (levels[0] != 1 || - levels[1] != 1 || - levels[2] != 1 || - levels[3] != 2) - { - printf("\nERROR: fribidi_log2vis_get_embedding_levels() " - "gives wrong results\n"); - return 1; - } - - fribidi_log2vis(unistr, UNISTRLEN, &base_dir, deststr, NULL, NULL, NULL); - if (deststr[0] != 'A' || - deststr[1] != 0x5D2 || - deststr[2] != 0x5D1 || - deststr[3] != 0x5D0) - { - printf("\nERROR: fribidi_log2vis() gives wrong results\n"); - return 1; - } - - if (!fribidi_get_mirror_char(lparen, &lparen_mirror) || - lparen_mirror != ')') - { - printf("\nERROR: fribidi_get_mirror_char() gives wrong results\n"); - return 1; - } - - return 0; -}], -[AC_MSG_RESULT(OK)], -[AC_MSG_ERROR(The test program failed; check 'config.log'. You probably have an old version of FriBiDi; please upgrade.)], -[AC_MSG_ERROR(Can't cross-compile this test)]) - -dnl ---- curses ---- - -AC_ARG_WITH(curses, -[ --with-curses=DIR Where [n]curses[w] is installed ], -[ - case $withval in - no) - AC_MSG_ERROR([I can only use curses, so don't specify --without-curses!]);; - yes) ;; - *) - if test "x$withval" != x/usr; then - LDFLAGS="-L${withval}/lib $LDFLAGS" - CPPFLAGS="$CPPFLAGS -I${withval}/include" - fi;; - esac -]) - -curses_lib=ncursesw -curses_header= - -# First, check for ncursesw - -AC_CHECK_LIB(ncursesw, waddnwstr, , [curses_lib=]) -if test "x$curses_lib" = xncursesw; then - # look for ncursesw headers - AC_CHECK_HEADERS(ncursesw/ncurses.h, [curses_header="ncursesw/ncurses.h"]) - if test "x$curses_header" = x; then - AC_CHECK_HEADERS(ncurses.h, [curses_header="ncurses.h"], - [AC_MSG_ERROR(Can't find ncursesw's header file!)]) - fi - # make sure it is indeed the header of the wchar_t version. - AC_TRY_LINK([#define _XOPEN_SOURCE_EXTENDED 1 - #include <$curses_header>], - [ - wchar_t ch; - waddnwstr((WINDOW*)0, &ch, 1); - ], , - [AC_MSG_ERROR(I can't find ncursesw's header file! please check config.log)]) - AC_DEFINE(HAVE_WIDE_CURSES) -else - curses_lib=ncurses - AC_CHECK_HEADERS(curses.h ncurses.h) - AC_CHECK_LIB(ncurses, initscr, , [curses_lib=]) - if test "x$curses_lib" = x; then - curses_lib=curses - AC_CHECK_LIB(curses, initscr, , [curses_lib=]) - fi - if test "x$curses_lib" = x; then - AC_MSG_ERROR(No curses/ncurses was found) - fi -fi - -# test for the existance of particular curses functions - -AC_CHECK_FUNCS(use_default_colors start_color curs_set) -if test "$ac_cv_func_start_color" = yes; then - AC_DEFINE(HAVE_COLOR, 1) -fi - -dnl ---- gettext ---- - -# rudimentary gettext check, till I utilize automake's gettext support - -AC_CHECK_HEADERS(libintl.h, [AC_CHECK_FUNCS(gettext, [AC_DEFINE(USE_GETTEXT)])]) - -# locale support - -AC_CHECK_HEADERS(locale.h) - -AC_CHECK_FUNCS(setlocale) - -AC_MSG_CHECKING(for nl_langinfo and CODESET) -AC_TRY_LINK([#include ], - [char* s = nl_langinfo(CODESET);], - [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_LANGINFO_CODESET) - ], - [AC_MSG_RESULT(no)]) - -dnl ---- iconv ---- - -AC_ARG_WITH(iconv, -[ --with-iconv=DIR Where iconv is installed ], -[ - case $withval in - no) skip_iconv=yes ;; - yes) ;; - *) - if test "x$withval" != x/usr; then - LDFLAGS="-L${withval}/lib $LDFLAGS" - CPPFLAGS="$CPPFLAGS -I${withval}/include" - fi;; - esac -]) - -use_iconv=no -default_encoding=ISO-8859-8 - -if test "x$skip_iconv" != xyes; then -AC_CHECK_HEADERS(iconv.h, -[ - AC_C_BIGENDIAN - case $ac_cv_c_bigendian in - yes) internal_encoding=UCS-4BE ;; - no) internal_encoding=UCS-4LE ;; - *) AC_MSG_ERROR(Can't determine machine endianess) - esac - - AC_CHECK_LIB(iconv, iconv_open) - for encoding in UTF-8 ISO-8859-8 CP1255; do - tr_encoding=`echo $encoding | tr - _` - AC_MSG_CHECKING(whether iconv supports the $encoding encoding) - AC_TRY_RUN([#include - int main() - { - iconv_t cd = iconv_open("$internal_encoding", "$encoding"); - return (cd == (iconv_t)-1); - }], - [ - AC_MSG_RESULT(yes) - eval "have_encoding_${tr_encoding}=yes" - ], - [ - AC_MSG_RESULT(no) - eval "have_encoding_${tr_encoding}=no" - ], - [AC_MSG_ERROR(Can't cross-compile this test)] - ) - done - if test "$have_encoding_UTF_8" = yes -a "$have_encoding_ISO_8859_8" = yes; then - use_iconv=yes - if test "$have_encoding_CP1255" = yes; then - default_encoding=CP1255 - else - default_encoding=ISO-8859-8 - fi - - AC_MSG_CHECKING(whether your iconv() needs const) - iconv_const= - AC_TRY_LINK([#include - #include ], - [iconv((iconv_t)-1,(const char **)NULL,NULL,NULL,NULL);], - AC_TRY_LINK([#include - #include ], - [iconv((iconv_t)-1,(char **)NULL,NULL,NULL,NULL);], - , - iconv_const=const - ) - ) - AC_MSG_RESULT($iconv_const) - - AC_DEFINE(USE_ICONV) - AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const) - AC_DEFINE_UNQUOTED(INTERNAL_ENCODING, "$internal_encoding") - fi -]) -fi - -AC_DEFINE_UNQUOTED(DEFAULT_FILE_ENCODING, "$default_encoding") - -AC_CHECK_FUNCS(wctob btowc) - -dnl ---- misc ---- - -AC_CHECK_FUNCS(getopt_long) -AC_HEADER_DIRENT -dnl AC_CHEK_HEADERS(fcntl.h unistd.h) -AC_CHECK_FUNCS(strerror strstr strtol vprintf, , - AC_MSG_ERROR([A required function does not exist])) -AC_CHECK_FUNCS(vsnprintf vasprintf) -AC_TYPE_MODE_T - -dnl AC_TYPE_SIGNAL - fails on some systems, so: -AC_DEFINE(RETSIGTYPE, void) - -dnl ---- print out the results ---- - -cat <