diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 296 |
1 files changed, 10 insertions, 286 deletions
diff --git a/configure.ac b/configure.ac index 2d60a9a0..035ca4f6 100644 --- a/configure.ac +++ b/configure.ac @@ -94,6 +94,8 @@ AC_PROG_SED AC_LANG(C++) AC_USE_SYSTEM_EXTENSIONS +AC_CANONICAL_TARGET + echo "CXXFLAGS: $CXXFLAGS" # @@ -197,8 +199,7 @@ AS_IF([test "$use_doxygen" != "no"], # where off_t can be either 32 or 64 bit, the latter size is used. On # other systems, this should do nothing. (Hopefully) # - -CXXFLAGS="$CXXFLAGS -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64" +AC_SYS_LARGEFILE # fish does not use exceptions @@ -216,7 +217,6 @@ CXXFLAGS="$CXXFLAGS -Wall -Wno-sign-compare" # # This is needed in order to get the really cool backtraces on Linux # - AC_MSG_CHECKING([for -rdynamic linker flag]) prev_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -rdynamic" @@ -230,100 +230,6 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], ]) LDFLAGS="$prev_LDFLAGS" - -# -# If we are compiling against glibc, set some flags to work around -# some rather stupid attempts to hide prototypes for *wprintf -# functions, as well as prototypes of various gnu extensions. -# - -AC_MSG_CHECKING([if we are compiling against glibc]) -AC_RUN_IFELSE( - [ - AC_LANG_PROGRAM( - [ - #include <stdlib.h> - #ifdef __GLIBC__ - #define STATUS 0 - #else - #define STATUS 1 - #endif - ], - [ - return STATUS; - ] - ) - ], - [glibc=yes], - [glibc=no] -) - -if test "$glibc" = yes; then - AC_MSG_RESULT(yes) - - # - # This gives us access to prototypes for gnu extensions and C99 - # functions if we are compiling agains glibc. All GNU extensions - # that are used must have a fallback implementation available in - # fallback.h, in order to keep fish working on non-gnu platforms. - # - - CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE=1 -D_ISO99_SOURCE=1" -else - AC_MSG_RESULT(no) -fi - - -# -# Test cpu for special handling of ppc -# -# This is used to skip use of tputs on ppc systems, since it seemed to -# be broken, at least on older debin-based systems. This is obviously -# not the right way to to detect whether this workaround should be -# used, since it catches far to many systems, but I do not have the -# hardware available to narrow this problem down, and in practice, it -# seems that tputs is never really needed. -# - -AC_CANONICAL_TARGET - -if test $target_cpu = powerpc; then - AC_DEFINE([TPUTS_KLUDGE],[1],[Evil kludge to get Power based machines to work]) -fi - - -# -# Solaris-specific flags go here -# - -AC_MSG_CHECKING([if we are under Solaris]) -case $target_os in - solaris*) - AC_DEFINE( __EXTENSIONS__, 1, [Macro to enable additional prototypes under Solaris]) - AC_MSG_RESULT(yes) - ;; - *) - AC_MSG_RESULT(no) - ;; -esac - -# -# BSD-specific flags go here -# - -AC_MSG_CHECKING([if we are under BSD]) -case $target_os in - *bsd*) - AC_DEFINE( __BSD_VISIBLE, 1, [Macro to enable additional prototypes under BSD]) - AC_DEFINE( _NETBSD_SOURCE, 1, [Macro to enable additional prototypes under BSD]) - AC_MSG_RESULT(yes) - ;; - *) - AC_MSG_RESULT(no) - ;; -esac - - # # See if Linux procfs is present. This is used to get extra # information about running processes. @@ -361,7 +267,7 @@ AC_SEARCH_LIBS( shm_open, rt, , [AC_MSG_ERROR([Cannot find the rt library, neede AC_SEARCH_LIBS( pthread_create, pthread, , [AC_MSG_ERROR([Cannot find the pthread library, needed to build this package.] )] ) AC_SEARCH_LIBS( setupterm, [ncurses tinfo curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish. If this is Linux, try running 'sudo apt-get install libncurses5-dev' or 'sudo yum install ncurses-devel'])] ) AC_SEARCH_LIBS( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] ) -AC_SEARCH_LIBS( [backtrace_symbols_fd], [execinfo] ) +AC_SEARCH_LIBS( [dladdr], [dl] ) if test x$local_gettext != xno; then AC_SEARCH_LIBS( gettext, intl,,) @@ -387,125 +293,6 @@ AC_CHECK_SIZEOF(wchar_t) WCHAR_T_BITS=`expr 8 \* $ac_cv_sizeof_wchar_t` AC_DEFINE_UNQUOTED([WCHAR_T_BITS], [$WCHAR_T_BITS], [The size of wchar_t in bits.]) - -# -# On some platforms (Solaris 10) adding -std=c99 in turn requires that -# _POSIX_C_SOURCE be defined to 200112L otherwise several -# POSIX-specific, non-ISO-C99 types/prototypes are made unavailable -# e.g. siginfo_t. Defining _XOPEN_SOURCE to 600 is compatible with -# the _POSIX_C_SOURCE value and provides a little assurance that -# extension functions' prototypes are available, e.g. killpg(). -# -# Some other platforms (OS X), will remove types/prototypes/macros -# e.g. SIGWINCH if either _POSIX_C_SOURCE or _XOPEN_SOURCE is defined. -# -# This test adds these macros only if they enable a program that uses -# both Posix and non-standard features to compile, and that program -# does not compile without these macros. -# -# We try to make everyone happy. -# -# The ordering of the various autoconf tests is very critical as well: -# -# * This test needs to be run _after_ header detection tests, so that -# the proper headers are included. -# -# * This test needs to be run _before_ testing for the presense of any -# prototypes or other language functinality. -# -# * This test should be (but does not need to be) run after the -# conditional definition of __EXTENSIONS__, to avoid redundant tests. -# - -XCXXFLAGS="$CXXFLAGS" - -echo checking how to use -D_XOPEN_SOURCE=600 and -D_POSIX_C_SOURCE=200112L... -local_found_posix_switch=no - -for i in "" "-D_POSIX_C_SOURCE=200112L" "-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L"; do - - AC_MSG_CHECKING( if switches \"$i\" works) - CXXFLAGS="$XCXXFLAGS $i" - - # - # Try to run this program, which should test various extensions - # and Posix functionality. If this program works, then everything - # should work. Hopefully. - # - - AC_TRY_LINK( - [ - #include <stdlib.h> - #include <stdio.h> - #include <sys/types.h> - - /* POSIX, C89 and C99: POSIX extends this header. - * For: kill(), killpg(), siginfo_t, sigset_t, - * struct sigaction, sigemptyset(), sigaction(), - * SIGIO and SIGWINCH. */ - #include <signal.h> - - #ifdef HAVE_SIGINFO_H - /* Neither POSIX, C89 nor C99: Solaris-specific (others?). - * For: siginfo_t (also defined by signal.h when in - * POSIX/extensions mode). */ - #include <siginfo.h> - #endif - - #ifdef HAVE_SYS_IOCTL_H - /* As above (under at least Linux and FreeBSD). */ - #include <sys/ioctl.h> - #endif - - #ifdef HAVE_TERMIOS_H - #include <termios.h> - #endif - ], - [ - /* Avert high-level optimisation, by making the program's - * return value depend on all tested identifiers. */ - long ret = 0; - /* POSIX only: might be unhidden by _POSIX_C_SOURCE. */ - struct sigaction sa; - sigset_t ss; - siginfo_t info; - ret += (long)(void *)&info + kill( 0, 0 ) + - sigaction( 0, &sa, 0 ) + sigemptyset( &ss ); - /* Extended-POSIX: might be unhidden by _XOPEN_SOURCE. */ - ret += killpg( 0, 0 ); - /* Non-standard: might be hidden by the macros. */ - { - struct winsize termsize; - ret += (long)(void *)&termsize; - ret += SIGWINCH + TIOCGWINSZ + SIGIO; - } - return ret; - - ], - local_cv_use__posix_c_source=yes, - local_cv_use__posix_c_source=no, - ) - - if test x$local_cv_use__posix_c_source = xyes; then - AC_MSG_RESULT( yes ) - local_found_posix_switch=yes - break; - else - AC_MSG_RESULT( no ) - fi - -done - -# -# We didn't find any combination of switches that worked - revert to -# no switches and hope that the fallbacks work. A warning will be -# printed at the end of the configure script. -# - -if test ! x$local_found_posix_switch = xyes; then - CXXFLAGS="$XCXXFLAGS" -fi - # # Detect nanoseconds fields in struct stat # @@ -518,13 +305,13 @@ AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) AC_STRUCT_DIRENT_D_TYPE # -# Check for presense of various functions used by fish +# Check for presence of various functions used by fish # -AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf ) -AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc ) -AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg ) -AC_CHECK_FUNCS( backtrace backtrace_symbols_fd sysconf getifaddrs ) +AC_CHECK_FUNCS( wcsndup ) +AC_CHECK_FUNCS( futimes ) +AC_CHECK_FUNCS( wcslcat wcslcpy lrand48_r killpg ) +AC_CHECK_FUNCS( backtrace_symbols getifaddrs ) AC_CHECK_FUNCS( futimens clock_gettime ) AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] ) @@ -616,41 +403,6 @@ AC_LINK_IFELSE( ) -# -# If we have a fwprintf in libc, test that it actually works. As of -# March 2006, it is broken under DragonFly BSD. -# - -if test "$ac_cv_func_fwprintf" = yes; then - - AC_MSG_CHECKING([if fwprintf is broken]) - AC_RUN_IFELSE( - [ - AC_LANG_PROGRAM( - [ - #include <stdlib.h> - #include <stdio.h> - #include <locale.h> - #include <wchar.h> - ], - [ - setlocale( LC_ALL, "" ); - fwprintf( stderr, L"%ls%ls", L"", L"fish:" ); - ] - ) - ], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_BROKEN_FWPRINTF], [1], [Define to 1 one if the implemented fwprintf is broken]) - ] - ) - -fi - - # Check for _nl_msg_cat_cntr symbol AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol]) AC_TRY_LINK( @@ -658,6 +410,7 @@ AC_TRY_LINK( #if HAVE_LIBINTL_H #include <libintl.h> #endif + #include <stdlib.h> ], [ extern int _nl_msg_cat_cntr; @@ -678,30 +431,6 @@ else AC_MSG_RESULT(no) fi -# Check for __environ symbol -AC_MSG_CHECKING([for __environ symbol]) -AC_TRY_LINK( - [ - #include <unistd.h> - ], - [ - extern char **__environ; - char **tmp = __environ; - exit(tmp!=0); - ], - have___environ=yes, - have___environ=no -) -if test "$have___environ" = yes; then - AC_MSG_RESULT(yes) - AC_DEFINE( - [HAVE___ENVIRON], - [1], - [Define to 1 if the __environ symbol is exported.] - ) -else - AC_MSG_RESULT(no) -fi # Check for sys_errlist AC_MSG_CHECKING([for sys_errlist array]) @@ -912,11 +641,6 @@ AC_ARG_WITH([extra-confdir], AC_CONFIG_FILES([Makefile]) AC_OUTPUT -if test ! x$local_found_posix_switch = xyes; then - echo "Can't find a combination of switches to enable common extensions like detecting window size." - echo "Some fish features may be disabled." -fi - echo "fish is now configured." echo "Use 'make' and 'make install' to build and install fish." |