aboutsummaryrefslogtreecommitdiffstats
path: root/lib/megaco/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'lib/megaco/configure.in')
-rw-r--r--lib/megaco/configure.in262
1 files changed, 262 insertions, 0 deletions
diff --git a/lib/megaco/configure.in b/lib/megaco/configure.in
new file mode 100644
index 0000000000..297d618369
--- /dev/null
+++ b/lib/megaco/configure.in
@@ -0,0 +1,262 @@
+dnl Process this file with autoconf to produce a configure script. -*-m4-*-
+dnl
+dnl %CopyrightBegin%
+dnl
+dnl Copyright Ericsson AB 2001-2009. All Rights Reserved.
+dnl
+dnl The contents of this file are subject to the Erlang Public License,
+dnl Version 1.1, (the "License"); you may not use this file except in
+dnl compliance with the License. You should have received a copy of the
+dnl Erlang Public License along with this software. If not, it can be
+dnl retrieved online at http://www.erlang.org/.
+dnl
+dnl Software distributed under the License is distributed on an "AS IS"
+dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+dnl the License for the specific language governing rights and limitations
+dnl under the License.
+dnl
+dnl %CopyrightEnd%
+dnl
+
+dnl define([AC_CACHE_LOAD], )dnl
+dnl define([AC_CACHE_SAVE], )dnl
+
+if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then
+ # We do not want to use a common cache!
+ cache_file=/dev/null
+fi
+
+AC_INIT(vsn.mk)
+
+if test -z "$ERL_TOP" || test ! -d $ERL_TOP ; then
+ AC_CONFIG_AUX_DIRS(autoconf)
+else
+ erl_top=${ERL_TOP}
+ AC_CONFIG_AUX_DIRS($erl_top/erts/autoconf)
+fi
+
+if test "X$host" != "Xfree_source" -a "X$host" != "Xwin32"; then
+ AC_CANONICAL_HOST
+else
+ host_os=win32
+fi
+
+
+dnl ----------------------------------------------------------------------
+dnl Checks for programs.
+dnl ----------------------------------------------------------------------
+
+AC_DEFUN(ERL_REENTRANT_FLEX,
+[flex_compile='$LEX -R -Pconftest -oconftest.c conftest.flex 1>&AC_FD_CC'
+changequote(253, 273)dnl
+cat > conftest.flex <<EOF
+/*
+ * This (reentrant) example code comes from the flex manual
+ */
+
+%option reentrant stack noyywrap
+%x COMMENT
+
+%%
+
+"//" yy_push_state( COMMENT, yyscanner);
+.|\n
+
+<COMMENT>\n yy_pop_state( yyscanner );
+<COMMENT>[^\n]+ fprintf( yyout, "%s\n", yytext);
+
+%%
+
+int main ( int argc, char * argv[] )
+{
+ yyscan_t scanner;
+
+ yylex_init ( &scanner );
+ yylex ( scanner );
+ yylex_destroy ( scanner );
+ return 0;
+}
+EOF
+changequote([, ])dnl
+AC_MSG_CHECKING(for reentrant capable flex)
+if AC_TRY_EVAL(flex_compile) && test -s conftest.c; then
+ ifelse([$1], , :, [
+ $1])
+ AC_MSG_RESULT([yes])
+else
+ echo "configure: failed program was:" 1>&AC_FD_CC
+ cat conftest.flex 1>&AC_FD_CC
+ echo "configure: PATH was $PATH" 1>&AC_FD_CC
+ifelse([$2], , , [
+ $2
+])dnl
+ AC_MSG_RESULT([no])
+fi
+])
+
+
+dnl
+dnl Shall we attempt to use reentrant flex scanner or not
+dnl
+AC_ARG_ENABLE(megaco_reentrant_flex_scanner,
+[ --enable-megaco-reentrant-flex-scanner enable reentrant megaco flex scanner
+ --disable-megaco-reentrant-flex-scanner disable reentrant megaco flex scanner],
+ if test x${enable_megaco_reentrant_flex_scanner} = xno ; then
+ ENABLE_REENTRANT_MEGACO_FLEX_SCANNER=false
+ else
+ ENABLE_REENTRANT_MEGACO_FLEX_SCANNER=true
+ fi,
+ ENABLE_REENTRANT_MEGACO_FLEX_SCANNER=true)
+
+
+dnl
+dnl flex is needed by megaco. lex wont do!
+dnl
+
+AC_PROG_LEX
+if test "$LEX" != flex; then
+ ENABLE_MEGACO_FLEX_SCANNER=false
+else
+ ENABLE_MEGACO_FLEX_SCANNER=true
+ dnl Check if we can generate a reentrant scanner
+ dnl ENABLE_REENTRANT_MEGACO_FLEX_SCANNER=true
+ if ${ENABLE_REENTRANT_MEGACO_FLEX_SCANNER} = true ; then
+ ERL_REENTRANT_FLEX(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER=true,
+ ENABLE_REENTRANT_MEGACO_FLEX_SCANNER=false)
+ fi
+fi
+AC_SUBST(ENABLE_MEGACO_FLEX_SCANNER)
+AC_SUBST(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER)
+
+
+
+dnl
+dnl For increased performance it is possible to disable lineno
+dnl
+AC_ARG_ENABLE(megaco_flex_scanner_lineno,
+[ --enable-megaco-flex-scanner-lineno enable megaco flex scanner lineno
+ --disable-megaco-flex-scanner-lineno disable megaco flex scanner lineno],
+ if test x${enable_megaco_flex_scanner_lineno} = xno ; then
+ ENABLE_MEGACO_FLEX_SCANNER_LINENO=false
+ else
+ ENABLE_MEGACO_FLEX_SCANNER_LINENO=true
+ fi,
+ ENABLE_MEGACO_FLEX_SCANNER_LINENO=true)
+AC_SUBST(ENABLE_MEGACO_FLEX_SCANNER_LINENO)
+
+
+
+dnl
+dnl C compiler (related) defs
+dnl
+
+AC_PROG_CC
+
+dnl Magic test for clearcase.
+if test -d ../../system; then
+ OTP_EXTRA_FLAGS=-DOTP_RELEASE
+else
+ OTP_EXTRA_FLAGS=
+fi
+
+
+dnl
+dnl The ErlDrvEntry struct changed in R13 (another field)
+dnl
+AC_CHECK_MEMBERS([struct ErlDrvEntry.stop_select],
+ [
+ CFLAGS="$CFLAGS -DMEGACO_DRV_ENTRY_HAS_STOP_SELECT"
+ ],
+ [],
+ [
+ #include "erl_driver.h"
+ ])
+
+
+dnl
+dnl Flags to the C compiler
+dnl
+dnl make sure we find config.h
+CFLAGS="$CFLAGS -I${ERL_TOP}/erts/$host -I${ERL_TOP}/erts/include/$host $OTP_EXTRA_FLAGS"
+
+if test "X$host" = "Xwin32"; then
+ DED_CFLAGS="$CFLAGS"
+else
+ case $host_os in
+ darwin*)
+ CFLAGS="$CFLAGS -no-cpp-precomp"
+ ;;
+ esac
+
+ if test "x$GCC" = xyes; then
+ DED_CFLAGS="$CFLAGS -fPIC $DED_CFLAGS"
+ else
+ DED_CFLAGS="$CFLAGS $DED_CFLAGS"
+ fi
+fi
+
+dnl emulator includes needed
+DED_INCLUDE="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host"
+
+DED_CFLAGS="$DED_INCLUDE $DED_CFLAGS"
+
+
+
+AC_SUBST(DED_CFLAGS)
+
+
+AC_CHECK_PROGS(DED_LD, [ld.sh ld], no_ld)
+if test "$DED_LD" = no_ld; then
+ AC_MSG_ERROR([ld is required to build the flex scanner!])
+fi
+
+
+AC_MSG_CHECKING(for linker flags for loadable drivers)
+case $host_os in
+ win32)
+ DED_LDFLAGS="-dll"
+ ;;
+ solaris2*|sysv4*)
+ DED_LDFLAGS="-G"
+ ;;
+ aix4*)
+ DED_LDFLAGS="-G -bnoentry -bexpall"
+ ;;
+ freebsd2*)
+ # Non-ELF GNU linker
+ DED_LDFLAGS="-Bshareable"
+ ;;
+ darwin*)
+ # Mach-O linker, a shared lib and a loadable
+ # object file is not the same thing.
+ DED_LDFLAGS="-bundle -flat_namespace -undefined suppress"
+ DED_CFLAGS="$DED_CFLAGS -fno-common"
+ ;;
+ *)
+ # assume GNU linker and ELF
+ DED_LDFLAGS="-shared"
+ ;;
+esac
+DED_LDFLAGS="$LDFLAGS $DED_LDFLAGS"
+AC_MSG_RESULT([$DED_LDFLAGS])
+AC_SUBST(DED_LDFLAGS)
+
+
+AC_CHECK_PROG(PERL, perl, perl, no_perl)
+if test "$PERL" = no_perl; then
+ AC_MSG_ERROR([Perl is required to build the flex scanner!])
+fi
+
+
+dnl This is the os flavour, should be unix, vxworks or win32
+if test "X$host" = "Xwin32"; then
+ ERLANG_OSTYPE=win32
+else
+ ERLANG_OSTYPE=unix
+fi
+
+AC_SUBST(ERLANG_OSTYPE)
+
+
+AC_OUTPUT(src/flex/$host/Makefile:src/flex/Makefile.in)
+