Code beutification in build files

darcs-hash:20061031020656-ac50b-2385bb51d7df624e5691b7659120596600fd1d5d.gz
This commit is contained in:
axel 2006-10-31 12:06:56 +10:00
parent c098cb5c87
commit c4a8f4c890
2 changed files with 391 additions and 42 deletions

View file

@ -1,10 +1,10 @@
#
# Copyright (C) 2005 Axel Liljencrantz
# Copyright (C) 2005-2006 Axel Liljencrantz
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# as published by the Free Software Foundation; version 2
# of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -32,11 +32,19 @@
# hallucinations.
#
#
# Programs
#
CC := @CC@
INSTALL:=@INSTALL@
#
# Installation directories
#
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
@ -47,51 +55,87 @@ docdir = @docdir@
localedir = @localedir@
prefix = @prefix@
optbindirs = @optbindirs@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
#
# Various flags
#
MACROS=-DLOCALEDIR=\"$(localedir)\" -DPREFIX=L\"$(prefix)\" -DDATADIR=L\"$(datadir)\" -DSYSCONFDIR=L\"$(sysconfdir)\"
CFLAGS=@CFLAGS@ $(MACROS)
CPPFLAGS=@CPPFLAGS@
LDFLAGS= @LIBS@ @LDFLAGS@
#
# Set to 1 if we have gettext
#
HAVE_GETTEXT=@HAVE_GETTEXT@
#
#Additional .c files used by common.o. These also have a corresponding
#.h file.
#
COMMON_FILES := util.c halloc.c halloc_util.c fallback.c
# All objects that the system needs to build fish, except main.o
FISH_OBJS := function.o builtin.o complete.o env.o exec.o \
expand.o highlight.o history.o kill.o parser.o proc.o reader.o \
sanity.o tokenizer.o wildcard.o wgetopt.o wutil.o input.o \
output.o intern.o env_universal.o env_universal_common.o \
input_common.o event.o signal.o io.o parse_util.o common.o screen.o\
path.o
#
# All objects that the system needs to build fish, except main.o
#
FISH_OBJS := function.o builtin.o complete.o env.o exec.o expand.o \
highlight.o history.o kill.o parser.o proc.o reader.o sanity.o \
tokenizer.o wildcard.o wgetopt.o wutil.o input.o output.o intern.o \
env_universal.o env_universal_common.o input_common.o event.o \
signal.o io.o parse_util.o common.o screen.o path.o
#
# Additional files used by builtin.o
#
BUILTIN_FILES := builtin_help.c builtin_set.c builtin_commandline.c \
builtin_ulimit.c builtin_complete.c builtin_jobs.c
# All objects that the system needs to build fish_pager
FISH_PAGER_OBJS := fish_pager.o output.o wutil.o \
tokenizer.o input_common.o env_universal.o env_universal_common.o \
common.o
#
# All objects that the system needs to build fish_pager
#
FISH_PAGER_OBJS := fish_pager.o output.o wutil.o tokenizer.o \
input_common.o env_universal.o env_universal_common.o common.o
#
# All objects that the system needs to build fish_tests
#
FISH_TESTS_OBJS := $(FISH_OBJS) fish_tests.o
#
# All objects that the system needs to build fishd
#
FISHD_OBJS := fishd.o env_universal_common.o wutil.o \
doc_src/fishd.o common.o
#
# All objects needed to build mimedb
#
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o common.o
#
# Files containing documentation for builtins.
#
BUILTIN_DOC_SRC := doc_src/source.txt doc_src/and.txt \
doc_src/begin.txt doc_src/bg.txt doc_src/bind.txt \
doc_src/block.txt doc_src/break.txt doc_src/builtin.txt \
@ -105,14 +149,18 @@ BUILTIN_DOC_SRC := doc_src/source.txt doc_src/and.txt \
doc_src/status.txt doc_src/switch.txt doc_src/ulimit.txt \
doc_src/while.txt
#
# Files generated by running doxygen on the files in $(BUILTIN_DOC_SRC)
#
BUILTIN_DOC_HDR := $(BUILTIN_DOC_SRC:.txt=.doxygen)
#
# Files containing documentation for external commands.
#
CMD_DOC_SRC := doc_src/contains.txt doc_src/count.txt doc_src/dirh.txt \
doc_src/dirs.txt doc_src/fish.txt doc_src/fish_pager.txt \
doc_src/fishd.txt doc_src/help.txt doc_src/isatty.txt \
@ -121,25 +169,39 @@ CMD_DOC_SRC := doc_src/contains.txt doc_src/count.txt doc_src/dirh.txt \
doc_src/pushd.txt doc_src/set_color.txt doc_src/trap.txt \
doc_src/type.txt doc_src/umask.txt doc_src/vared.txt
#
# Files generated by running doxygen on the files in $(CMD_DOC_SRC)
#
CMD_DOC_HDR := $(CMD_DOC_SRC:.txt=.doxygen)
#
# Files in the test directory
#
TEST_IN := $(wildcard tests/test*.in)
#
# Files that should be added to the tar archives
#
#
# Files in ./doc_src/
#
DOC_SRC_DIR_FILES := doc_src/Doxyfile.in doc_src/doc.hdr \
$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC)
# Files in ./
#
# Files in ./. There is some overlap between the variables in the
# list, so when copying these files, cp will complain that some files
# are specified more than once.
#
MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
configure.ac config.h.in install-sh set_color.c count.c \
key_reader.c gen_hdr.sh gen_hdr2.c $(MIME_OBJS:.o=.h) \
@ -149,27 +211,54 @@ MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
xsel-0.9.6.tar ChangeLog config.sub config.guess fish_tests.c \
main.c fish_pager.c fishd.c seq.in
#
# Files in ./etc/
#
ETC_DIR_FILES :=etc/config.fish.in etc/fish_inputrc
#
# Files in ./share/
#
SHARE_DIR_FILES :=share/config.fish.in share/config_interactive.fish.in
#
# Files in ./tests/
#
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
$(TEST_IN:.in=.status) tests/test.fish tests/gen_output.fish
#
# Files in ./share/completions/
#
COMPLETIONS_DIR_FILES := $(wildcard share/completions/*.fish)
#
# Files in ./share/functions/
#
FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
# Programs to build
#
# Programs to install
#
PROGRAMS:=fish set_color @XSEL@ @SEQ_FALLBACK@ mimedb count fish_pager fishd
# Manuals to install
#
# Manual pagess to install
#
MANUALS:=doc_src/builtin_doc/man/man1/fish.1 @XSEL_MAN_PATH@ \
doc_src/builtin_doc/man/man1/mimedb.1 \
doc_src/builtin_doc/man/man1/set_color.1 \
@ -177,40 +266,69 @@ MANUALS:=doc_src/builtin_doc/man/man1/fish.1 @XSEL_MAN_PATH@ \
doc_src/builtin_doc/man/man1/fishd.1 \
doc_src/builtin_doc/man/man1/fish_pager.1
#All translation message catalogs
#
# All translation message catalogs
#
TRANSLATIONS_SRC := $(wildcard po/*.po)
TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo)
#Make everything needed for installing fish
#
# Make everything needed for installing fish
#
all: $(PROGRAMS) user_doc etc/config.fish share/config.fish share/config_interactive.fish $(TRANSLATIONS)
@echo fish has now been built.
@echo Use \'make install\' to install fish.
.PHONY: all
#
# These dependencies make sure that autoconf and configure are run
# when the source code for the build configuration has changed.
#
configure: configure.ac
./config.status --recheck
Makefile: Makefile.in configure
./config.status
fish.spec: fish.spec.in
./config.status
#
# Build fish with some debug flags specified. This is GCC specific,
# and should only be used when debuging fish.
#
debug:
make fish CFLAGS="@CFLAGS@ $(MACROS) -O0 -Wno-unused -Werror -g"
.PHONY: debug
#
# User documentation, describing the features of the fish shell.
#
user_doc: doc_src/doc.hdr Doxyfile.user user_doc.head.html $(CMD_DOC_SRC) $(BUILTIN_DOC_SRC)
$(MAKE) doc.h # Depend on the source (doc.hdr) and manually make the intermediate as needed
doxygen Doxyfile.user
touch user_doc
#
# Source code documentation. Also includes user documentation.
#
doc: *.h *.c doc.h Doxyfile builtin_help.c
doxygen;
#
# PDF version of the source code documentation.
#
doc/refman.pdf: doc
cd doc/latex;
make;
@ -218,20 +336,34 @@ doc/refman.pdf: doc
cd ../..;
rm -r doc/latex;
#
# This target runs both the low level code tests and the high level script tests.
#
test: $(PROGRAMS) fish_tests
./fish_tests; cd tests; ../fish <test.fish;
.PHONY: test
#
# Build the xsel program, which is maintained in its own tarball
#
xsel-0.9.6:
tar -xf xsel-0.9.6.tar
xsel-0.9.6/xsel: xsel-0.9.6
cd xsel-0.9.6; ./configure; make
#
# doc.h is a compilation of the various snipptes of text used both for
# the user documentation and for internal help functions into a single
# file that can be parsed dy Doxygen to generate the user
# documentation.
#
doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
cat doc_src/doc.hdr >doc.h;
echo "/** \page builtins Builtin commands" >>doc.h;
@ -248,10 +380,14 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
done
echo "*/" >>doc.h
#
# This rule creates complete doxygen headers from each of the various
# snipptes of text used both for the user documentation and for
# internal help functions, that can be parsed to Doxygen to generate
# the internal help function text.
#
%.doxygen:%.txt
echo "/** \page " `basename $*` >$@;
cat $*.txt >>$@;
@ -261,13 +397,21 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
sed <$@.in >$@ -e "s,@sysconfdir\@,$(sysconfdir),g" -e "s,@datadir\@,$(datadir),g" -e "s,@docdir\@,$(docdir),g" -e "s|@configure_input\@|$@, generated from $@.in by the Makefile. DO NOT MANUALLY EDIT THIS FILE!|g" -e "s,@prefix\@,$(prefix),g" -e "s,@optbindirs\@,$(optbindirs),g"
#-e "s,@\@,$(),"
# Compile translation file
#
# Compile translation files to binary format
#
%.gmo:
if test $(HAVE_GETTEXT) = 1; then \
msgfmt -o $*.gmo $*.po; \
fi
#
# Update existing po file or copy messages.pot
#
%.po:messages.pot
if test $(HAVE_GETTEXT) = 1;then \
if test -f $*.po; then \
@ -277,7 +421,11 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
fi; \
fi
#
# Create a template translation object
#
messages.pot: *.c *.h etc/*.in share/fish share/completions/*.fish share/functions/*.fish seq
if test $(HAVE_GETTEXT) = 1;then \
xgettext -k_ -kN_ *.c *.h -o messages.pot; \
@ -292,6 +440,8 @@ builtin.o: $(BUILTIN_FILES)
common.o: $(COMMON_FILES)
#
# Generate the internal help functions by making doxygen create
# man-pages which are then converted into C code. The convertion path
# looks like this:
@ -323,6 +473,7 @@ common.o: $(COMMON_FILES)
#
# Which is an awful, clunky and ugly way of producing
# documentation. There ought to be something simpler.
#
doc_src/builtin_doc: $(BUILTIN_DOC_SRC) doc_src/count.txt builtin_help.hdr $(CMD_DOC_SRC)
for i in $(BUILTIN_DOC_SRC) $(CMD_DOC_SRC); do \
@ -350,11 +501,12 @@ builtin_help.c: doc_src/builtin_doc gen_hdr.sh
done;
echo "}" >>builtin_help.c
#
# Generate help texts for external fish commands, like set_color and
# mimedb. Depends on builtin_help.c to make sure doxygen gets run to
# generate the man files.
# mimedb.
#
%.c : %.doxygen
$(MAKE) gen_hdr2 builtin_help.c # These should really be filed as dependencis for %.c above instead, but that seems to confuse make
echo "// This file was automatically generated, do not edit" >$@
@ -373,8 +525,10 @@ builtin_help.c: doc_src/builtin_doc gen_hdr.sh
# The build rules for installing/uninstalling fish
#
#
# Check for an incompatible installed fish version, and fail with an
# error if found
#
check-uninstall:
if test -f $(DESTDIR)$(sysconfdir)/fish.d/fish_function.fish -o -f $(DESTDIR)$(sysconfdir)/fish.d/fish_complete.fish; then \
@ -402,16 +556,31 @@ check-uninstall:
fi;
.PHONY: check-uninstall
#
# This check makes sure that the install-sh script is executable. The
# darcs repo doesn't preserve the executable bit, so this needs to be
# run after checkout.
#
install-sh:
if test -x install-sh; then true; else chmod 755 install-sh; fi
.PHONY: install-sh
# Try to install after checking for incompatible installed versions
#
# Try to install after checking for incompatible installed versions.
#
install: all install-sh check-uninstall install-force
.PHONY: install
#
# Force installation, even in presense of incompatible previous
# version
# version. This may fail.
#
install-force: all install-translations
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
for i in $(PROGRAMS); do\
@ -452,7 +621,9 @@ install-force: all install-translations
.PHONY: install-force
#
# Uninstall this fish version
#
uninstall: uninstall-translations
-for i in $(PROGRAMS); do \
@ -473,9 +644,13 @@ uninstall: uninstall-translations
done;
.PHONY: uninstall
# Uninstall older fish release. This is not the default uninstall
#
# Uninstall an older fish release. This is not the default uninstall
# since there is a slight chance that it removes a file put in place by
# the sysadmin.
# the sysadmin. But if 'make install' detects a file confligt, it
# suggests using this target.
#
uninstall-legacy: uninstall
-rm -f $(DESTDIR)$(sysconfdir)/fish.d/fish_interactive.fish
@ -513,41 +688,87 @@ uninstall-translations:
fi
.PHONY: uninstall-translations
#
# The build rules for all the commands
#
#
# Build the fish program.
#
fish: $(FISH_OBJS) main.o
$(CC) $(FISH_OBJS) main.o $(LDFLAGS) -o $@
#
# Build the fish_pager program.
#
fish_pager: $(FISH_PAGER_OBJS)
$(CC) $(FISH_PAGER_OBJS) $(LDFLAGS) -o $@
#
# Build the fishd program.
#
fishd: $(FISHD_OBJS)
$(CC) $(FISHD_OBJS) $(LDFLAGS) -o $@
#
# Build the fish_tests program.
#
fish_tests: $(FISH_TESTS_OBJS)
$(CC) $(FISH_TESTS_OBJS) $(LDFLAGS) -o $@
# mimedb does not need any libraries, so we don't use LDFLAGS here
#
# Build the mimedb program.
#
# mimedb does not need any libraries, so we don't use LDFLAGS here.
#
mimedb: $(MIME_OBJS) doc_src/mimedb.o
$(CC) $(MIME_OBJS) doc_src/mimedb.o $(LDFLAGS) -o $@
# count does not need any libraries, so we don't use LDFLAGS here
#
# Build the count program.
#
# count does not need any libraries, so we don't use LDFLAGS here.
#
count: count.o
$(CC) count.o -o $@
#
# Build the set_color program
#
set_color: set_color.o doc_src/set_color.o common.o
$(CC) set_color.o doc_src/set_color.o common.o wutil.o $(LDFLAGS) -o $@
#
# Test program for the tokenizer library
#
tokenizer_test: tokenizer.c tokenizer.h wutil.o common.o
$(CC) $(CFLAGS) tokenizer.c wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@
#
# Neat little program to show output from terminal
#
key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o
$(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o $(LDFLAGS) -o $@
#
# Update dependencies
#
@ -556,12 +777,16 @@ depend:
./config.status
.PHONY: depend
#
# Copy all the source files into a new directory and use tar to create
# an archive from it. Simplest way I could think of to make an archive
# witout backups, autogenerated files, etc.
#
# Uses install instead of mkdir so build won't fail if the directory
# exists
#
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FILES) $(TEST_DIR_FILES) $(SHARE_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog user_doc doc_src/builtin_doc
rm -rf fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@
@ -586,9 +811,19 @@ fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FIL
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
rm -rf fish-@PACKAGE_VERSION@
#
# Just an alias for fish-@PACKAGE_VERSION@.tar
#
tar: fish-@PACKAGE_VERSION@.tar
.PHONY: tar
#
# Make compressed tar archives
#
fish-@PACKAGE_VERSION@.tar.gz: fish-@PACKAGE_VERSION@.tar
gzip -f --best -c fish-@PACKAGE_VERSION@.tar >fish-@PACKAGE_VERSION@.tar.gz
@ -598,8 +833,19 @@ fish-@PACKAGE_VERSION@.tar.bz2: fish-@PACKAGE_VERSION@.tar
dist: fish-@PACKAGE_VERSION@.tar.bz2
.PHONY: dist
#
# Build the RPM spec file.
#
fish.spec: fish.spec.in
./config.status
#
# Create .rpm file for the current systems architecture and an
# .src.rpm file.
#
rpm: fish-@PACKAGE_VERSION@.tar.bz2 fish.spec
@if which rpmbuild; then true; else \
echo Could not find the rpmbuild command, needed to build an rpm; \

View file

@ -1,17 +1,25 @@
#
# This file is the main build configuration file for fish. It is used
# to determine your systems capabilities, and tried to adapt fish to
# to determine your systems capabilities, and tries to adapt fish to
# take maximum advantage of the services your system offers.
#
# Process this file using the 'autoconf' to produce a working
# Process this file using the 'autoconf' command to produce a working
# configure script, which should in turn be executed in order to
# configure the build process.
# configure the build process.
#
AC_INIT(fish,1.22.0,fish-users@lists.sf.net)
#
# If needed, run autoconf to regenerate the configure file
#
# This makes sure that after running autoconf once to create the first
# version of configure, we never again need to worry about manually
# running autoconf to handle an updates configure.ac.
#
AC_MSG_CHECKING([if autoconf needs to be run])
if test configure -ot configure.ac; then
AC_MSG_RESULT([yes])
@ -36,7 +44,13 @@ else
fi
#
# If needed, run autoheader to regenerate config.h.in
#
# This makes sure we never ever have to run autoheader manually. It
# will be run whenever needed automatically.
#
AC_MSG_CHECKING([if autoheader needs to be run])
if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
AC_MSG_RESULT([yes])
@ -55,9 +69,15 @@ else
fi
#
# Detect directories which may contain additional headers, libraries
# and commands. This needs to be done early - before Autoconf starts
# to mess with CFLAGS and all the other environemnt variables.
#
# This mostly helps OS X users, since fink usually installs out of
# tree and doesn't update CFLAGS.
#
for i in /usr/pkg /sw /opt /opt/local; do
AC_MSG_CHECKING([for $i/include include directory])
@ -89,9 +109,18 @@ done
AC_SUBST( optbindirs, $optbindirs )
#
# Tell autoconf to create config.h header
#
AC_CONFIG_HEADERS(config.h)
#
# This adds markup to the code that results in a few extra compile
# time checks on recent GCC versions. It helps stop a few common bugs.
#
AH_BOTTOM([#if __GNUC__ >= 3
#define __warn_unused __attribute__ ((warn_unused_result))
#define __sentinel __attribute__ ((sentinel))
@ -101,16 +130,27 @@ AH_BOTTOM([#if __GNUC__ >= 3
#endif])
#
# Set up various programs needed for install
#
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
#
# Check for seq command. If missing, make sure fallback shellscript
# implementation is installed
# implementation is installed.
#
AC_CHECK_PROG( SEQ_FALLBACK, seq, [ ], [seq])
#
# Optionally drop xsel command
#
AC_ARG_WITH(
xsel,
AC_HELP_STRING(
@ -131,18 +171,19 @@ else
AC_SUBST( XSEL_MAN_PATH,[ ])
fi
# These help out with getting better prototypes on some platforms
#
# Test if the compiler accepts the -std=c99 flag. If so, using it
# 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"
XCPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -std=c99"
AC_MSG_CHECKING(if -std=c99 works)
AC_CACHE_VAL(
local_cv_has__std_c99,
[
@ -161,6 +202,7 @@ AC_CACHE_VAL(
)
]
)
AC_MSG_RESULT($local_cv_has__std_c99)
case x$local_cv_has__std_c99 in
xno)
@ -197,6 +239,7 @@ if test "$CC" = gcc; then
fi
#
# If we are compiling against glibc, set some flags to work around
# some rather stupid attempts to hide prototypes for *wprintf
@ -239,6 +282,8 @@ 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
@ -248,13 +293,18 @@ fi
# 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*)
@ -267,7 +317,10 @@ case $target_os in
esac
#
# BSD-specific flags go here
#
AC_MSG_CHECKING([if we are under BSD])
case $target_os in
*bsd*)
@ -281,11 +334,13 @@ case $target_os in
esac
#
# 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
# it can make sure the fish installation directory is in the path
# during startup.
#
if [[ "$prefix" = NONE ]]; then
export prefix=/usr/local
AC_SUBST( prefix, /usr/local)
@ -294,8 +349,11 @@ else
fi
#
# Set up the directory where the documentation files should be
# installed
#
AC_ARG_VAR( [docdir], [Documentation direcotry] )
if test -z $docdir; then
@ -304,16 +362,27 @@ else
AC_SUBST(docdir, [$docdir])
fi
#
# Set up locale directory. This is where the .po files will be
# installed.
#
AC_SUBST( [localedir], [$datadir/locale])
#
# See if Linux procfs is present. This is used to get extra
# 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],
@ -321,13 +390,21 @@ AC_DEFINE(
[Define to 1 if the wgettext function should be used for translating strings.]
)
# Check for presense of various libraries
#
# Check presense of various libraries
#
AC_SEARCH_LIBS( gettext, intl,,)
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
# Check for presense of various header files
#
# Check presense of various header files
#
AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h term.h ncurses/term.h libintl.h ncurses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h sys/termios.h])
AC_CHECK_HEADER(
@ -342,6 +419,7 @@ AC_CHECK_HEADER(
]
)
#
# On some platforms (Solaris 10) adding -std=c99 in turn requires that
# _POSIX_C_SOURCE be defined to 200112L otherwise several
@ -369,6 +447,7 @@ AC_CHECK_HEADER(
#
# * This test should be (but does not need to be) run after the
# conditional definition of __EXTENSIONS__, to avoid redundant tests.
#
XCFLAGS="$CFLAGS"
@ -452,26 +531,43 @@ for i in "" "-D_POSIX_C_SOURCE=200112L" "-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=2
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
CFLAGS="$XCFLAGS"
fi
# Check for presense of various functions
#
# Check for presense of various functions used by fish
#
AC_CHECK_FUNCS( gettext wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf )
AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc )
AC_CHECK_FUNCS( wcstol dcgettext wcslcat wcslcpy lrand48_r killpg)
# The Makefile also needs to know if we have gettext, so it knows if the translations should be installed.
#
# The Makefile also needs to know if we have gettext, so it knows if
# the translations should be installed.
#
AC_CHECK_FUNC( gettext, AC_SUBST( HAVE_GETTEXT, 1 ), AC_SUBST( HAVE_GETTEXT, 0 ) )
#
# Here follows a list of small programs used to test for various
# features that Autoconf doesn't tell us about
#
#
# Check if realpath accepts null for its second argument
#
AC_MSG_CHECKING([if realpath accepts null for its second argument])
AC_RUN_IFELSE(
[
@ -506,7 +602,10 @@ else
fi
# Check if struct winsize exists
#
# Check if struct winsize and TIOCGWINSZ exist
#
AC_MSG_CHECKING([if struct winsize and TIOCGWINSZ exist])
AC_LINK_IFELSE(
[
@ -535,8 +634,12 @@ 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])