Check for Perl in the configure script, rather than just assuming it's installed

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6343 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-11-16 19:13:39 +00:00
parent 67b80c973d
commit 5f05dd99e6
5 changed files with 132 additions and 5 deletions

View File

@ -35,6 +35,9 @@ if test "x$LEX" != "xflex" ; then
fi
AC_PROG_VERSION_CHECK([flex], [2.5.33], [2.5.34])
AX_WITH_PROG([PERL], [perl], [])
AM_CONDITIONAL([PERL_AVAILABLE], test -z "$PERL")
# Enable Compiler/LibC GNU extensions
AC_GNU_SOURCE
@ -371,3 +374,8 @@ if test "x$use_system_sqlite" = "xno" ; then
AC_MSG_WARN([${SQLITE_PKG_ERRORS}])
AC_MSG_WARN([We currently only accept SQLite versions >= 3.6.])
fi
if test -z "$PERL" ; then
AC_MSG_NOTICE()
AC_MSG_WARN([Perl isn't installed, autogeneration of some sources will not work.])
fi

View File

@ -1,9 +1,11 @@
if PERL_AVAILABLE
%.schema.sql: $(top_srcdir)/build_tools/code-generators/db-lang.pl $(top_srcdir)/build_tools/code-generators/sql_tabledef_cg.pm $(top_srcdir)/src/%.tpl
$^ $@
$(PERL) $^ $@
%.data.sql: $(top_srcdir)/build_tools/code-generators/db-lang.pl $(top_srcdir)/build_tools/code-generators/sql_insertdef_cg.pm $(srcdir)/../stats $(top_srcdir)/src/%.tpl
$^ $@
$(PERL) $^ $@
BUILT_SOURCES = \
stats-db2.data.sql \
stats-db2.schema.sql
endif

36
m4/ax_with_perl.m4 Normal file
View File

@ -0,0 +1,36 @@
# ===========================================================================
# http://autoconf-archive.cryp.to/ax_with_perl.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_WITH_PERL([VALUE-IF-NOT-FOUND],[PATH])
#
# DESCRIPTION
#
# Locates an installed Perl binary, placing the result in the precious
# variable $PERL. Accepts a present $PERL, then --with-perl, and failing
# that searches for perl in the given path (which defaults to the system
# path). If perl is found, $PERL is set to the full path of the binary; if
# it is not found $PERL is set to VALUE-IF-NOT-FOUND if provided,
# unchanged otherwise.
#
# A typical use could be the following one:
#
# AX_WITH_PERL
#
# LAST MODIFICATION
#
# 2008-05-05
#
# COPYLEFT
#
# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
AC_DEFUN([AX_WITH_PERL],[
AX_WITH_PROG(PERL,perl,$1,$2)
])

75
m4/ax_with_prog.m4 Normal file
View File

@ -0,0 +1,75 @@
# ===========================================================================
# http://autoconf-archive.cryp.to/ax_with_prog.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH])
#
# DESCRIPTION
#
# Locates an installed program binary, placing the result in the precious
# variable VARIABLE. Accepts a present VARIABLE, then --with-program, and
# failing that searches for program in the given path (which defaults to
# the system path). If program is found, VARIABLE is set to the full path
# of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND
# if provided, unchanged otherwise.
#
# A typical example could be the following one:
#
# AX_WITH_PROG(PERL,perl)
#
# NOTE: This macro is based upon the original AX_WITH_PYTHON macro from
# Dustin J. Mitchell <dustin@cs.uchicago.edu>.
#
# LAST MODIFICATION
#
# 2008-05-05
#
# COPYLEFT
#
# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
# Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
AC_DEFUN([AX_WITH_PROG],[
AC_PREREQ([2.61])
pushdef([VARIABLE],$1)
pushdef([EXECUTABLE],$2)
pushdef([VALUE_IF_NOT_FOUND],$3)
pushdef([PATH_PROG],$4)
AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)
AS_IF(test -z "$VARIABLE",[
AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)
AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[[PATH]]]]],absolute path to EXECUTABLE executable), [
AS_IF([test "$withval" != "yes" -a "$withval" != "no"],[
VARIABLE="$withval"
AC_MSG_RESULT($VARIABLE)
],[
AS_IF([test "$withval" = "no"],[
VARIABLE="VALUE_IF_NOT_FOUND"
],[
VARIABLE=""
])
AC_MSG_RESULT([no])
])
],[
AC_MSG_RESULT([no])
])
AS_IF(test -z "$VARIABLE" -a "$withval" != "no",[
AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
])
])
popdef([PATH_PROG])
popdef([VALUE_IF_NOT_FOUND])
popdef([EXECUTABLE])
popdef([VARIABLE])
])

View File

@ -4,11 +4,13 @@
%.lex.h %.lex.c:: %.l
$(LEX) $(LFLAGS) $(AM_LFLAGS) -o$@ $<
if PERL_AVAILABLE
%.c: $(top_srcdir)/build_tools/code-generators/db-lang.pl $(top_srcdir)/build_tools/code-generators/c_sqliteload_cg.pm %.tpl.sql.c %.tpl
$^ $@
$(PERL) $^ $@
%.h: $(top_srcdir)/build_tools/code-generators/db-lang.pl $(top_srcdir)/build_tools/code-generators/c_structdef_cg.pm %.tpl.struct.h %.tpl
$^ $@
$(PERL) $^ $@
endif
# Required to force using a C++ linker
force-linker.cpp:
@ -27,9 +29,13 @@ BUILT_SOURCES = \
message_parser.tab.h \
scriptvals_lexer.lex.c \
scriptvals_parser.tab.c \
scriptvals_parser.tab.h \
scriptvals_parser.tab.h
if PERL_AVAILABLE
BUILT_SOURCES += \
stats-db2.c \
stats-db2.h
endif
CLEANFILES = \
force-linker.cpp \