root/tags/mcxtrace_beta/configure.in

Revision 2728, 10.1 KB (checked in by erkn, 2 years ago)

merged branch farhi_configure_100204 into trunk after testing

Line 
1#
2#   This file is part of the McStas/McXtrace @MCCODE_STRING@ neutron ray-trace simulation package
3#   Copyright (C) 1997-2010, 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.
21AC_INIT(@MCCODE_NAME@, @MCCODE_VERSION@, @MCCODE_TARNAME@-support@@MCCODE_TARNAME@.org)
22AC_REVISION($Revision: 1.1$)
23AC_COPYRIGHT([Copyright (C) Copyright, All rights reserved
24Risoe National Laborartory, Roskilde, Denmark
25Institut Laue Langevin, Grenoble, France
26This software is covered by the GNU LESSER GENERAL PUBLIC LICENSE
27see file COPYING for further information])
28
29# set default package defines
30MCCODE_TARNAME=$PACKAGE_TARNAME
31MCCODE_NAME=$PACKAGE_NAME
32MCCODE_VERSION=$PACKAGE_VERSION
33MCCODE_STRING=$PACKAGE_STRING
34MCCODE_BUGREPORT=$PACKAGE_BUGREPORT
35MCCODE_DATE="@MCCODE_DATE@"
36
37AC_PREFIX_DEFAULT(/usr/local)
38test "x$prefix" = xNONE && prefix=$ac_default_prefix
39
40AC_ARG_WITH([cc], AC_HELP_STRING([--with-cc=c compiler], [Specify name of C compiler]),
41        [with_cc=$withval], [with_cc=yes])
42if test x"$with_cc" != x"no" ; then
43        if test x"$with_cc" != x"yes" ; then CC="$with_cc"; fi
44        AC_PROG_CC
45else
46        AC_MSG_ERROR([You need a C compiler to compile this package])
47fi
48
49# Have the user select wich version they want to build.
50AC_ARG_ENABLE([mcstas], AC_HELP_STRING([--enable-mcstas], [Enable building McStas binaries.]))
51AC_ARG_ENABLE([mcxtrace], AC_HELP_STRING([--enable-mcxtrace], [Enable building McXtrace binaries.]))
52
53# optional target change (mcstas -> mcxtrace or vice versa)
54if test x"$enable_mcstas" == "xyes" -a x"$enable_mcxtrace" == "xyes" ; then
55  echo "ERROR: It is currently not possible to build both mcstas and mcxtrace."
56  exit 1
57elif test x"$enable_mcstas" == "xyes" ; then
58  MCCODE_TARNAME=[mcstas]
59  MCCODE_NAME=McStas
60elif test x"$enable_mcxtrace" == "xyes" ; then
61  MCCODE_TARNAME=[mcxtrace]
62  MCCODE_NAME=McXtrace
63fi
64
65# check if VERSION is defined (in principle, done in mkdist)
66if test x"$enable_mcstas" == "xyes" -o x"$enable_mcxtrace" == "xyes" ; then
67  MONTH=`date +"%b"`
68  DAY=`date +"%d"`
69  YEAR=`date +"%Y"`
70  MCCODE_DATE="$MONTH. $DAY, $YEAR"
71  MCCODE_VERSION="$MONTH-$DAY-$YEAR"
72  MCCODE_STRING="$MCCODE_NAME $MCCODE_VERSION - $MONTH. $DAY, $YEAR"
73  MCCODE_BUGREPORT="$MCCODE_TARNAME-support@$MCCODE_TARNAME.org"
74 
75  echo "Configurating McCode with $MCCODE_NAME flavour"
76  echo "MCCODE_DATE=$MCCODE_DATE"
77  echo "MCCODE_TARNAME=$MCCODE_TARNAME"
78  echo "MCCODE_NAME=$MCCODE_NAME"
79  echo "MCCODE_VERSION=$MCCODE_VERSION"
80  echo "MCCODE_STRING=$MCCODE_STRING"
81  echo "MCCODE_BUGREPORT=$MCCODE_BUGREPORT"
82
83fi
84# update corresponding DEFINE string in all makefiles
85AC_DEFINE_UNQUOTED([MCCODE_DATE], "${MCCODE_DATE}")
86AC_DEFINE_UNQUOTED([MCCODE_TARNAME], "${MCCODE_TARNAME}")
87AC_DEFINE_UNQUOTED([MCCODE_NAME], "${MCCODE_NAME}")
88AC_DEFINE_UNQUOTED([MCCODE_VERSION], "${MCCODE_VERSION}")
89AC_DEFINE_UNQUOTED([MCCODE_STRING], "${MCCODE_STRING}")
90AC_DEFINE_UNQUOTED([MCCODE_BUGREPORT], "${MCCODE_BUGREPORT}")
91# activate substitution in all .in files
92AC_SUBST([MCCODE_DATE])
93AC_SUBST([MCCODE_TARNAME])
94AC_SUBST([MCCODE_NAME])
95AC_SUBST([MCCODE_VERSION])
96AC_SUBST([MCCODE_STRING])
97AC_SUBST([MCCODE_BUGREPORT])
98
99AC_PROG_INSTALL
100CF_ANSI_CC_CHECK
101MC_ANSI_MATH_PROTO
102AC_FUNC_MALLOC
103AC_FUNC_REALLOC
104AC_FUNC_STRTOD
105AC_CHECK_FUNCS(strcasecmp fdopen qsort strcasestr)
106
107AC_PATH_PROGS(PERL,   [perl perl5], no, /usr/bin:/usr/local/bin:$PATH)
108AC_PATH_PROGS(SCILAB, [scilab runscilab scilex], no, /usr/local/bin:/usr/lib/scilab/bin:/lib/scilab/bin:$PATH)
109AC_PATH_PROGS(MATLAB, [matlab], no, /usr/local/bin:$PATH)
110AC_PATH_PROGS(GNUPLOT,[gnuplot /usr/local/bin/gnuplot], no, /usr/local/bin:$PATH)
111AC_PATH_PROGS(PGPLOT, [pgxwin_server], no, /usr/local/bin:/usr/local/pgplot:$PATH)
112AC_PATH_PROGS(TCLTK,  [wish tclsh], no, /usr/local/bin:$PATH)
113AC_PATH_PROGS(SSH,    [ssh plink], no, /usr/local/bin:$PATH)
114AC_PATH_PROGS(SCP,    [scp pscp], no, /usr/local/bin:$PATH)
115AC_PATH_PROGS(DASH,   [dash], no, /bin:/usr/bin:/usr/local/bin:$PATH)
116AC_PATH_PROGS(MPIRUN, [mpirun], no, /usr/local/bin:$PATH)
117AC_PATH_PROGS(MPICC,  [mpicc hcc mpxlc_r mpxlc mpcc cmpicc], no, /usr/local/bin:$PATH)
118AC_PATH_PROGS(BROWSER,[gnome-open firefox mozilla-firefox mozilla konqueror epiphany galeon netscape Safari], no,  /Applications/Safari.app/Contents/MacOS:/Applications/Firefox.app/Contents/MacOS:/usr/local/bin:$PATH)
119AC_PATH_PROGS(EDITOR, [gedit nedit kate xemacs gnome-open xedit vim notepad wordpad], no)
120AC_PATH_PROGS(VRMLVIEW, [octagaplayer freewrl gtklookat qtlookat xmlookat maclookat fltklookat lookat], no)
121AC_PATH_PROGS(PERLDL,   [perldl], no, /usr/bin:/usr/local/bin:$PATH)
122AC_PATH_PROGS(G77, [g77 f77 gfortran g95 f95], no)
123AC_PATH_PROGS(MINGW, [i586-mingw32msvc-gcc], no)
124AC_PATH_PROGS(MAKE,   [make gmake], no)
125AC_PATH_PROGS(AT,  [at], no)
126AC_PATH_PROGS(HDFVIEW,  [hdfview], no, /usr/local/bin:/usr/local/hdfview:$PATH)
127AC_PATH_PROGS(FLEX,   [flex], flex, /bin:/usr/bin:/usr/local/bin:$PATH)
128AC_PATH_PROGS(BISON,   [bison], bison, /bin:/usr/bin:/usr/local/bin:$PATH)
129# Important here: gnome-terminal is broken:
130#  Any commandline arguments after -e must contain escaped spaces.
131# BUT: If escaped in the perl code, use of xterm/konsole is broken....
132# Hence we allow only gnome-terminal.wrapper which is debian only
133# :(
134AC_PATH_PROGS(TERMINAL,   [xterm konsole gnome-terminal.wrapper], no)
135
136# handle PIC options
137AC_ARG_WITH([pic],
138  [AS_HELP_STRING([--with-pic],
139     [enable support for PIC libraries (required to compile PGPLOT on some systems)])],
140  [USE_PIC=$withval],
141  [USE_PIC=no])
142AC_SUBST(USE_PIC)
143
144
145# check for MPI
146if test "$MPICC" != "no"; then
147  AC_CHECK_HEADER(mpi.h, , [ echo "WARNING: $MPICC may fail to compile without mpi.h" ] )
148fi
149
150# check for NeXus libraries
151AC_ARG_WITH([nexus],
152  [AS_HELP_STRING([--with-nexus],
153     [enable support for NeXus/HDF libraries])])
154if test "${with_nexus+set}" = set; then
155  AC_SUBST([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus "])
156  AC_DEFINE([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus "])
157else
158  AC_SUBST([HAVE_NEXUS], [])
159  AC_DEFINE([HAVE_NEXUS], [])
160fi
161
162AC_OUTPUT(Makefile src/Makefile src/port.h lib/Makefile nlib/Makefile xlib/Makefile lib/tools/perl/mccode_config.perl lib/tools/perl/mccode_reconfigure support/common/Makefile support/common/pgplot/Makefile support/common/pgplot/makehtml support/common/pgplot/maketex src/mccode.h lib/share/mccode-r.h src/mcformat.c doc/man/*.1 support/deb/debcreate support/deb/control support/Win32/install/mcstas.nsi build.bat)
163
164chmod a+x lib/tools/perl/${MCCODE_TARNAME}_reconfigure
165
166# warnings and errors
167if test "$USE_PIC" != "no" ; then
168echo "Activating PIC compilation for: make install-pgplot"
169fi
170if test "x$HAVE_NEXUS" != "x" ; then
171echo "Activating NeXus support in $MCCODE_STRING ($HAVE_NEXUS)"
172fi
173if test "$MAKE" == "no" ; then
174  echo "ERROR: $MCCODE_STRING installation requires 'make' or 'gmake'"
175  exit
176fi
177
178if test "$PERL" = "no" ; then
179  echo "WARNING: No Perl executable could be found !"
180  echo "The commands mcrun and mcgui won't be available. You will have to use:"
181  echo "   $MCCODE_TARNAME <file>.instr"
182  echo "   $CC -o <file>.out <file>.instr -lm"
183  echo "   <file>.out [simulation parameters]"
184fi
185if test "$TCLTK" = "no" ; then
186  echo "WARNING: No Tcl/Tk installation could be found !"
187  echo "You might not be able to use McGUI interface"
188fi
189if test "$BROWSER" = "no" ; then
190  echo "WARNING: No HTML browser could be found !"
191fi
192if test "$SCILAB" == "no" && test "$MATLAB" == "no" && test "$PGPLOT" == "no" && test "$VRMLVIEW" == "no" ; then
193  echo "WARNING: No Plotter (Matlab, Scilab, PGPLOT, VRML) could be found !"
194fi
195
196# final message at end of configure
197echo ""
198if test "$PGPLOT" == "no" ; then
199  echo "To install PGPLOT for $MCCODE_STRING, you need:"
200  echo "= perl-PDL (perldl, pdl)"
201  echo "= a fortran compiler (g77, gfortran)"
202  echo "= X11-dev libraries/includes (libx11-dev, xserver-xorg-dev, libxt-dev)"
203fi
204if test "$PGPLOT" == "no" && test "$PERLDL" != "no" && test "$G77" != "no" ; then
205  echo "PGPLOT install: you may try our automatic pgplot5 installation AFTER installing @MCCODE_STRING@"
206  echo "# make install-pgplot"
207  echo "# make reconfigure"
208  echo "(For 64-bit machines, reconfigure first: # ./configure --with-pic )"
209else if test "$PGPLOT" == "no" ; then
210  echo "To use PGPLOT, install these packages and re-run $MCCODE_STRING installation ./configure"
211  fi
212fi
213if test "$SCILAB" == "no" && test "$WGET" != no ; then
214  echo "Scilab install: you may try our automatic Scilab installation with"
215  echo ""
216  echo "# make install-scilab; ./configure; make; make install"
217  echo ""
218  echo "(requires Linux/Intel, wget and root priviliges)"
219fi
220echo ""
221echo "To setup the plotting environment, execute either"
222echo "# make config (automatically selects plotter, "
223echo "       prefers PGPLOT before Matlab before Scilab before VRML)"
224if test "$SCILAB" != "no" ; then
225echo "# make scilab (selects scilab)"
226fi
227if test "$MATLAB" != "no" ; then
228echo "# make matlab (selects matlab)"
229fi
230if test "$PGPLOT" != "no" ; then
231echo "# make pgplot (selects pgplot and installs perl-PGPLOT)"
232fi
233if test "$VRMLVIEW" != "no" ; then
234echo "# make vrml   (selects vrml)"
235fi
236echo ""
237echo "After (optional) plotter config, build and install $MCCODE_STRING by executing"
238echo "# make; make install"
239echo "will install $MCCODE_STRING into $prefix"
240echo ""
241if test "$DASH" != "no" ; then
242echo
243echo WARNING: Your system includes the $DASH shell which is known to cause problems.
244echo "On Debian/Ubuntu systems, please dpkg-reconfigure dash and say 'no' to install dash as /bin/sh"
245fi
246
Note: See TracBrowser for help on using the browser.