Autoconf tweaks to make library detection more robust

darcs-hash:20060130165706-ac50b-e7685a85f07811815fb01ac3b79609ea7f0a7786.gz
This commit is contained in:
axel 2006-01-31 02:57:06 +10:00
parent 521d09b6d0
commit c8a36c9889
2 changed files with 34 additions and 22 deletions

View File

@ -33,9 +33,9 @@ CC := @CC@
INSTALL:=@INSTALL@
# Compiler flags
CFLAGS := @CFLAGS@ @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing
CFLAGS:=@CFLAGS@ -Wall -std=gnu99 -fno-strict-aliasing
CPPFLAGS=@CPPFLAGS@
LDFLAGS:= -l@CURSESLIB@ @LIBS@ @LDFLAGS@ @LIBDIR@
LDFLAGS:= @LIBS@ @LDFLAGS@
# Installation directories
prefix = @prefix@
@ -188,7 +188,7 @@ all: $(PROGRAMS) user_doc
.PHONY: all
debug:
make fish CFLAGS="-O0 -Wno-unused -Werror -g @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing"
make fish CFLAGS="-O0 -Wno-unused -Werror -g -Wall -std=gnu99 -fno-strict-aliasing"
.PHONY: debug
# User documentation, describing the features of the fish shell.

View File

@ -1,17 +1,39 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(fish,1.20.1,fish-users@lists.sf.net)
for i in /usr/pkg /sw; do
AC_MSG_CHECKING([for $i/include include directory])
if test -d $i/include; then
AC_MSG_RESULT(yes)
CPPFLAGS="$CPPFLAGS -I$i/include/"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for $i/lib library directory])
if test -d $i/lib; then
AC_MSG_RESULT(yes)
LDFLAGS="$LDFLAGS -L$i/lib/ -R$i/lib/"
else
AC_MSG_RESULT(no)
fi
done
# If needed, run autoheader 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])
if which autoheader >/dev/null; then
echo running autoheader...
AC_MSG_NOTICE([running autoheader])
autoheader
else
echo Could not find the autoheader program in your path.
echo This program is needed because the configure.ac file has been modified.
echo Please install it and try again.
exit 1
AC_MSG_ERROR( [cannot find the autoheader program in your path.
This program is needed because the configure.ac file has been modified.
Please install it and try again.])
fi
else
AC_MSG_RESULT([no])
fi
# Tell autoconf to create config.h header
@ -26,10 +48,9 @@ AC_PROG_INSTALL
AC_CHECK_PROG( has_doxygen, [doxygen], "true")
if ! test $has_doxygen = "true"; then
echo Could not find the Doxygen program in your path.
echo This program is needed to build fish.
echo Please install it and try again.
exit 1
AC_MSG_ERROR( [cannot find the Doxygen program in your path.
This program is needed to build fish.
Please install it and try again.])
fi
# Check for seq program. If missing, install fallback shellscript implementation
@ -93,10 +114,6 @@ AC_SUBST( [LOCALEDIR], [$datadir/locale])
# See if Linux procfs is present
AC_CHECK_FILES([/proc/self/stat])
# See if NetBSD pkgsrc is installed
AC_CHECK_FILE([/usr/pkg/lib],[AC_SUBST(LIBDIR,[-L/usr/pkg/lib\ -R/usr/pkg/lib])])
AC_CHECK_FILE([/usr/pkg/include],[AC_SUBST(INCLUDEDIR,[-I/usr/pkg/include])])
# Check for RLIMIT_AS in sys/resource.h.
AC_MSG_CHECKING([for RLIMIT_AS in sys/resource.h])
AC_TRY_COMPILE([#include <sys/resource.h>],
@ -187,12 +204,7 @@ else
fi
# Check if we have ncurses, and use it rather than curses if possible.
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
# Force use of ncurses if it is avialable via NetBSD pkgsrc. This is an
# ugly kludge to force NetBSD to use ncurses, since NetBSDs own version
# does not properly support terminfo.
AC_CHECK_FILE([/usr/pkg/include/ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)])
AC_SEARCH_LIBS( setupterm, [ncurses curses], [ AC_MSG_NOTICE([Found curses implementation])], [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish seq])
AC_OUTPUT