aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure.ac
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-03-29 10:25:00 +1000
committerGravatar axel <axel@liljencrantz.se>2006-03-29 10:25:00 +1000
commitdc91d7aec40e0d02d60d6131f5d93a72d5c5bdbb (patch)
treec1365acbe9022765be34f0c82dbed487196c7390 /configure.ac
parent13a51ba4c2301460d62502d66c6a7c8e020749d1 (diff)
Further improvements to build system wrt detection of compiler and libc features and prototypes, as discussed with James Antill on mailin list
darcs-hash:20060329002500-ac50b-e7618e476ea69802bd2cb0076244f49a0f178df7.gz
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac101
1 files changed, 73 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac
index 22509e33..813d2f20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,12 +10,12 @@ if test configure -ot configure.ac; then
# shell and autconf should take care of that themselves
AC_MSG_NOTICE([running autoconf])
if autoconf; then
- ./configure $@
+ ./configure "$@"
fi
exit
else
AC_MSG_ERROR( [cannot find the autoconf program in your path.
-This program is needs to be run whenever the configure.ac file is modified.
+This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.])
fi
else
@@ -32,7 +32,7 @@ if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
autoheader
else
AC_MSG_ERROR( [cannot find the autoheader program in your path.
-This program is needs to be run whenever the configure.ac file is modified.
+This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.])
fi
else
@@ -113,21 +113,36 @@ else
fi
#
+# Test if the compiler accepts the -std=c99 flag. If so, that
+# increases the odds of correct compilation, since we want to use the
+# *wprintf functions, which where defined in C99.
+#
+
+XCFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -std=c99"
+AC_MSG_CHECKING(if -std=c99 works)
+AC_CACHE_VAL(local_cv_has__std_c99,[
+AC_TRY_RUN([
+#include <stdlib.h>
+#include <stdio.h>
+
+int main() {
+return 0;
+}],
+local_cv_has__std_c99=yes,
+local_cv_has__std_c99=no,
+)])
+AC_MSG_RESULT($local_cv_has__std_c99)
+case x$local_cv_has__std_c99 in
+xno) CFLAGS="$XCFLAGS" ;;
+esac
+
+#
# If we are using gcc, set some flags that increase the odds of the
# compiler producing a working binary...
#
if test "$CC" = gcc; then
-
- #
- # This seems to be needed in some glibc versions in order to get
- # the prototypes for wide character functions like wcsdup and
- # fwprintf. Fish should not actually use anu C99-specific
- # features - if it does, please report this as a bug.
- #
-
- CFLAGS="$CFLAGS -std=c99"
-
#
# -fno-optimize-sibling-calls seems to work around a bug where
@@ -148,27 +163,54 @@ if test "$CC" = gcc; then
CFLAGS="$CFLAGS -Wall"
+fi
+
+
+# Check if we are compiling against glibc
+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 if we are
- # compiling agains glibc. All extensions that are used must have a
- # fallback implementation available in fallback.h, in order to
- # keep fish working on non-gnu platforms.
+ # 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.
#
- CFLAGS="$CFLAGS -D _GNU_SOURCE"
-
-fi
+ CFLAGS="$CFLAGS -D _GNU_SOURCE -D _ISOC99_SOURCE"
+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
-AC_DEFINE_UNQUOTED([CPU],[L"$target_cpu"],[CPU type])
-
# Set up PREFIX and related preprocessor symbols. Fish needs to know
# where it will be installed. One of the reasons for this is so that
@@ -208,6 +250,12 @@ AC_SUBST( [LOCALEDIR], [$datadir/locale])
# information about running processes.
AC_CHECK_FILES([/proc/self/stat])
+# This is ued to tell the wgetopt library to translate strings. This
+# way wgetopt can be dropped into any project without requiring i18n.
+
+AC_DEFINE([HAVE_TRANSLATE_H], [1],
+ [Define to 1 if the wgettext function should be used for translating strings.])
+
# Check for presense of various libraries
AC_SEARCH_LIBS( gettext, intl, AC_SUBST( HAVE_GETTEXT, [1] ), AC_SUBST( HAVE_GETTEXT, [0] ) )
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
@@ -248,9 +296,10 @@ else
AC_MSG_RESULT(no)
fi
+# 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
- # Check if fwprintf is broken
AC_MSG_CHECKING([if fwprintf is broken])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
@@ -321,9 +370,6 @@ else
AC_MSG_RESULT(no)
fi
-AC_DEFINE([HAVE_TRANSLATE_H], [1],
- [Define to 1 if the wgettext function should be used for translating strings.])
-
# Check for _nl_msg_cat_cntr symbol
AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol])
AC_TRY_LINK([#if HAVE_LIBINTL_H]
@@ -344,5 +390,4 @@ AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile etc/fish etc
AC_OUTPUT
echo "fish is now configured."
-echo "Now run 'make' and 'make install' to built and install fish."
-echo "Good luck!"
+echo "Use 'make' and 'make install' to built and install fish."