]> OCCT Git - occt-wok.git/commitdiff
000000: The WOK doesn't generate AUTOMAKE metafile building the OpenCascade
authorvtn <vtn@opencascade.com>
Fri, 26 Oct 2012 08:56:23 +0000 (12:56 +0400)
committeribs <ibs@opencascade.com>
Mon, 19 Nov 2012 12:31:59 +0000 (16:31 +0400)
wgenproj: option -IDE=amk added

The WOK generates automake files are building the OpenCascade possibility has been added

src/WOKTclLib/OS.tcl
src/WOKTclLib/osutils.tcl
src/WOKTclLib/templates/acinclude.m4 [new file with mode: 0644]
src/WOKTclLib/templates/build_configure [new file with mode: 0644]
src/WOKTclLib/templates/custom.sh.in [new file with mode: 0644]
src/WOKTclLib/templates/template.ac [new file with mode: 0644]
src/WOKTclLib/templates/template.mam [new file with mode: 0644]
src/WOKTclLib/templates/template.mamx [new file with mode: 0644]

index 1a3e4a43b28da702f9a070a6968ec6802876d849..d6712f6eb3fe0ee4becb868ba67687ea481ec5dd 100644 (file)
@@ -3177,6 +3177,27 @@ proc OS:cbp { theModules theOutDir } {
   return $aProjectFiles
 }
 
+proc OS:MKAMK { theOutDir {theModules {}} theSubPath} {
+  wokUtils:FILES:mkdir $theOutDir
+
+  foreach aModule $theModules {
+    foreach aToolKit [$aModule:toolkits] {
+      puts " toolkit: $aToolKit ==> [woklocate -p ${aToolKit}:source:EXTERNLIB]"
+      wokUtils:FILES:rmdir $theOutDir/$aToolKit
+      wokUtils:FILES:mkdir $theOutDir/$aToolKit
+      osutils:tk:mkam $theOutDir/$aToolKit $aToolKit
+    }
+    foreach anExecutable [OS:executable $aModule] {
+      wokUtils:FILES:rmdir $theOutDir/$anExecutable
+      wokUtils:FILES:mkdir $theOutDir/$anExecutable
+      osutils:tk:mkamx $theOutDir/$anExecutable $anExecutable
+    }
+  }
+
+  osutils:am:adm $theOutDir $theModules
+  osutils:am:root [wokinfo -p HomeDir] $theSubPath $theModules 
+}
+
 # Function to generate Code Blocks workspace and project files
 proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
 
@@ -3200,10 +3221,10 @@ set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
 
 # Entry function to generate project files and solutions for IDE
 proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } {
-  set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "cbp" "cmk"}
-
+  set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "cbp" "cmk" "amk" }
+  
   if { [lsearch $aSupportedIDE $theIDE] < 0 } {
-    puts stderr "WOK does not support generation of project files for the selected IDE: $theIDE"
+    puts stderr "WOK does not support generation of project files for the selected IDE: $theIDE\nSupported IDEs: [join ${aSupportedIDE} " "]"
     return
   }
 
@@ -3241,7 +3262,6 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } {
   # Create output directory
   set aWokStation "$::env(WOKSTATION)"
     
-  # compatibility patch. 
   if { [lsearch -exact {vc7 vc8 vc9 vc10} $theIDE] != -1 } {
     set aWokStation "msvc"
   }
@@ -3261,6 +3281,7 @@ proc OS:MKPRC { {theOutDir {}} {theProjectType {}} {theIDE ""} } {
     "vc10"  { OS:MKVC  $anOutDir $aModules $anAllSolution $theIDE }
     "cbp"   { OS:MKCBP $anOutDir $aModules $anAllSolution }
     "cmk"   { OS:MKCMK $anOutDir $aModules $anAllSolution }
+    "amk"   { OS:MKAMK $anOutDir $aModules "adm/${aWokStation}/${theIDE}"}
   }
 
   # Store generated GUIDs map
index 524bbd50e474318ffa1f4c37fc0d809c30fa5951..a052c57f46c589347c2a534f02880004201df47c 100755 (executable)
@@ -1594,6 +1594,218 @@ proc osutils:tk:mkamx { dir tkloc } {
   }
 }
 
