root/branches/mcstas-1.x/configure.in

Revision 3077, 9.5 KB (checked in by pkwi, 12 months ago)

Working toward new release...

Line 
1#
2#   This file is part of the McStas neutron ray-trace simulation package
3#   Copyright (C) 1997-2008, All rights reserved
4#   Risoe National Laborartory, Roskilde, Denmark
5#   Institut Laue Langevin, Grenoble, France
6#
7#   This program is free software; you can redistribute it and/or modify
8#   it under the terms of the GNU General Public License as published by
9#   the Free Software Foundation; version 2 of the License.
10#
11#   This program is distributed in the hope that it will be useful,
12#   but WITHOUT ANY WARRANTY; without even the implied warranty of
13#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#   GNU General Public License for more details.
15#
16#   You should have received a copy of the GNU General Public License
17#   along with this program; if not, write to the Free Software
18#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19#
20dnl Process this file with autoconf to produce a configure script.
21
22AC_INIT(McStas, 1.12c, www.mcstas.org)
23AC_REVISION($Revision: 1.58 $)
24AC_COPYRIGHT([Copyright (C) 1997-2011  Copyright (C) 1997-2011, All rights reserved
25Risoe National Laborartory, Roskilde, Denmark
26Institut Laue Langevin, Grenoble, France
27This software is covered by the GNU LESSER GENERAL PUBLIC LICENSE
28see file COPYING for further information])
29
30AC_ARG_WITH([cc], AC_HELP_STRING([--with-cc=c compiler], [Specify name of C compiler]),
31        [with_cc=$withval], [with_cc=yes])
32if test x"$with_cc" != x"no" ; then
33        if test x"$with_cc" != x"yes" ; then CC="$with_cc"; fi
34        AC_PROG_CC
35else
36        AC_MSG_ERROR([You need a C compiler to compile this package])
37fi
38
39AC_PROG_INSTALL
40CF_ANSI_CC_CHECK
41MC_ANSI_MATH_PROTO
42AC_FUNC_MALLOC
43AC_FUNC_REALLOC
44AC_FUNC_STRTOD
45AC_CHECK_FUNCS(strcasecmp fdopen qsort)
46
47AC_PATH_PROGS(PERL,   [perl5 perl /usr/bin/perl /usr/local/bin/perl], no)
48AC_PATH_PROGS(SCILAB, [scilab runscilab /usr/local/bin/scilab /usr/lib/scilab/bin/scilab /lib/scilab/bin/scilab scilex], no)
49AC_PATH_PROGS(MATLAB, [matlab /usr/local/bin/matlab], no)
50AC_PATH_PROGS(GNUPLOT, [gnuplot /usr/local/bin/gnuplot], no)
51AC_PATH_PROGS(PGPLOT, [pgxwin_server /usr/local/bin/pgxwin_server /usr/local/pgplot/pgxwin_server], no)
52AC_PATH_PROGS(TCLTK,  [wish /usr/local/bin/wish tclsh], no)
53AC_PATH_PROGS(SSH,    [ssh plink /usr/local/bin/ssh], no)
54AC_PATH_PROGS(SCP,    [scp pscp /usr/local/bin/scp], no)
55AC_PATH_PROGS(DASH,   [dash /bin/dash /usr/bin/dash], no)
56AC_PATH_PROGS(MPIRUN, [mpirun /usr/local/bin/mpirun], no)
57AC_PATH_PROGS(MPICC,  [mpicc hcc mpxlc_r mpxlc mpcc cmpicc /usr/local/bin/mpicc], no)
58AC_PATH_PROGS(BROWSER,[konqueror firefox mozilla-firefox mozilla netscape gnome-open epiphany galeon start msie /Applications/Safari.app/Contents/MacOS/Safari /Applications/Firefox.app/Contents/MacOS/firefox], no)
59AC_PATH_PROGS(EDITOR, [nedit kate gedit xemacs xedit vim notepad wordpad], no)
60AC_PATH_PROGS(VRMLVIEW, [octagaplayer freewrl gtklookat qtlookat xmlookat maclookat fltklookat lookat], no)
61AC_PATH_PROGS(WGET, [wget], no)
62AC_PATH_PROGS(PERLDL,   [perldl /usr/local/bin/perldl /usr/bin/perldl], no)
63AC_PATH_PROGS(G77, [g77 f77 gfortran g95 f95], no)
64AC_PATH_PROGS(MINGW, [i586-mingw32msvc-gcc], no)
65AC_PATH_PROGS(MAKE,   [make gmake], no)
66AC_PATH_PROGS(AT,  [at], no)
67AC_PATH_PROGS(HDFVIEW,  [hdfview /usr/local/bin/hdfview /usr/local/hdfview/hdfview], no)
68# Important here: gnome-terminal is broken:
69#  Any commandline arguments after -e must contain escaped spaces.
70# BUT: If escaped in the perl code, use of xterm/konsole is broken....
71# Hence we allow only gnome-terminal.wrapper which is debian only
72# :(
73AC_PATH_PROGS(TERMINAL,   [xterm konsole gnome-terminal.wrapper], no)
74
75# handle PIC options
76AC_ARG_WITH([pic],
77  [AS_HELP_STRING([--with-pic],
78     [enable support for PIC libraries (required to compile PGPLOT on some systems)])],
79  [USE_PIC=$withval],
80  [USE_PIC=no])
81AC_SUBST(USE_PIC)
82
83# check for OpenMP threads and option to use at compile
84AC_CHECK_HEADER(omp.h, [ HAVE_THREADS=yes ])
85if test "$HAVE_THREADS" = yes; then
86  # test flag to use for compilation
87  AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
88  ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown
89  # Flags to try:  -fopenmp (gcc), -openmp (icc), -mp (SGI & PGI),
90  #                -xopenmp (Sun), -omp (Tru64), -qsmp=omp (AIX), none
91  ax_openmp_flags="-fopenmp -openmp -mp -xopenmp -omp -qsmp=omp none"
92  if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then
93    ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags"
94  fi
95  for ax_openmp_flag  dnl will test flags to pass to compiler
96  in "-fopenmp -lgomp"                                                          dnl gcc 4.2 with explicit libgomp
97  "-fopenmp "                                                                                     dnl gcc 4.2
98  "-openmp -parallel"                                                             dnl icc with explicit parallel flag
99  "-openmp "                                                                                                    dnl icc
100  "-mp"                                                                                                                         dnl pgi
101  "-xopenmp"                                                                                                    dnl Sun
102  "-omp"                                                                                                                        dnl Tru64
103  "-qsmp=omp"                                                                                           dnl     AIX
104  "none"                                                                                                                        dnl no openmp
105  "$OPENMP_[]_AC_LANG_PREFIX[]FLAGS"  dnl flags defined by user
106  #
107  do
108    case $ax_openmp_flag in
109      none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;;
110      *) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;;
111    esac
112    AC_TRY_LINK_FUNC(omp_set_num_threads,
113          [ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break])
114  done
115  []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS
116  ]) # end AC_CACHE_CHECK
117  if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then
118    OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp
119  fi
120  # now set DEFINE for mcstas_config
121  AC_SUBST([HAVE_THREADS], ["-DUSE_THREADS $OPENMP_CFLAGS "])
122  AC_DEFINE([HAVE_THREADS], ["-DUSE_THREADS $OPENMP_CFLAGS "])
123else
124  AC_SUBST([HAVE_THREADS], [])
125  AC_DEFINE([HAVE_THREADS], [])
126fi
127
128# check for MPI
129if test "$MPICC" != "no"; then
130  AC_CHECK_HEADER(mpi.h, , [ echo "WARNING: $MPICC may fail to compile without mpi.h" ] )
131fi
132
133# check for NeXus libraries
134AC_ARG_WITH([nexus],
135  [AS_HELP_STRING([--with-nexus],
136     [enable support for NeXus/HDF libraries])])
137if test "${with_nexus+set}" = set; then
138  AC_SUBST([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus "])
139  AC_DEFINE([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus "])
140else
141  AC_SUBST([HAVE_NEXUS], [])
142  AC_DEFINE([HAVE_NEXUS], [])
143fi
144
145AC_OUTPUT(Makefile lib/tools/perl/mcstas_config.perl support/pgplot/pgplot.sh support/scilab/scilab.sh)
146
147chmod a+x support/pgplot/pgplot.sh
148chmod a+x support/scilab/scilab.sh
149chmod a+x lib/tools/perl/mcstas_reconfigure
150
151# warnings and errors
152if test "$MAKE" == "no" ; then
153  echo "ERROR: McStas installation requires 'make' or 'gmake'"
154  exit
155fi
156
157if test "$PERL" = "no" ; then
158  echo "WARNING: No Perl executable could be found !"
159  echo "You will have to use"
160  echo "   mcstas <file>.instr"
161  echo "   $CC -o <file>.out <file>.instr -lm"
162  echo "   <file>.out [simulation parameters]"
163fi
164if test "$TCLTK" = "no" ; then
165  echo "WARNING: No Tcl/Tk installation could be found !"
166  echo "You might not be able to use McGUI interface"
167fi
168if test "$BROWSER" = "no" ; then
169  echo "WARNING: No HTML browser could be found !"
170fi
171if test "$SCILAB" == "no" && test "$MATLAB" == "no" && test "$PGPLOT" == "no" && test "$VRMLVIEW" == "no" ; then
172  echo "WARNING: No Plotter (Matlab, Scilab, PGPLOT, VRML) could be found !"
173fi
174
175# final message at end of configure
176if test "$USE_PIC" != "no" ; then
177echo "Activating PIC compilation for: make install-pgplot"
178fi
179if test "x$HAVE_NEXUS" != "x" ; then
180echo "Activating NeXus support in McStas ($HAVE_NEXUS)"
181fi
182if test "x$HAVE_THREADS" != "x" ; then
183echo "Activating OpenMP multi-threading support in McStas ($HAVE_THREADS)"
184fi
185echo ""
186if test "$WGET" != no ; then
187  echo "Gnome support: If you experience crashes of mcgui when running in the "
188  echo "  Gnome environment, please come back here and do a"
189  echo "# make tk"
190  echo "will install our patched version of perl-tk from the net"
191fi
192if test "$PGPLOT" == "no" ; then
193  echo "To install PGPLOT for McStas, you need:"
194  echo "= perl-PDL (perldl, pdl)"
195  echo "= a fortran compiler (g77, gfortran)"
196  echo "= X11-dev libraries/includes (libx11-dev, xserver-xorg-dev, libxt-dev)"
197fi
198if test "$PGPLOT" == "no" && test "$PERLDL" != "no" && test "$G77" != "no" ; then
199  echo "PGPLOT install: you may try our automatic PGPLOT installation with"
200  echo "# make install-pgplot; ./configure; make; make install"
201  echo "(For 64-bit machines, reconfigure first: # ./configure --with-pic )"
202else if test "$PGPLOT" == "no" ; then
203  echo "Install these and re-run McStas installation ./configure"
204  fi
205fi
206if test "$SCILAB" == "no" ; then
207  echo "Scilab install: you may try our automatic Scilab installation with"
208  echo ""
209  echo "# make install-scilab; ./configure; make; make install"
210  echo ""
211  echo "(requires Linux/Intel, wget and root priviliges)"
212fi
213echo ""
214echo "To setup the plotting environment, execute either"
215echo "# make config (automatically selects plotter, "
216echo "       prefers PGPLOT before Matlab before Scilab before VRML)"
217if test "$SCILAB" != "no" ; then
218echo "# make scilab (selects scilab)"
219fi
220if test "$MATLAB" != "no" ; then
221echo "# make matlab (selects matlab)"
222fi
223if test "$PGPLOT" != "no" ; then
224echo "# make pgplot (selects pgplot)"
225fi
226if test "$VRMLVIEW" != "no" ; then
227echo "# make vrml   (selects vrml)"
228fi
229echo ""
230echo "After (optional) plotter config, build and install McStas by executing"
231echo "# make; make install"
232echo ""
233if test "$DASH" != "no" ; then
234echo
235echo WARNING: Your system includes the $DASH shell which is known to cause problems.
236echo On Debian/Ubuntu systems, please dpkg-reconfigure dash and say 'no' to install dash as /bin/sh
237fi
Note: See TracBrowser for help on using the browser.