summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-02-25 17:17:23 -0800
committerIan Romanick <ian.d.romanick@intel.com>2010-02-25 17:17:23 -0800
commitd59673c9de9f14e6aefcdb0b06751d935385c4aa (patch)
tree6b4540b0d65a3db3a281f42c366d1b9c0715caf8
parente41a1cd4d534639272938210c5491077688ccd37 (diff)
autoconf for the ...
-rw-r--r--.gitignore19
-rw-r--r--Makefile41
-rw-r--r--Makefile.am39
-rwxr-xr-xautogen.sh12
-rw-r--r--configure.ac71
-rw-r--r--glsl_lexer.lpp (renamed from glsl_lexer.l)2
-rw-r--r--glsl_parser.ypp (renamed from glsl_parser.y)1
-rw-r--r--glsl_parser_extras.cpp2
8 files changed, 141 insertions, 46 deletions
diff --git a/.gitignore b/.gitignore
index 4c67868622..e098bdb965 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,22 @@
+.deps
+COPYING
+INSTALL
+Makefile.in
+aclocal.m4
+autom4te.cache
+config.*
+configure
+depcomp
+ylwrap
+install-sh
+missing
+stamp-h1
+Makefile
*.o
*~
builtin_types.h
glsl_lexer.cpp
glsl_parser.output
-glsl_parser.tab.cpp
-glsl_parser.tab.h
-glsl_parser.tab.hpp
+glsl_parser.cpp
+glsl_parser.h
glsl
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 7b1f3f1f93..0000000000
--- a/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-CSRCS = symbol_table.c hash_table.c glsl_types.c
-CCSRCS = glsl_parser.tab.cpp glsl_lexer.cpp glsl_parser_extras.cpp \
- ast_expr.cpp
-# ast_to_hir.cpp ir.cpp hir_field_selection.cpp
-OBJS = $(CSRCS:.c=.o) $(CCSRCS:.cpp=.o)
-
-CC = gcc
-CXX = g++
-WARN = -Wall -Wextra -Wunsafe-loop-optimizations -Wstack-protector \
- -Wunreachable-code
-CPPFLAGS = -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
-CFLAGS = -O0 -ggdb3 -fstack-protector $(CPPFLAGS) $(WARN) -std=c89 -ansi -pedantic
-CXXFLAGS = -O0 -ggdb3 -fstack-protector $(CPPFLAGS) $(WARN)
-LDLAGS = -ggdb3
-
-glsl: $(OBJS)
- $(CXX) $(LDLAGS) $(OBJS) -o glsl
-
-glsl_parser.tab.cpp glsl_parser.tab.h: glsl_parser.y
- bison --report-file=glsl_parser.output -v -d \
- --output=glsl_parser.tab.cpp \
- --name-prefix=_mesa_glsl_ $< && \
- mv glsl_parser.tab.hpp glsl_parser.tab.h
-
-glsl_lexer.cpp: glsl_lexer.l
- flex --outfile="glsl_lexer.cpp" $<
-
-glsl_parser_tab.o: glsl_parser.tab.cpp
-glsl_types.o: glsl_types.c glsl_types.h builtin_types.h
-glsl_lexer.o: glsl_lexer.cpp glsl_parser.tab.h glsl_parser_extras.h ast.h
-glsl_parser.o: glsl_parser_extras.h ast.h
-ast_to_hir.o: ast_to_hir.cpp symbol_table.h glsl_parser_extras.h ast.h glsl_types.h ir.h
-
-builtin_types.h: builtin_types.sh
- ./builtin_types.sh > builtin_types.h
-
-clean:
- rm -f $(OBJS) glsl
- rm -f glsl_lexer.cpp glsl_parser.tab.{cpp,h,hpp} glsl_parser.output
- rm -f builtin_types.h
- rm -f *~ \ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000000..28d9c3c7a1
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,39 @@
+# Copyright © 2010 Intel Corporation
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+# USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+AUTOMAKE_OPTIONS = foreign
+
+bin_PROGRAMS = glsl
+glsl_SOURCES = symbol_table.c hash_table.c glsl_types.c \
+ glsl_parser.ypp glsl_lexer.lpp glsl_parser_extras.cpp \
+ ast_expr.cpp
+# ast_to_hir.cpp ir.cpp hir_field_selection.cpp
+
+BUILT_SOURCES = glsl_parser.h builtin_types.h
+
+glsl_parser.h: glsl_parser.ypp
+
+.lpp.cpp:
+ $(LEXCOMPILE) --outfile="$@" $<
+
+builtin_types.h: builtin_types.sh
+ sh ./builtin_types.sh > builtin_types.h
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000000..904cd6746c
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000000..b97feb9440
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,71 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.61)
+AC_INIT(glsl, XXXXX, idr@freedesktop.org, glsl)
+AC_CONFIG_SRCDIR([Makefile.am])
+AM_CONFIG_HEADER([config.h])
+
+AM_INIT_AUTOMAKE
+
+AM_MAINTAINER_MODE
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_MAKE_SET
+AC_PROG_YACC
+AC_PROG_LEX
+
+# Checks for libraries.
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+AC_HEADER_STDC
+
+
+AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [use debug compiler flags and macros @<:@default=disabled@:>@])],
+ [enable_debug="$enableval"],
+ [enable_debug=no]
+)
+if test "x$enable_debug" = xyes; then
+ DEFINES="$DEFINES -DDEBUG"
+ if test "x$GCC" = xyes; then
+ # Remove any -g or -O flags from the command line
+ CFLAGS=[`echo $CFLAGS | sed 's/-g[^ \t]*[ \t]*//g;s/-O[^ \t]*[ \t]*//g'`]
+ CFLAGS="$CFLAGS -O0 -ggdb3 -fstack-protector -D_FORTIFY_SOURCE=2"
+ fi
+ if test "x$GXX" = xyes; then
+ # Remove any -g flags from the command line
+ CXXFLAGS=[`echo $CXXFLAGS | sed 's/-g[^ \t]*[ \t]*//g;s/-O[^ \t]*[ \t]*//g'`]
+ CXXFLAGS="$CXXFLAGS -O0 -ggdb3 -fstack-protector -D_FORTIFY_SOURCE=2"
+ fi
+fi
+
+
+if test "x$GCC" = xyes ; then
+ WARN="-Wall -Wextra -Wunsafe-loop-optimizations -Wstack-protector -Wunreadchable-code"
+else
+ WARN=""
+fi
+
+if test "x$GXX" = xyes ; then
+ WARN="-Wall -Wextra -Wunsafe-loop-optimizations -Wstack-protector"
+else
+ WARN=""
+fi
+
+if test "x$GCC" = xyes ; then
+ CFLAGS="$CFLAGS -std=c89 -ansi -pedantic"
+fi
+
+CFLAGS="$CFLAGS $WARN"
+CXXFLAGS="$CXXFLAGS $WARN"
+YFLAGS="-d -v"
+
+AC_OUTPUT([Makefile])
diff --git a/glsl_lexer.l b/glsl_lexer.lpp
index 201d461683..9c7e3064e4 100644
--- a/glsl_lexer.l
+++ b/glsl_lexer.lpp
@@ -23,7 +23,7 @@
*/
#include "ast.h"
#include "glsl_parser_extras.h"
-#include "glsl_parser.tab.h"
+#include "glsl_parser.h"
#include "symbol_table.h"
#define YY_USER_ACTION \
diff --git a/glsl_parser.y b/glsl_parser.ypp
index f4105652b8..c755725458 100644
--- a/glsl_parser.y
+++ b/glsl_parser.ypp
@@ -41,6 +41,7 @@
%lex-param {void *scanner}
%parse-param {struct _mesa_glsl_parse_state *state}
+%name-prefix "_mesa_glsl_"
%union {
int n;
diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp
index 54d510c1a1..f30b7d8eb6 100644
--- a/glsl_parser_extras.cpp
+++ b/glsl_parser_extras.cpp
@@ -33,7 +33,7 @@
#include "ast.h"
#include "glsl_parser_extras.h"
-#include "glsl_parser.tab.h"
+#include "glsl_parser.h"
#include "symbol_table.h"
void