+
+;#
+;# Create in dir the Makefile.am in $dir directory.
+;# Returns the full path of the created file.
+;#
+proc osutils:am:adm { dir {lesmodules {}} } {
+
+  set amstring "srcdir = @srcdir@\n\n"
+  set subdirs "SUBDIRS ="
+  set vpath "VPATH = @srcdir@ ${dir}: "
+  set make ""
+  set phony ".PHONY:"
+  foreach theModule $lesmodules {
+    set units [osutils:tk:sort [$theModule:toolkits]]
+    set units [concat $units [OS:executable $theModule]]
+    append amstring "${theModule}_PKGS ="
+    append vpath "\\\n"
+    foreach unit $units {
+      append amstring " ${unit}"
+      append vpath "${dir}/${unit}: "
+    }
+    set up ${theModule}
+    if { [info procs ${theModule}:alias] != "" } {
+      set up [${theModule}:alias]
+    }
+    set up [string toupper ${up}]
+    append amstring "\n\nif ENABLE_${up}\n"
+    append amstring "  ${theModule}_DIRS = \$(${theModule}_PKGS)\n"
+    append amstring "else\n"
+    append amstring "  ${theModule}_DIRS = \n"
+    append amstring "endif\n\n"
+    append subdirs " \$(${theModule}_DIRS)"
+    append make "${theModule}:\n"
+    append make "\tfor d in \$(${theModule}_PKGS); do \\\n"
+    append make "\t\tcd \$\$d; \$(MAKE) \$(AM_MAKEFLAGS) lib\$\$d.la; cd ..; \\\n"
+    append make "\tdone\n\n"
+    append phony " ${theModule}"
+  }
+  append amstring "$subdirs\n\n"
+  append amstring "$vpath\n\n"
+  append amstring $make
+  append amstring $phony
+  wokUtils:FILES:StringToFile $amstring [set fmam [file join $dir Makefile.am]]
+  return [list $fmam]
+}
+
+;#
+;# Create in dir the Makefile.am and configure.ac in CASROOT directory.
+;# Returns the full path of the created file.
+;#
+proc osutils:am:root { dir theSubPath {lesmodules {}} } {
+  set amstring "srcdir = @srcdir@\n\n"
+  append amstring "SUBDIRS = ${theSubPath}\n\n"
+  append amstring "VPATH = @srcdir@ @top_srcdir@/${theSubPath}: @top_srcdir@/${theSubPath}:\n\n"
+
+  set phony ".PHONY:"
+
+  set acstring [osutils:readtemplate ac "Makefile.am"]
+  set enablestr ""
+  set confstr ""
+  set condstr ""
+  set repstr ""
+  set acconfstr ""
+
+  set exelocal "install-exec-local:\n"
+  append exelocal "\t"
+  append exelocal {$(INSTALL) -d $(prefix)/$(platform)}
+  append exelocal "\n"
+  foreach d {bin lib} {
+    append exelocal "\t"
+    append exelocal "if \[ -e \$(prefix)/${d} -a ! -e \$(prefix)/\$(platform)/${d} \]; then \\\n"
+    append exelocal "\t\tcd \$(prefix)/\$(platform) && ln -s ../${d} ${d}; \\\n"
+    append exelocal "\tfi\n"
+  }
+  append exelocal "\t"
+  append exelocal {buildd=`pwd`; cd $(top_srcdir); sourced=`pwd`; cd $(prefix); installd=`pwd`; cd $$buildd;}
+  append exelocal " \\\n"
+  append exelocal "\t"
+  append exelocal {if [ "$$installd" != "$$sourced" ]; then}
+  append exelocal " \\\n"
+  append exelocal "\t\t"
+  append exelocal {$(INSTALL) -d $(prefix)/inc;}
+  append exelocal " \\\n"
+  append exelocal "\t\t"
+  append exelocal {cp -frL $(top_srcdir)/inc $(prefix);}
+  append exelocal " \\\n"
+  append exelocal "\t\t"
+  append exelocal {cp -frL $$buildd/config.h $(prefix);}
+  append exelocal " \\\n"
+  append exelocal "\t\tfor d in "
+
+  foreach theModule $lesmodules {
+    append amstring "${theModule}_PKGS ="
+    foreach r [${theModule}:ressources] {
+      if { "[lindex $r 1]" == "r" } {
+       append amstring " [lindex $r 2]"
+      }
+    }
+    set up ${theModule}
+    if { [info procs ${theModule}:alias] != "" } {
+      set up [${theModule}:alias]
+    }
+    set up [string toupper ${up}]
+    set lower ${theModule}
+    if { [info procs ${theModule}:alias] != "" } {
+      set lower [${theModule}:alias]
+    }
+    set lower [string tolower ${lower}]
+
+    append amstring "\n\nif ENABLE_${up}\n"
+    append amstring "  ${theModule}_DIRS = \$(${theModule}_PKGS)\n"
+    append amstring "else\n"
+    append amstring "  ${theModule}_DIRS = \n"
+    append amstring "endif\n\n"
+    append amstring "${theModule}:\n"
+    append amstring "\tcd \$(top_builddir)/${theSubPath} && \$(MAKE) \$(AM_MAKEFLAGS) ${theModule}\n\n"
+    append phony " ${theModule}"
+
+    append exelocal " \$(${theModule}_DIRS)"
+
+    append enablestr "AC_ARG_ENABLE(\[${lower}\],\n"
+    append enablestr "  \[AS_HELP_STRING(\[--disable-${lower}\],\[Disable ${theModule} components\])\],\n"
+    append enablestr "  \[ENABLE_${up}=\${enableval}\],\[ENABLE_${up}=yes\])\n"
+
+    set deplist [OS:lsdep ${theModule}]
+    set acdeplist {}
+    if { [info procs ${theModule}:acdepends] != "" } {
+      set acdeplist [${theModule}:acdepends]
+    }
+
+    if { [llength $deplist] > 0 || [llength $acdeplist] > 0} {
+      append confstr "if test \"xyes\" = \"x\$ENABLE_${up}\"; then\n"
+    } else {
+      append confstr "if test \"xyes\" != \"x\$ENABLE_${up}\"; then\n"
+    }
+    foreach dep $deplist {
+      set dup ${dep}
+      if { [info procs ${dep}:alias] != "" } {
+       set dup [${dep}:alias]
+      }
+      set dup [string toupper ${dup}]
+      append confstr "  if test \"xyes\" = \"x\$ENABLE_${up}\" -a \"xyes\" != \"x\$ENABLE_${dup}\"; then\n"
+      append confstr "    AC_MSG_NOTICE(\[Disabling ${theModule}: not building ${dep} component\])\n"
+      append confstr "    DISABLE_${up}_REASON=\"(${dep} component disabled)\"\n"
+      append confstr "    ENABLE_${up}=no\n"
+      append confstr "  fi\n"
+    }
+    foreach dep $acdeplist {
+      append confstr "  if test \"xyes\" = \"x\$ENABLE_${up}\" -a \"xyes\" != \"x\$HAVE_${dep}\"; then\n"
+      append confstr "    AC_MSG_NOTICE(\[Disabling ${theModule}: ${dep} not found\])\n"
+      append confstr "    DISABLE_${up}_REASON=\"(${dep} not found)\"\n"
+      append confstr "    ENABLE_${up}=no\n"
+      append confstr "  fi\n"
+    }
+    if { [llength $deplist] > 0 || [llength $acdeplist] > 0 } {
+      append confstr "else\n"
+    }
+    append confstr "  DISABLE_${up}_REASON=\"(Disabled)\"\n"
+    append confstr "fi\n"
+
+    append condstr "AM_CONDITIONAL(\[ENABLE_${up}\], \[test \"xyes\" = \"x\$ENABLE_${up}\"\])\n"
+    append repstr [format "echo \"%-*s  \$ENABLE_${up} \$DISABLE_${up}_REASON\"" 26 ${theModule}]
+    append repstr "\n"
+
+    set units [$theModule:toolkits]
+    set units [concat $units [OS:executable $theModule]]
+    foreach unit $units {
+      append acconfstr "${theSubPath}/${unit}/Makefile \\\n"
+    }
+  }
+
+  append exelocal "; do \\\n"
+  append exelocal "\t\t\t"
+  append exelocal {$(INSTALL) -d $(prefix)/src/$$d;}
+  append exelocal " \\\n"
+  append exelocal "\t\t\t"
+  append exelocal {cp -frL $(top_srcdir)/src/$$d $(prefix)/src;}
+  append exelocal " \\\n"
+  append exelocal "\t\tdone; \\\n"
+  append exelocal "\tfi\n"
+  append exelocal "\t"
+  append exelocal {if [ -e $(prefix)/inc/config.h ]; then}
+  append exelocal " \\\n"
+  append exelocal "\t\t"
+  append exelocal {unlink $(prefix)/inc/config.h;}
+  append exelocal " \\\n"
+  append exelocal "\tfi\n"
+  append exelocal "\t"
+  append exelocal {cd $(prefix)/inc && ln -s ../config.h config.h}
+  append exelocal "\n"
+  append exelocal "\t"
+  append exelocal {cd $(top_srcdir) && cp *.sh $(prefix)}
+  append exelocal "\n"
+  append exelocal "\n"
+
+  append amstring $exelocal
+  append amstring $phony
+
+  regsub -all -- {__ENABLEMODULES__} $acstring $enablestr acstring
+  regsub -all -- {__CONFMODULES__} $acstring $confstr acstring
+  regsub -all -- {__CONDMODULES__} $acstring $condstr acstring
+  regsub -all -- {__REPMODULES__} $acstring $repstr acstring
+  regsub -all -- {__ACCONFMODULES__} $acstring $acconfstr acstring
+
+  wokUtils:FILES:StringToFile $amstring [set fmam [file join $dir Makefile.am]]
+  wokUtils:FILES:StringToFile $acstring [set fmam [file join $dir configure.ac]]
+  file copy -force -- [file join $::env(WOK_LIBRARY)/templates build_configure] [file join $dir build_configure]
+  file copy -force -- [file join $::env(WOK_LIBRARY)/templates acinclude.m4] [file join $dir acinclude.m4]
+  file copy -force -- [file join $::env(WOK_LIBRARY)/templates custom.sh.in] [file join $dir custom.sh.in]
+  return [list $fmam]
+}
+
 ;#
 ;#  ((((((((((((( Formats in Makefile.am )))))))))))))
 ;#
@@ -1756,42 +1968,6 @@ proc osutils:in:__AMDEPTRUE__ { l } {
   return [wokUtils:EASY:FmtSimple1 $fmt $l]
 }
 
