diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 341 |
1 files changed, 39 insertions, 302 deletions
diff --git a/configure.ac b/configure.ac index 03cc091..cb6fde4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,316 +1,53 @@ -AC_INIT(main.cc) -AM_INIT_AUTOMAKE(geresh, 0.6.3) -AM_CONFIG_HEADER(config.h) +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. -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 <stdio.h> - -#include <fribidi/fribidi.h> - -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 -]) +AC_PREREQ([2.69]) +AC_INIT([generah], [0.6.3]) +AC_CONFIG_SRCDIR([geresh.1]) +AM_INIT_AUTOMAKE +AC_CONFIG_HEADERS([config.h]) -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 <langinfo.h>], - [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 <iconv.h> - 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 <stdlib.h> - #include <iconv.h>], - [iconv((iconv_t)-1,(const char **)NULL,NULL,NULL,NULL);], - AC_TRY_LINK([#include <stdlib.h> - #include <iconv.h>], - [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 +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC -AC_DEFINE_UNQUOTED(DEFAULT_FILE_ENCODING, "$default_encoding") +# Checks for libraries. -AC_CHECK_FUNCS(wctob btowc) +# Checks for header files. +AC_CHECK_HEADERS([fcntl.h langinfo.h libintl.h locale.h stdlib.h string.h sys/time.h termios.h unistd.h wchar.h]) -dnl ---- misc ---- +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_C_INLINE +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T -AC_CHECK_FUNCS(getopt_long) +# FIXME: Do we really need to bother with platforms that don't support +# UTF-8? +AC_DEFINE_UNQUOTED(DEFAULT_FILE_ENCODING, "UTF-8", "Default encoding") 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 FIXME: AC_TYPE_SIGNAL - fails on some systems, so: +AC_DEFINE(RETSIGTYPE, void, [Type returned from a signal]) -dnl ---- print out the results ---- +# FIXME: really needed? +AC_CHECK_FUNCS(use_default_colors start_color curs_set) -cat <<MSG +# FIXME: check for libiconv? - Results: - -------- - curses library: $curses_lib - use iconv: $use_iconv - default file encoding: $default_encoding - (debugging support: $debugging_support) +# Checks for library functions. +AC_FUNC_FORK +AC_CHECK_FUNCS([dup2 memmove putenv select setlocale strchr strdup strerror strstr strtol wcwidth]) -MSG -if ! test "$curses_lib" = ncursesw; then - cat <<MSG - WARNING: you're using $curses_lib, not ncursesw, so you won't be able to use - $PACKAGE in the UTF-8 locale. +PKG_CHECK_MODULES([FRIBIDI], fribidi, + [CPPFLAGS="$CFLAGS $FRIBIDI_CFLAGS"; LDFLAGS="$LDFLAGS $FRIBIDI_LIBS"]) +PKG_CHECK_MODULES([NCURSES], ncursesw, + [CPPFLAGS="$CFLAGS $NCURSES_CFLAGS"; LDFLAGS="$LDFLAGS $NCURSES_LIBS"]) -MSG -fi +AC_DEFINE(HAVE_WIDE_CURSES, 1, [Have ncursesw (ncurses with wide chars)]) -AC_OUTPUT(Makefile pgeresh, [chmod +x pgeresh]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES(pgeresh, [chmod +x pgeresh]) +AC_OUTPUT |