OSDN Git Service

autoconf for the ...
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 26 Feb 2010 01:17:23 +0000 (17:17 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 26 Feb 2010 01:17:23 +0000 (17:17 -0800)
.gitignore
Makefile [deleted file]
Makefile.am [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
glsl_lexer.lpp [moved from glsl_lexer.l with 99% similarity]
glsl_parser.ypp [moved from glsl_parser.y with 99% similarity]
glsl_parser_extras.cpp

index 4c67868..e098bdb 100644 (file)
@@ -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 (file)
index 7b1f3f1..0000000
--- 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 (file)
index 0000000..28d9c3c
--- /dev/null
@@ -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 (executable)
index 0000000..904cd67
--- /dev/null
@@ -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 (file)
index 0000000..b97feb9
--- /dev/null
@@ -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])
similarity index 99%
rename from glsl_lexer.l
rename to glsl_lexer.lpp
index 201d461..9c7e306 100644 (file)
@@ -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                                         \
similarity index 99%
rename from glsl_parser.y
rename to glsl_parser.ypp
index f410565..c755725 100644 (file)
@@ -41,6 +41,7 @@
 
 %lex-param   {void *scanner}
 %parse-param {struct _mesa_glsl_parse_state *state}
+%name-prefix "_mesa_glsl_"
 
 %union {
    int n;
index 54d510c..f30b7d8 100644 (file)
@@ -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