-;#############################################################
-;#
-proc TESTAM { {root} {modules {}} {ll {}} } {
-#    source [woklocate -p OS:source:OS.tcl]
-#    source [woklocate -p WOKTclLib:source:osutils.tcl]
-
-  set lesmodules [OS:listmodules $modules]
-
-  if { $ll != {} } {  set lesmodules $ll }
-  foreach theModule $lesmodules {
-    foreach unit [$theModule:toolkits] {
-      puts " toolkit: $unit ==> [woklocate -p ${unit}:source:EXTERNLIB]"
-      wokUtils:FILES:rmdir $root/$unit
-      wokUtils:FILES:mkdir $root/$unit
-      osutils:tk:mkam $root/$unit $unit
-    }
-    foreach unit [OS:executable $theModule] {
-      wokUtils:FILES:rmdir $root/$unit
-      wokUtils:FILES:mkdir $root/$unit
-      osutils:tk:mkamx $root/$unit $unit
-    }
-  }
-}
-
-# Generate Code::Blocks project file for ToolKit
-proc osutils:cbptk { theOutDir theToolKit } {
-  set aUsedToolKits [list]
-  set anIncPaths    [list]
-  set aTKDefines    [list]
-  set aTKSrcFiles   [list]
-  
-  osutils:tkinfo $theOutDir $theToolKit aUsedToolKits anIncPaths aTKDefines aTKSrcFiles
-
-  return [osutils:cbp $theOutDir $theToolKit $aTKSrcFiles $aUsedToolKits $anIncPaths $aTKDefines]
-}
-
 proc osutils:tkinfo { theOutDir theToolKit theUsedToolKits theIncPaths theTKDefines theTKSrcFiles } { 
   set aWokStation "$::env(WOKSTATION)"
   
@@ -1970,7 +2146,17 @@ proc osutils:cmktk { theOutDir theToolKit {theIsExec false} } {
   close $aFile
 }
 
+# Generate Code::Blocks project file for ToolKit
+proc osutils:cbptk { theOutDir theToolKit } {
+  set aUsedToolKits [list]
+  set anIncPaths    [list]
+  set aTKDefines    [list]
+  set aTKSrcFiles   [list]
+  
+  osutils:tkinfo $theOutDir $theToolKit aUsedToolKits anIncPaths aTKDefines aTKSrcFiles
 
+  return [osutils:cbp $theOutDir $theToolKit $aTKSrcFiles $aUsedToolKits $anIncPaths $aTKDefines]
+}
 
 # Generate Code::Blocks project file for Executable
 proc osutils:cbpx { theOutDir theToolKit } {
diff --git a/src/WOKTclLib/templates/acinclude.m4 b/src/WOKTclLib/templates/acinclude.m4
new file mode 100644 (file)
index 0000000..0c84f00
--- /dev/null
@@ -0,0 +1,157 @@
+#------------------------------------------------------------------------
+# Check for TCL
+# Options: --with-tcl=  :    Specify location of tclConfig.sh
+#          --without-tcl=  : Skip check for TCL, assume not installed
+# Defines:
+#          HAVE_TCL : yes/no
+#          Everything from tclConfig.sh
+#------------------------------------------------------------------------
+AC_DEFUN([SC_TCL_CFG], [
+  AC_ARG_WITH(tcl, 
+AC_HELP_STRING([--with-tcl=PATH],[Directory containing tclConfig.sh])
+AC_HELP_STRING([--without-tcl],  [Assume no tcl libraries available]) , 
+              [with_tcl="${withval}";require_tcl=yes],[with_tcl=yes;require_tcl=no])
+  
+  # If user requested disabling of tcl check
+  if test "xno" = "x$with_tcl"; then
+    HAVE_TCL=no
+    require_tcl=no
+  # Otherwise...
+  else
+    HAVE_TCL=no
+    # Search for tclConfig.sh
+    if test "xyes" != "x$with_tcl"; then
+      # If user specified location
+      . "${with_tcl}/tclConfig.sh" || AC_MSG_ERROR("Cannot read file: ${with_tcl}/tclConfig.sh")
+      HAVE_TCL=yes
+    else
+      # Search for tclConfig.sh in usual spots
+      tcl_cfg_file=
+      AC_MSG_CHECKING([for tclConfig.sh])
+      for i in /usr /usr/local ${prefix} /opt/sfw /usr/tcltk; do
+        if test -d $i; then
+          for j in $i/lib $i/lib/tcl $i/lib/tcl[[8-9]].[[0-9]] $i/lib/itcl; do
+            if test -r "$j/tclConfig.sh"; then
+              tcl_cfg_file="$j/tclConfig.sh"
+              break
+            fi
+          done
+        fi
+        if test "x" != "x$tcl_cfg_file"; then
+          break
+        fi
+      done
+      AC_MSG_RESULT("$tcl_cfg_file")
+      
+      if test "x" != "x$tcl_cfg_file"; then
+        . "$tcl_cfg_file" || AC_MSG_ERROR("Cannot read file: $tcl_cfg_file") 
+        HAVE_TCL=yes
+
+        # if TCL_INCLUDE_SPEC wasn't defined, try to define it using TCL_INC_DIR
+        if test "x" = "x$TCL_INCLUDE_SPEC"; then
+          inc_path=`expr "x$TCL_INC_DIR" : "x\(.*\)/tcl-private/generic"`
+          if test "x" != "$inc_path"; then
+            TCL_INCLUDE_SPEC="-I$inc_path"
+          elif test "x" != "x$TCL_INC_DIR"; then
+            TCL_INCLUDE_SPEC="-I$TCL_INC_DIR"
+          fi
+        fi
+      else
+        HAVE_TCL=no
+      fi
+    fi
+    
+    # Check for tcl.h
+    AC_LANG_C
+    save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
+    AC_CHECK_HEADER([tcl.h],[],[HAVE_TCL=no])
+    CPPFLAGS="$save_CPPFLAGS"
+    
+    if test "xyes" = "x$require_tcl"; then
+      if test "xno" = "x$HAVE_TCL"; then
+        AC_MSG_ERROR([TCL not found.])
+      fi
+    fi
+  fi
+])
+
+
+#------------------------------------------------------------------------
+# Check for Tk
+# Options: --with-tk=  :    Specify location of Tk
+#          --without-tk=  : Skip check for Tk, assume not installed
+# Defines:
+#          HAVE_TK : yes/no
+#          Everything from tkConfig.sh
+#------------------------------------------------------------------------
+AC_DEFUN([SC_TK_CFG], [
+  AC_ARG_WITH(tk, 
+AC_HELP_STRING([--with-tk=PATH],[Directory containing tkConfig.sh])
+AC_HELP_STRING([--without-tk],  [Assume no Tk libraries available]) , 
+              [with_tk="${withval}";require_tk=yes],[with_tk=yes;require_tk=no])
+  
+  # If user requested disabling of Tk check
+  if test "xno" = "x$with_tk"; then
+    HAVE_TK=no
+    require_tk=no
+  # Otherwise...
+  else
+    HAVE_TK=no
+    # Search for tkConfig.sh
+    if test "xyes" != "x$with_tk"; then
+      # If user specified location
+      . "${with_tk}/tkConfig.sh" || AC_MSG_ERROR("Cannot read file: ${with_tk}/tkConfig.sh")
+      HAVE_TK=yes
+    else
+      # Search for tkConfig.sh in usual spots
+      tk_cfg_file=
+      AC_MSG_CHECKING([for tkConfig.sh])
+      for i in /usr /usr/local ${prefix} /opt/sfw /usr/tcltk; do
+        if test -d $i; then
+          for j in $i/lib $i/lib/tk $i/lib/tk[[8-9]].[[0-9]] $i/lib/itcl; do
+            if test -r "$j/tkConfig.sh"; then
+              tk_cfg_file="$j/tkConfig.sh"
+              break
+            fi
+          done
+        fi
+        if test "x" != "x$tk_cfg_file"; then
+          break
+        fi
+      done
+      AC_MSG_RESULT("$tk_cfg_file")
+      
+      if test "x" != "x$tk_cfg_file"; then
+        . "$tk_cfg_file" || AC_MSG_ERROR("Cannot read file: $tk_cfg_file") 
+        HAVE_TK=yes
+
+        # if TK_INCLUDE_SPEC wasn't defined, try to define it using TK_INC_DIR
+        if test "x" = "x$TK_INCLUDE_SPEC"; then
+          inc_path=`expr "x$TK_INC_DIR" : "x\(.*\)/tk-private/generic"`
+          if test "x" != "$inc_path"; then
+            TK_INCLUDE_SPEC="-I$inc_path"
+          elif test "x" != "x$TK_INC_DIR"; then
+            TK_INCLUDE_SPEC="-I$TK_INC_DIR"
+          fi
+        fi
+      else
+        HAVE_TK=no
+      fi
+    fi
+    
+    # Check for tk.h
+    AC_LANG_C
+    HAVE_TK=yes
+    save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC $TK_INCLUDE_SPEC"
+    AC_CHECK_HEADER([tk.h],[],[HAVE_TK=no])
+    CPPFLAGS="$save_CPPFLAGS"
+    
+    if test "xyes" = "x$require_tk"; then
+      if test "xno" = "x$HAVE_TK"; then
+        AC_MSG_ERROR([Tk not found.])
+      fi
+    fi
+  fi
+])
diff --git a/src/WOKTclLib/templates/build_configure b/src/WOKTclLib/templates/build_configure
new file mode 100644 (file)
index 0000000..e690a80
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+# ====================================================================
+# This script is just here to illustrate the procedure for preparing
+# the configure process. It creates configuration files (ex:
+# ltmain.sh) using libtoolize, the aclocal macro, the configure script
+# using autoconf and some scripts used in building process (ex:
+# install-sh) using automake. Automake is used here to creates the
+# files Makefile.in from the files Makefile.am.
+# ====================================================================
+# CONF_DIR is the path containing the present script
+#
+CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
+cd ${CONF_DIR}
+
+mkdir -p make
+
+# ____________________________________________________________________
+# aclocal creates the aclocal.m4 file from the standard macro and the
+# custom macro embedded in the directory salome_adm/unix/config_files.
+# output:
+#   aclocal.m4
+#   autom4te.cache (directory)
+echo "====================================================== aclocal"
+
+aclocal || exit 1
+
+# ____________________________________________________________________
+# libtoolize creates some configuration files (ltmain.sh,
+# config.guess and config.sub). It only depends on the libtool
+# version. The files are created in the directory specified with the
+# AC_CONFIG_AUX_DIR(<mydir>) tag (see configure.ac).
+# output:
+#   make/config.guess
+#   make/config.sub
+#   make/ltmain.sh
+echo "====================================================== libtoolize"
+
+libtoolize --force --copy --automake || exit 1
+
+# ____________________________________________________________________
+# autoheader creates config.h.in
+# output:
+#   configure
+echo "====================================================== autoheader"
+
+autoheader
+
+# ____________________________________________________________________
+# automake creates some scripts used in building process
+# (install-sh, missing, ...). It only depends on the automake
+# version. This step also creates the Makefile.in files from 
+# the Makefile.am files
+# output:
+#   make/depcomp
+#   make/config_files/install-sh
+#   make/missing
+#   Makefile.in (from Makefile.am)
+echo "====================================================== automake"
+
+automake --add-missing --copy --gnu
+
+# ____________________________________________________________________
+# autoconf creates the configure script from the file configure.ac (or
+# configure.in if configure.ac doesn't exist)
+# output:
+#   configure
+echo "====================================================== autoconf"
+
+autoconf
diff --git a/src/WOKTclLib/templates/custom.sh.in b/src/WOKTclLib/templates/custom.sh.in
new file mode 100644 (file)
index 0000000..69a0d45
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Mandatory 3rd-parties switches
+export HAVE_FREETYPE=@HAVE_FREETYPE@
+export HAVE_FTGL=@HAVE_FTGL@
+export HAVE_TCLTK=@HAVE_TCLTK@
+# Optional 3rd-parties switches
+export HAVE_FREEIMAGE=@HAVE_FREEIMAGE@
+export HAVE_GL2PS=@HAVE_GL2PS@
+export HAVE_TBB=@HAVE_TBB@
+export HAVE_QT=@HAVE_QT@
+
+export CSF_OPT_INC="@CSF_OPT_INC@"
+export CSF_OPT_LIB@ARCH@="@CSF_OPT_LIB@"
+export CSF_OPT_BIN@ARCH@="@CSF_OPT_BIN@"
diff --git a/src/WOKTclLib/templates/template.ac b/src/WOKTclLib/templates/template.ac
new file mode 100644 (file)
index 0000000..3d1280e
--- /dev/null
@@ -0,0 +1,921 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT([OpenCASCADE], [6.5.3])
+AC_CONFIG_AUX_DIR(make)
+AM_INIT_AUTOMAKE([foreign])
+AC_CANONICAL_HOST
+dnl AM_CONFIG_SRCDIR(src/Standard/Standard.cxx)
+
+CFLAGS="$CFLAGS"
+CXXFLAGS="$CXXFLAGS"
+
+AC_PROG_CC
+
+AM_CONFIG_HEADER(config.h)
+
+dnl AM_MAINTAINER_MODE
+
+AC_AIX
+AC_ISC_POSIX
+AC_C_BIGENDIAN
+
+AC_DISABLE_STATIC
+
+dnl Checks for programs.
+AM_PROG_LIBTOOL
+AC_PROG_CXX
+AC_PROG_CC_C_O
+AM_C_PROTOTYPES
+
+AC_PROG_AWK
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_YACC
+AC_PROG_MAKE_SET
+
+dnl Checks for header files.
+
+AC_HEADER_STDC
+AC_LANG([C])
+AC_MSG_CHECKING([ for C header files ])
+AC_CHECK_HEADERS(dlfcn.h dl.h ieeefp.h time.h sys/time.h pwd.h)
+AC_CHECK_HEADERS(sys/statvfs.h sys/vfs.h sys/param.h osfcn.h netdb.h)
+AC_CHECK_HEADERS(sys/ioctl.h net/if.h sys/systeminfo.h sys/utsname.h)
+AC_CHECK_HEADERS(sysent.h unistd.h sys/unistd.h sys/socket.h)
+AC_CHECK_HEADERS(ndir.h sys/ndir.h sys/dir.h signal.h sys/signal.h)
+AC_CHECK_HEADERS(sigfpe.h floatingpoint.h sys/machsig.h sys/siginfo.h)
+AC_CHECK_HEADERS(malloc.h strings.h sys/stat.h sys/sem.h sys/ipc.h)
+AC_CHECK_HEADERS(sys/times.h dirent.h getopt.h sys/vnode.h)
+
+
+AC_LANG([C++])
+AC_MSG_CHECKING([ for C++ header files ])
+AC_CHECK_HEADERS(istream ostream istream fstream ios iomanip iostream )
+AC_CHECK_HEADERS(stream.h strstream.h istream.h ostream.h fstream.h stdlib.h ios.h iostream.h)
+AC_CHECK_HEADERS(iomanip.h limits.h values.h float.h)
+AC_CHECK_HEADERS(siginfo.h bits/sigset.h bstring.h sys/types.h sys/select.h)
+AC_CHECK_HEADERS(X11/extensions/transovl.h X11/extensions/readdisplay.h)
+AC_CHECK_HEADERS(X11/extensions/multibuf.h)
+AC_CHECK_HEADERS(sys/filio.h sys/mman.h libc.h)
+AC_CHECK_HEADERS(X11/extensions/multibuf.h)
+AC_CHECK_HEADERS(sys/filio.h sys/mman.h libc.h)
+
+#-----------------------------------------------------------------------------
+# Posix threads library is required
+#-----------------------------------------------------------------------------
+AC_CHECK_HEADER([pthread.h],[],[AC_MSG_ERROR([Posix threads required])])
+AC_CHECK_LIB([pthread],[pthread_create],[],[AC_MSG_ERROR([Posix threads required])])
+CSF_ThreadLibs_LIB=-lpthread
+AC_SUBST(CSF_ThreadLibs_LIB)
+
+#-----------------------------------------------------------------------------
+# dl library is required
+#-----------------------------------------------------------------------------
+AC_CHECK_LIB([dl],[dlopen],[],[AC_MSG_ERROR([dl library is required])])
+CSF_SOCKETLibs_LIB=-ldl
+
+#---------------------------------------------------------------------
+#
+# Test for 64-bit platforms
+#  
+#  
+#---------------------------------------------------------------------
+AC_MSG_CHECKING([if platform is 64-bit])
+AC_TRY_COMPILE( [], 
+ [int array[((int)sizeof(void*))-6];],
+ [AC_MSG_RESULT([yes]); ARCH=64; CPPFLAGS="$CPPFLAGS -D_OCC64"; case $platform in Linux*) CPPFLAGS="$CPPFLAGS -m64";; esac],
+ [AC_MSG_RESULT([no]); ARCH=32;] )
+AC_SUBST(ARCH)
+
+if test "x${CSF_OPT_INC}" != "x"; then
+   CSF_OPT_INCLUDES=
+   for c in `echo ${CSF_OPT_INC} | sed 's/:/ /g'`; do
+       CSF_OPT_INCLUDES="-I$c ${CSF_OPT_INCLUDES}"
+   done
+fi
+if test "$ARCH" = "32" -a "x${CSF_OPT_LIB32}" != "x"; then
+   CSF_OPT_LIB=${CSF_OPT_LIB32}
+   CSF_OPT_LIBS=
+   for c in `echo ${CSF_OPT_LIB32} | sed 's/:/ /g'`; do
+       CSF_OPT_LIBS="-L$c ${CSF_OPT_LIBS}"
+   done
+fi
+if test "$ARCH" = "64" -a "x${CSF_OPT_LIB64}" != "x"; then
+   CSF_OPT_LIB=${CSF_OPT_LIB64}
+   CSF_OPT_LIBS=
+   for c in `echo ${CSF_OPT_LIB64} | sed 's/:/ /g'`; do
+       CSF_OPT_LIBS="-L$c ${CSF_OPT_LIBS}"
+   done
+fi
+
+AC_SUBST(CSF_OPT_INCLUDES)
+AC_SUBST(CSF_OPT_LIBS)
+
+#------------------------------------------------------------------------------
+# Get Tcl and TK configuration information from tclConfig.sh.
+#------------------------------------------------------------------------------
+
+SC_TCL_CFG
+SC_TK_CFG
+HAVE_TCLTK=no
+if test "xyes" = "x$HAVE_TCL"; then
+  if test "xyes" = "x$HAVE_TK"; then
+    HAVE_TCLTK=yes
+    CSF_TclLibs_INCLUDES="${TCL_INCLUDE_SPEC}"
+    CSF_TclTkLibs_INCLUDES="${TK_INCLUDE_SPEC}"
+    CSF_TclLibs_LIB="${TCL_LIB_SPEC}"
+    CSF_TclTkLibs_LIB="${TK_LIB_SPEC}"
+    CSF_OPT_INC="${TCL_PREFIX}/include:${TK_PREFIX}/include:${CSF_OPT_INC}"
+    CSF_OPT_LIB="${TCL_PREFIX}/lib:${TK_PREFIX}/lib:${CSF_OPT_LIB}"
+  fi
+fi
+if test "x${HAVE_TCLTK}" != "xyes"; then
+   DISABLE_TCLTK_REASON="(tcltk was not found)"
+fi
+AC_SUBST(TCL_VERSION)
+AC_SUBST(TK_VERSION)
+AC_SUBST(HAVE_TCLTK)
+AC_SUBST(CSF_TclLibs_INCLUDES)
+AC_SUBST(CSF_TclTkLibs_INCLUDES)
+AC_SUBST(CSF_TclLibs_LIB)
+AC_SUBST(CSF_TclTkLibs_LIB)
+
+platform=`uname -s`
+
+dnl Make sure CSFDB is defined in CXXFLAGS and CFLAGS
+CXXFLAGS="$CXXFLAGS -DCSFDB -DOCC_CONVERT_SIGNALS"
+CFLAGS="$CFLAGS -DCSFDB -DOCC_CONVERT_SIGNALS"
+
+case $platform in
+       Linux*) CXXFLAGS="$CXXFLAGS -DLIN -DLININTEL -D_GNU_SOURCE=1"
+               CFLAGS="$CFLAGS -DLIN -DLININTEL -fexceptions"
+               LDFLAGS="$LDFLAGS -lstdc++ -lrt";;
+       SunOS*) CXXFLAGS="$CXXFLAGS -Usun -DSOLARIS -instances=static"
+               CFLAGS="$CFLAGS -Usun -DSOLARIS -instances=static"
+               LDFLAGS="$LDFLAGS -instances=static"
+               CSF_SOCKETLibs_LIB="-lnsl ${CSF_SOCKETLibs_LIB}";;
+        OSF1*)  CXXFLAGS="$CXXFLAGS -DDECOSF1 -D__USE_STD_IOSTREAM -D_RWSTD_NO_EXCEPTIONS" 
+                CFLAGS="$CFLAGS -std1 -DDECOSF1"
+               LD=$CXX;;
+       *) ;;
+esac
+AC_SUBST(CSF_SOCKETLibs_LIB)
+
+AC_SUBST(platform)
+AC_LANG([C++])
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+AC_STRUCT_TM
+
+dnl Checks for library functions.
+AC_FUNC_ALLOCA
+AC_FUNC_MEMCMP
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS(gethostname putenv re_comp regcomp strcspn strdup strtol)
+AC_CHECK_FUNCS(statfs statvfs)
+
+
+AC_CACHE_CHECK([if it is OK to define stream input and output],
+def_cv_ios_ok,
+[AC_LANG([C++])
+ AC_TRY_COMPILE([#include <stream.h>
+static const int input = (ios::in) | (ios::nocreate);
+static const int output= (ios::out);],
+[return 0;],
+ def_cv_ios_ok=yes, def_cv_ios_ok=no)
+])
+if test "$def_cv_ios_ok" = yes; then
+  AC_DEFINE(DEF_IOS_OK,,[define if the compiler allows redefinition of stream input and output])
+fi
+
+
+AC_CACHE_CHECK([if class ostream has member function form],
+[ostream_cv_form_ok],
+[AC_LANG([C++])
+ AC_TRY_COMPILE([#include <iostream.h>],
+[cout << cout.form("%9.3e", 3.14159627e-4) << endl;
+return 0;],
+ ostream_cv_form_ok=yes, ostream_cv_form_ok=no)
+])
+if test "$ostream_cv_form_ok" = yes; then
+  AC_DEFINE(OSTREAM_FORM_OK,,[define if the class ostream has member function form])
+fi
+
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+
+# if the following code compiles then the union semun is
+# defined in the header <sys/sem.h>
+
+AC_CACHE_CHECK([if union semun is defined in <sys/sem.h>],
+[semun_cv_defined],
+[AC_LANG([C])
+AC_TRY_COMPILE([#include <sys/time.h>
+#include <sys/sem.h>],
+[union semun c;],
+ semun_cv_defined=yes, semun_cv_defined=no)
+])
+if test "$semun_cv_defined" = yes; then
+  AC_DEFINE(SEMUN_DEFINED,,[define if the union semun is in sys/sem.h])
+fi
+
+# if the following code compiles then the union semun has
+# the member __buf
+
+if test "$semun_cv_defined" = yes; then
+
+ AC_CACHE_CHECK(if union semun has member __buf,
+ semun_cv_buf_defined,
+ [AC_LANG([C])
+ AC_TRY_COMPILE([#include <sys/sem.h>],
+ [ union semun c; c.__buf = 0;],
+ semun_cv_buf_defined=yes, semun_cv_buf_defined=no)
+ ])
+ if test "$sumun_buf_defined" = yes; then
+  AC_DEFINE(SEMUN_BUF_DEFINED,,[define if semun has member __buf])
+ fi
+fi
+
+
+AC_CACHE_CHECK([if function semop takes a value],
+[semop_cv_no_reference],
+[AC_LANG([C])
+AC_TRY_COMPILE([#include <sys/sem.h>
+static struct sembuf event_flag ;],
+[int status;
+ int *semid;
+ status = semop(*semid,event_flag,1);
+],
+ semop_cv_no_reference=yes, semop_cv_no_reference=no)
+])
+if test "$semop_cv_no_reference" = yes; then
+  AC_DEFINE(SEMOP_NO_REFERENCE,,[define if the function semop takes a value])
+fi
+
+
+AC_CACHE_CHECK([if function semctl takes a value],
+[semctl_cv_no_reference],
+[AC_LANG([C])
+AC_TRY_COMPILE([#include <sys/sem.h>
+int get_semaphore(semid,event,value)
+ int *semid, *event, *value;
+{
+ int status;
+ status = semctl((*semid),*event,GETVAL,value);
+ return 0;
+}
+int *a,*b,*c;],
+[if(get_semaphore(a,b,c))
+ exit 0;],
+ semctl_cv_no_reference=yes, semctl_cv_no_reference=no)
+])
+if test "$semctl_cv_no_reference" = yes; then
+  AC_DEFINE(SEMCTL_NO_REFERENCE,,[define if the function semctl takes a value])
+fi
+
+AC_CHECK_LIB(malloc,mallinfo,[
+  AC_DEFINE(HAVE_MALLINFO,,[Define if we have a function called "mallinfo" in -lmalloc.])
+  LIBS="$LIBS -lmalloc"
+])
+
+AC_CHECK_LIB(sunmath,ieee_handler,[
+  AC_DEFINE(HAVE_SUNMATH,,[Define if we have a function called "ieee_handler" in -lsunmath.])
+  LIBS="$LIBS -lsunmath"
+])
+
+AC_CHECK_LIB(m,finite,[
+  AC_DEFINE(HAVE_FINITE,,[Define if we have a function called "finite" in -lm.])
+])
+
+#---------------------------------------------------------------------
+#
+# Check for Java Header Files 
+#  
+#  
+#---------------------------------------------------------------------
+
+AC_ARG_WITH([java-include],
+  [AC_HELP_STRING([--with-java-include=DIR],[Location of jni.h])],
+  [java_include="${withval}"],[java_include=])
+if test "xno" = "x$java_include"; then
+  # user specified --without-java-include
+  HAVE_JAVA=no
+else
+  if test "xyes" != "x$java_include" && test "x" != "x$java_include"; then
+    # user specified some path
+    
+    # test user-specified value is a directory
+    if test ! -d "$java_include"; then
+      AC_MSG_ERROR([$java_include: Not a directory])
+    fi
+    
+    # search for jni_md.h (typically in a system-specific subdir)
+    AC_MSG_CHECKING([for jni_md.h in $java_include])
+    extra_java_include=
+    if test -f "$java_include/jni_md.h"; then
+      result="$java_include/jni_md.h"
+    else
+      result=
+      for d in "$java_include"/*; do
+        if test -f "$d/jni_md.h"; then
+          extra_java_include="-I$d"
+          result="$d/jni_md.h"
+          break
+        fi
+      done
+      AC_MSG_RESULT([$result])
+    fi
+    
+    # put user-specified directory and jni_mh.h directory (if found)
+    # into CPPFLAGS
+    CPPFLAGS="$CPPFLAGS -I$java_include $extra_java_include"
+  fi
+  
+  # Now we check for a working jni.h that is version 1.2 or newer.
+  # Note: This check is done unless user specified --without-java-include
+  #       If --with-java-include wasn't specified, it will check the
+  #       default compiler search path and any paths the user specified
+  #       via CPPFLAGS on the command line.
+  AC_CHECK_HEADER( [jni.h], [HAVE_JAVA=yes], [HAVE_JAVA=no
+    AC_MSG_NOTICE("Specify --with-java-include=<DIR> to enalbe Java support")] )
+  if test "xyes" = "x$HAVE_JAVA"; then
+    AC_MSG_CHECKING([java JNI version >= 1.2])
+    AC_TRY_COMPILE( [#include <jni.h>],
+  [#ifndef JNI_VERSION_1_2
+     choke me
+   #endif], [HAVE_JAVA=yes],[HAVE_JAVA=no] )
+    AC_MSG_RESULT([$HAVE_JAVA])
+  fi
+  
+  # If user specified --with-java-include, fail if not found
+  # (If user didn't specify, then we gracefully disable things that
+  # require java.)
+  if test "x" != "x$java_include" && test "xyes" != "x$HAVE_JAVA"; then
+    AC_MSG_ERROR([working jni.h not found])
+  fi
+fi
+
+CFLAGS_save="$CFLAGS"
+CXXFLAGS_save="$CXXFLAGS"
+CPPFLAGS_save="$CPPFLAGS"
+LDFLAGS_save="$LDFLAGS"
+LIBS_save="$LIBS"
+
+#---------------------------------------------------------------------
+#
+# Configure X11 and check for utility library
+#
+#---------------------------------------------------------------------
+AC_LANG([C])
+
+AC_PATH_X
+HAVE_X11=no
+X_INCLUDE=""
+X_LIBS=""
+CSF_XmuLibs_INCLUDES=""
+CSF_XmuLibs_LIB=""
+if test "xyes" != "x$no_x"; then
+  HAVE_X11=yes
+  if test "x" != "x$x_includes"; then
+    X_INCLUDE="-I$x_includes"
+    CSF_XmuLibs_INCLUDES="$X_INCLUDE"
+    CXXFLAGS="$CXXFLAGS -I$x_includes"
+  fi
+  if test "x" != "x$x_libraries"; then
+    X_LIBS="-L$x_libraries"
+    CSF_XmuLibs_LIB="$X_LIBS"
+    LDFLAGS="$LDFLAGS -L$x_libraries"
+  fi
+  AC_CHECK_LIB( [X11], [XCreateWindow], [X_LIBS="${X_LIBS} -lXt -lX11"], [HAVE_X11=no] )
+  AC_CHECK_HEADER( [X11/Xmu/Xmu.h], [], [HAVE_X11=no] )
+  AC_CHECK_LIB( [Xmu], [XmuLookupStandardColormap], [CSF_XmuLibs_LIB="$CSF_XmuLibs_LIB -lXmu"], [HAVE_X11=no], [-lXt -lX11] )
+fi
+
+#---------------------------------------------------------------------
+#
+# Check for OpenGL Libraries
+#  
+#  
+#---------------------------------------------------------------------
+CSF_OpenGlLibs_INCLUDES="$X_INCLUDE"
+CSF_OpenGlLibs_LIB="$X_LIBS"
+if test "xno" = "x$HAVE_X11"; then
+  HAVE_GL=no
+else
+AC_LANG([C])
+  HAVE_GL=yes
+  HAVE_GL_INC=yes
+  AC_CHECK_HEADER( [GL/gl.h], [AC_CHECK_HEADER([GL/glu.h],[],[HAVE_GL_INC=no])], [HAVE_GL_INC=no] )
+  if test "x$HAVE_GL_INC" = "xyes"; then
+    AC_CHECK_TYPE(_GLUfuncptr,[],[CSF_OpenGlLibs_INCLUDES="$CSF_OpenGlLibs_INCLUDES -DNOGLUfuncptr=1"],[#include "GL/glu.h"])
+  else
+    HAVE_GL=no
+    AC_MSG_NOTICE("Specify CPPFLAGS=-I<opengl_inc_dir> to enable OpenGL support")
+  fi
+  CPPFLAGS="$CSF_OpenGlLibs_INCLUDES $CPPFLAGS"
+  HAVE_GL_LIB=yes
+  AC_CHECK_LIB( [GL], [glClear], [AC_CHECK_LIB([GLU],[gluSphere],[CSF_OpenGlLibs_LIB="$CSF_OpenGlLibs_LIB -lGLU -lGL"],[HAVE_GL_LIB=no],[-lGL])], [HAVE_GL_LIB=no] )
+  if test "xno" = "x$HAVE_GL_LIB"; then
+    HAVE_GL=no
+    AC_MSG_NOTICE("Specify LDFLAGS=-L<opengl_lib_dir> to enable OpenGL support")
+  fi
+fi
+AM_CONDITIONAL( HAVE_GL, [test "xyes" = "x$HAVE_GL"] )
+
+#---------------------------------------------------------------------
+#
+# Check for FREETYPE Libraries
+#  
+#  
+#---------------------------------------------------------------------
+AC_ARG_WITH([freetype],
+  [AC_HELP_STRING([--with-freetype=DIR],[Location of FREETYPE])],
+  [freetype="${withval}"],[freetype=])
+
+CSF_FREETYPE_INCLUDES=""
+CSF_FREETYPE_LIB=""
+
+if test "xyes" = "x${HAVE_GL}"; then
+  AC_LANG([C++])
+  HAVE_FREETYPE=no
+  HAVE_FREETYPE_INC=yes
+  CPPFLAGS="-I$freetype/include -I$freetype/include/freetype2 $CPPFLAGS"
+  AC_CHECK_HEADER( [ft2build.h], [], [HAVE_FREETYPE=no] )
+  if test ! -d $freetype; then
+       DISABLE_FREETYPE_REASON="($freetype directory is not exists)"
+       AC_MSG_ERROR([$freetype directory is not exists])
+  elif test "x$HAVE_FREETYPE_INC" = "xyes"; then
+    CSF_FREETYPE_INCLUDES="-I$freetype/include -I$freetype/include/freetype2"
+    LDFLAGS="-L$freetype/lib"
+    AC_CHECK_LIB(freetype, FT_Init_FreeType,
+    [
+       HAVE_FREETYPE=yes
+       CSF_FREETYPE_LIB="$LDFLAGS `$freetype/bin/freetype-config --libs`"
+       LIBS="$CSF_FREETYPE_LIB $LIBS"
+       CSF_OPT_INC="$freetype/include:$freetype/include/freetype2:${CSF_OPT_INC}"
+       CSF_OPT_LIB="$freetype/lib:${CSF_OPT_LIB}"
+    ],
+    [
+       DISABLE_FREETYPE_REASON="(freetype was not found)"
+       AC_MSG_ERROR([Unable to locate the required FreeType library])
+    ])
+  else
+       DISABLE_FREETYPE_REASON="(freetype was not found)"
+  fi
+else
+  DISABLE_FREETYPE_REASON="(--with-freetype=DIR option was not defined)"
+fi
+AM_CONDITIONAL( HAVE_FREETYPE, [test "xyes" = "x$HAVE_FREETYPE"] )
+
+#---------------------------------------------------------------------
+#
+# Check for FTGL Libraries
+#  
+#  
+#---------------------------------------------------------------------
+AC_ARG_WITH([ftgl],
+  [AC_HELP_STRING([--with-ftgl=DIR],[Location of FTGL])],
+  [ftgl="${withval}"],[ftgl=])
+
+CSF_FTGL_INCLUDES=""
+CSF_FTGL_LIB=""
+
+if test "xno" = "x${HAVE_FREETYPE}"; then
+  HAVE_FTGL=no
+  DISABLE_FTGL_REASON=$DISABLE_FREETYPE_REASON
+else
+  AC_LANG([C++])
+  HAVE_FTGL=no
+  HAVE_FTGL_INC=yes
+  CPPFLAGS="-I$ftgl/include -I$ftgl/include/FTGL $CPPFLAGS";
+  AC_CHECK_HEADERS([FTGL/ftgl.h ftgl.h], [], [
+  AC_CHECK_HEADERS([FTGL/FTGL.h FTGL.h], [HAVE_FTGL_UPPERCASE=-DHAVE_FTGL_UPPERCASE], 
+                                         [HAVE_FTGL_INC=no])])
+  if test ! -d $ftgl; then
+       DISABLE_FTGL_REASON="($ftgl directory is not exists)"
+       AC_MSG_ERROR([$ftgl directory is not exists])
+  elif test "x$HAVE_FTGL_INC" = "xyes"; then
+    CSF_FTGL_INCLUDES="-I$ftgl/include -I$ftgl/include/FTGL $HAVE_FTGL_UPPERCASE"
+    CPPFLAGS="$CSF_FTGL_INCLUDES $CPPFLAGS";
+    HAVE_FTGL_LIB=yes
+    AC_MSG_CHECKING([for FTGLTextureFont in -lftgl])
+    LDFLAGS="-L$ftgl/lib"
+    LIBS_sv=$LIBS
+    LIBS="-lftgl $CSF_OpenGlLibs_LIB $LIBS"
+    CSF_FTGL_LIB="-L$ftgl/lib -lftgl"
+    AC_TRY_LINK([
+#ifdef HAVE_FTGL_UPPERCASE
+#include <FTGL/FTGL.h>
+#else
+#include <FTGL/ftgl.h>
+#endif
+#include <FTGL/FTGLTextureFont.h>
+], [
+FTGLTextureFont font("");], [
+CSF_OPT_INC="$ftgl/include:${CSF_OPT_INC}"
+CSF_OPT_LIB="$ftgl/lib:${CSF_OPT_LIB}"
+AC_MSG_RESULT(yes)
+], [
+AC_MSG_RESULT(no)
+]) 
+    LIBS=$LIBS_sv
+  fi
+  if test "xyes" = "x$HAVE_FTGL_LIB"; then
+    HAVE_FTGL=yes
+  else
+    DISABLE_FTGL_REASON="(ftgl was not found)"
+  fi
+fi
+AM_CONDITIONAL( HAVE_FTGL, [test "xyes" = "x$HAVE_FTGL"] )
+
+#---------------------------------------------------------------------
+#
+# Check for GL2PS Libraries
+#  
+#  
+#---------------------------------------------------------------------
+AC_ARG_WITH([gl2ps],
+  [AC_HELP_STRING([--with-gl2ps=DIR],[Location of GL2PS])],
+  [gl2ps="${withval}"],[gl2ps=])
+
+if test "xno" = "xno$gl2ps"; then
+# user specified --without-gl2ps
+  HAVE_GL2PS=no
+  DISABLE_GL2PS_REASON="(--with-gl2ps=DIR option was not defined)"
+else
+  CSF_GL2PS_INCLUDES=""
+  CSF_GL2PS_LIB=""
+
+  if test "xno" = "x$HAVE_GL"; then
+       HAVE_GL2PS=no
+       DISABLE_GL2PS_REASON="(OpenGL  was not found)"
+  else
+       AC_LANG([C++])
+       HAVE_GL2PS=no
+       HAVE_GL2PS_INC=no
+       CPPFLAGS="-I$gl2ps/include $CPPFLAGS";
+       AC_CHECK_HEADER( [gl2ps.h], [HAVE_GL2PS_INC=yes], [HAVE_GL2PS_INC=no] )
+       if test ! -d $gl2ps; then
+          DISABLE_GL2PS_REASON="($gl2ps directory is not exists)"
+          AC_MSG_ERROR([$gl2ps directory is not exists])
+       elif test "x$HAVE_GL2PS_INC" = "xyes"; then
+          CSF_GL2PS_INCLUDES="-I$gl2ps/include -DHAVE_GL2PS"
+          HAVE_GL2PS_LIB=yes
+          AC_MSG_CHECKING([for gl2psEndPage in -lgl2ps])
+          LDFLAGS="-L$gl2ps/lib $LDFLAGS"
+          LIBS="$CSF_OpenGlLibs_LIB $LIBS"
+          AC_CHECK_LIB( [gl2ps], [gl2psEndPage],
+          [
+               CSF_GL2PS_LIB="-L$gl2ps/lib -lgl2ps"
+               CSF_OPT_INC="$gl2ps/include:${CSF_OPT_INC}"
+               CSF_OPT_LIB="$gl2ps/lib:${CSF_OPT_LIB}"
+               HAVE_GL2PS_LIB=yes
+          ],
+          [
+               HAVE_GL2PS_LIB=no
+          ])
+       fi
+       if test "xyes" = "x$HAVE_GL2PS_LIB"; then
+           HAVE_GL2PS=yes
+       else
+           HAVE_GL2PS=no
+            DISABLE_GL2PS_REASON="(gl2ps was not found)"
+       fi
+  fi
+fi
+AM_CONDITIONAL( HAVE_GL2PS, [test "xyes" = "x$HAVE_GL2PS"] )
+
+#---------------------------------------------------------------------
+#
+# Check for FREEIMAGE Libraries and Includes
+#  
+#  
+#---------------------------------------------------------------------
+AC_ARG_WITH([freeimage],
+  [AC_HELP_STRING([--with-freeimage=DIR],[Location of freeimage])],
+  [freeimage="${withval}"],[freeimage=])
+
+if test "xno" = "xno$freeimage"; then
+  # user specified --without-freeimage
+  HAVE_FREEIMAGE=no
+  DISABLE_FREEIMAGE_REASON="(--with-freeimage=DIR option was not defined)"
+else
+  CSF_FreeImagePlus_INCLUDES=""
+  CSF_FreeImagePlus_LIB=""
+
+  AC_LANG([C++])
+  HAVE_FREEIMAGE=no
+  HAVE_FREEIMAGE_INC=yes
+  CPPFLAGS="-I$freeimage/include $CPPFLAGS";
+  AC_CHECK_HEADER( [FreeImage.h], [], [HAVE_FREEIMAGE_INC=no] )
+  if test ! -d $freeimage; then
+    DISABLE_FREEIMAGE_REASON="($freeimage directory is not exists)"
+    AC_MSG_ERROR([$freeimage directory is not exists])
+  elif test "x$HAVE_FREEIMAGE_INC" = "xyes"; then
+    CSF_FreeImagePlus_INCLUDES="-I$freeimage/include -DHAVE_FREEIMAGE"
+    HAVE_FREEIMAGE_LIB=yes
+    AC_MSG_CHECKING([for FreeImage_OpenMemory in -lfreeimageplus])
+    LDFLAGS="-L$freeimage/lib $LDFLAGS"
+    LIBS="$CSF_FreeImagePlus_LIB $LIBS"
+    AC_CHECK_LIB( [freeimageplus], [FreeImage_OpenMemory],
+    [
+       HAVE_FREEIMAGE_LIB=yes;
+       CSF_OPT_INC="$freeimage/include:${CSF_OPT_INC}"
+       CSF_OPT_LIB="$freeimage/lib:${CSF_OPT_LIB}"
+       CSF_FreeImagePlus_LIB="-L$freeimage/lib -lfreeimageplus"
+    ], [HAVE_FREEIMAGE_LIB=no] )
+  fi
+  if test "xyes" = "x$HAVE_FREEIMAGE_LIB"; then
+    HAVE_FREEIMAGE=yes
+  else
+    HAVE_FREEIMAGE=no
+    DISABLE_FREEIMAGE_REASON="(freeimage was not found)"
+  fi
+fi
+AM_CONDITIONAL( HAVE_FREEIMAGE, [test "xyes" = "x$HAVE_FREEIMAGE"] )
+
+#---------------------------------------------------------------------
+#
+# Check for TBB Includes
+#  
+#  
+#---------------------------------------------------------------------
+AC_ARG_WITH([tbb-include],
+  [AC_HELP_STRING([--with-tbb-include=DIR],[Location of Intel Threading Building Blocks includes])],
+  [tbb_inc="${withval}"],[tbb_inc=])
+
+if test "xno" = "xno$tbb_inc"; then
+  # user specified --without-tbb-lib
+  HAVE_TBB=no
+  HAVE_TBB_INC=no
+  DISABLE_TBB_REASON_INC="(--with-tbb-include=DIR option was not defined)"
+else
+  CSF_TBB_INCLUDES=""
+  AC_LANG([C++])
+  HAVE_TBB_INC=yes
+  if test ! -d $tbb_inc; then
+    DISABLE_TBB_REASON_INC="($tbb_inc directory is not exists)"
+    AC_MSG_ERROR([$tbb_inc directory is not exists])
+  elif test "x$tbb_inc" != "x"; then
+     CPPFLAGS="-I$tbb_inc $CPPFLAGS";
+  else
+     AC_MSG_NOTICE("--with-tbb-include key is not defined")
+  fi
+  AC_CHECK_HEADER( [tbb/tbb.h], [], [HAVE_TBB_INC=no] )
+  if test "x$HAVE_TBB_INC" != "xyes"; then
+     AC_MSG_NOTICE("Specify --with-tbb-include to enable TBB support")
+     DISABLE_TBB_REASON_INC="(tbb includes were not found)"
+  fi
+fi
+
+#---------------------------------------------------------------------
+#
+# Check for TBB Libraries
+#  
+#  
+#---------------------------------------------------------------------
+AC_ARG_WITH([tbb-library],
+  [AC_HELP_STRING([--with-tbb-library=DIR],[Location of Intel Threading Building Blocks libraries])],
+  [tbb_lib="${withval}"],[tbb_lib=])
+
+if test "xno" = "xno$tbb_lib"; then
+  # user specified --without-tbb
+  HAVE_TBB=no
+  DISABLE_TBB_REASON_LIB="(--with-tbb-library=DIR option was not defined)"
+else
+  CSF_TBB_LIB=""
+  HAVE_TBB=yes
+
+  if test "x$HAVE_TBB_INC" = "xyes"; then
+     if test ! -d $tbb_lib; then
+       DISABLE_TBB_REASON_LIB="($tbb_lib directory is not exists)"
+       AC_MSG_ERROR([$tbb_lib directory is not exists])
+     elif test "x$tbb_lib" != "x"; then
+       LDFLAGS="-L$tbb_lib $LDFLAGS"
+     fi
+     AC_CHECK_LIB([tbb], [TBB_runtime_interface_version], [], [HAVE_TBB=no])
+  else
+     HAVE_TBB=no
+  fi
+
+  if test "x$HAVE_TBB" = "xyes"; then
+     if test "x$tbb_inc" != "x"; then
+       CSF_TBB_INCLUDES="-I$tbb_inc -DHAVE_TBB"
+     else
+       HAVE_TBB=no
+     fi
+     if test "x$tbb_lib" != "x"; then
+       CSF_TBB_LIB="-L$tbb_lib -ltbb -ltbbmalloc"
+     else
+       HAVE_TBB=no
+     fi
+     if test "x$HAVE_TBB" = "xyes"; then
+       CSF_OPT_INC="$tbb_inc:${CSF_OPT_INC}"
+       CSF_OPT_LIB="$tbb_lib:${CSF_OPT_LIB}"
+     else
+       DISABLE_TBB_REASON="(tbb was not found)";
+     fi
+  else
+     AC_MSG_NOTICE("Specify --with-tbb-library to enable TBB support")
+     DISABLE_TBB_REASON_LIB="(tbb libraries were not found)"
+  fi
+fi
+
+AM_CONDITIONAL( HAVE_TBB, [test "xyes" = "x$HAVE_TBB"] )
+
+#---------------------------------------------------------------------
+#
+# Check for QT Libraries
+#  
+#  
+#---------------------------------------------------------------------
+AC_ARG_WITH([qt],
+  [AC_HELP_STRING([--with-qt=QTDIR],[Location of QT])],
+  [qt="${withval}"],[qt=])
+
+if test "xno" = "xno$qt"; then
+# user specified --without-qt
+  HAVE_QT=no
+  DISABLE_QT_REASON="(--with-qt=DIR option was not defined)"
+else
+  CSF_QT_INCLUDES=""
+  CSF_QT_LIB=""
+
+  if test "xno" = "x$HAVE_GL"; then
+       HAVE_QT=no
+       DISABLE_QT_REASON="(OpenGL  was not found)"
+  else
+       AC_LANG([C++])
+       HAVE_QT=no
+       HAVE_QT_INC=no
+       CPPFLAGS="-I$qt/include/QtGui -I$qt/include/QtCore -I$qt/include/Qt -I$qt/include $CPPFLAGS"
+       AC_CHECK_HEADER( [Qt/qpixmap.h], [HAVE_QT_INC=yes], [HAVE_QT_INC=no] )
+       if test ! -d $qt; then
+          DISABLE_QT_REASON="($qt directory is not exists)"
+          AC_MSG_ERROR([$qt directory is not exists])
+       elif test "x$HAVE_QT_INC" = "xyes"; then
+          CSF_QT_INCLUDES="-I$qt/include/QtGui -I$qt/include/QtCore -I$qt/include/Qt -I$qt/include"
+          HAVE_QT_LIB=yes
+          AC_MSG_CHECKING([for connect in -lQtGui])
+          LDFLAGS="-L$qt/lib $LDFLAGS"
+          LIBS="$CSF_OpenGlLibs_LIB $LIBS"
+          AC_CHECK_LIB( [QtGui], [connect],
+           [
+               CSF_QT_LIB="-L$qt/lib -lQtGui -lQtCore"
+               CSF_OPT_INC="$qt/include/QtGui:$qt/include/QtCore:$qt/include/Qt:$qt/include:${CSF_OPT_INC}"
+               CSF_OPT_LIB="$qt/lib:${CSF_OPT_LIB}"
+               HAVE_QT_LIB=yes
+          ],
+          [
+               HAVE_QT_LIB=no
+          ])
+       fi
+       if test "xyes" = "x$HAVE_QT_LIB"; then
+           HAVE_QT=yes
+       else
+           HAVE_QT=no
+            DISABLE_QT_REASON="(qt was not found)"
+       fi
+  fi
+fi
+AM_CONDITIONAL( HAVE_QT, [test "xyes" = "x$HAVE_QT"] )
+
+AC_LANG([C])
+
+CFLAGS="$CFLAGS_save"
+CXXFLAGS="$CXXFLAGS_save"
+CPPFLAGS="$CPPFLAGS_save"
+LDFLAGS="$LDFLAGS_save"
+LIBS="$LIBS_save"
+
+AC_ARG_ENABLE([debug],
+              [AC_HELP_STRING([--enable-debug],[Debug Symbols])],
+              [enable_debug=${enableval}],[enable_debug=no])
+AC_ARG_ENABLE([production],
+              [AC_HELP_STRING([--enable-production],[Optimized build (default)])],
+              [enable_prod=${enableval}],[enable_prod=])
+
+# Enable production unless enable-default was specified
+if test "x$enable_prod" = "x"; then
+  if test "x$enable_debug" != "xyes"; then
+    enable_prod=yes
+  fi
+fi
+
+if test "x$enable_prod" = "xyes"; then
+  CFLAGS="$CFLAGS -O2"
+  CXXFLAGS="$CXXFLAGS -O2"
+fi
+if test "x$enable_debug" = "xyes"; then
+  CFLAGS="$CFLAGS -g"
+  CXXFLAGS="$CXXFLAGS -g"
+  CPPFLAGS="$CPPFLAGS -DDEB -D_DEBUG"
+else
+  CPPFLAGS="$CPPFLAGS -DNDEBUG  -DNo_Exception"
+fi
+
+#----------------------------------------------------------------------
+#
+# Enalbe/Disable Modules
+#
+#----------------------------------------------------------------------
+__ENABLEMODULES__
+# Process options from above.  The behavior we want is:
+#
+# ENABLE_X = yes : User specified --enable-x 
+#                  print informative error and exit if it cannot be built
+#
+# ENABLE_X = no :  User specified --disable-x (or --enable-x=no)
+#                  silently disable building of component
+#
+# ENABLE_X =     : User didn't specify either way
+#                  Build if possible.  Warn if it cannot be build
+#                  because of some missing system requirement.  Inform
+#                  if disabled because some other required component 
+#                  was disabled.
+__CONFMODULES__
+# Convert to automake conditional values
+__CONDMODULES__
+#----------------------------------------------------------------------
+#
+# Write Output Files
+#
+#----------------------------------------------------------------------
+
+
+AC_SUBST(CPPFLAGS)
+CXXCPPFLAGS="$CPPFLAGS"
+AC_SUBST(CXXCPPFLAGS)
+AC_SUBST(CFLAGS)
+AC_SUBST(CXXFLAGS)
+AC_SUBST(LIBS)
+AC_SUBST(LDFLAGS)
+
+
+CSF_XwLibs_LIB="$X_LIBS"
+CSF_MotifLibs_LIB="$X_LIBS"
+
+AC_SUBST(CSF_SOCKETLibs_LIB)
+AC_SUBST(CSF_FPELibs_LIB)
+AC_SUBST(CSF_OpenGlLibs_INCLUDES)
+AC_SUBST(CSF_OpenGlLibs_LIB)
+AC_SUBST(HAVE_FREETYPE)
+AC_SUBST(CSF_FREETYPE_INCLUDES)
+AC_SUBST(CSF_FREETYPE_LIB)
+AC_SUBST(HAVE_FTGL)
+AC_SUBST(CSF_FTGL_INCLUDES)
+AC_SUBST(CSF_FTGL_LIB)
+AC_SUBST(HAVE_GL2PS)
+AC_SUBST(CSF_GL2PS_INCLUDES)
+AC_SUBST(CSF_GL2PS_LIB)
+AC_SUBST(HAVE_FREEIMAGE)
+AC_SUBST(CSF_FreeImagePlus_INCLUDES)
+AC_SUBST(CSF_FreeImagePlus_LIB)
+AC_SUBST(CSF_advapi32_LIB)
+AC_SUBST(CSF_gdi32_LIB)
+AC_SUBST(CSF_user32_LIB)
+AC_SUBST(CSF_wsock32_LIB)
+AC_SUBST(CSF_XwLibs_LIB)
+AC_SUBST(CSF_MotifLibs_LIB)
+AC_SUBST(CSF_XmuLibs_LIB)
+AC_SUBST(CSF_XmuLibs_INCLUDES)
+AC_SUBST(HAVE_TBB)
+AC_SUBST(CSF_TBB_INCLUDES)
+AC_SUBST(CSF_TBB_LIB)
+AC_SUBST(HAVE_QT)
+AC_SUBST(CSF_QT_INCLUDES)
+AC_SUBST(CSF_QT_LIB)
+
+AC_SUBST(CSF_OPT_INC)
+AC_SUBST(CSF_OPT_LIB)
+AC_SUBST(CSF_OPT_BIN)
+
+echo
+echo "CC       = $CC"
+echo "CXX      = $CXX"
+echo "CFLAGS   = $CFLAGS"
+echo "CXXFLAGS = $CXXFLAGS"
+echo "CPPFLAGS = $CPPFLAGS"
+echo "LDFLAGS  = $LDFLAGS"
+echo 
+echo "3rdparty mandatory products       "
+echo "---------------------------------"
+echo "freetype      : $HAVE_FREETYPE $DISABLE_FREETYPE_REASON"
+echo "ftgl          : $HAVE_FTGL $DISABLE_FTGL_REASON"
+echo "tcltk         : $HAVE_TCLTK $DISABLE_TCLTK_REASON"
+echo
+echo "3rdparty optional products       "
+echo "---------------------------------"
+echo "gl2ps         : $HAVE_GL2PS $DISABLE_GL2PS_REASON"
+echo "freeimage     : $HAVE_FREEIMAGE $DISABLE_FREEIMAGE_REASON"
+echo "tbb includes  : $HAVE_TBB_INC $DISABLE_TBB_REASON_INC"
+echo "tbb libraries : $HAVE_TBB $DISABLE_TBB_REASON_LIB"
+echo "qt            : $HAVE_QT $DISABLE_QT_REASON"
+echo
+echo "Component                   Build"
+echo "--------------------------  -----"
+__REPMODULES__
+echo
+
+AC_OUTPUT([Makefile adm/lin/amk/Makefile custom.sh \
+__ACCONFMODULES__])
diff --git a/src/WOKTclLib/templates/template.mam b/src/WOKTclLib/templates/template.mam
new file mode 100644 (file)
index 0000000..9ad668b
--- /dev/null
@@ -0,0 +1,21 @@
+# Makefile.am for Open Cascade toolkit __TKNAM__
+srcdir = @srcdir@
+
+VPATH = @srcdir@ : \
+__VPATH__
+
+AM_CXXFLAGS = __CXXFLAG__
+
+AM_CFLAGS = __CFLAG__
+
+INCLUDES = $(CSF_OPT_INCLUDES) __EXTERNINC__ \
+-I@top_srcdir@/inc \
+__INCLUDES__
+
+lib_LTLIBRARIES=lib__TKNAM__.la
+
+lib__TKNAM___la_LIBADD = $(CSF_OPT_LIBS) \
+__LIBADD____EXTERNLIB__
+
+lib__TKNAM___la_SOURCES = \
+__SOURCES__
diff --git a/src/WOKTclLib/templates/template.mamx b/src/WOKTclLib/templates/template.mamx
new file mode 100644 (file)
index 0000000..da81a60
--- /dev/null
@@ -0,0 +1,10 @@
+# Makefile.am for executable __XQTNAM__
+srcdir = @srcdir@
+
+VPATH = @srcdir@ : \
+@top_srcdir@/src/__XQTNAM__
+
+INCLUDES = $(CSF_OPT_INCLUDES) __EXTERNINC__ \
+-I@top_srcdir@/inc \
+-I@top_srcdir@/src/__XQTNAM__
+