root/trunk/configure.in

Revision 2995, 11.5 KB (checked in by pkwi, 19 months ago)

Edits to allows builds of i386 and amd64 mcxtrace packages. Removal seems to need a few more fixes.

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
85# determine particule to use: n or X and name of the env variable for location of library
86if test P"$MCCODE_TARNAME" = "Pmcstas" ; then
87  MCCODE_PARTICULE=neutron
88  MCCODE_PROJECT=1
89  MCCODE_LIBENV=[MCSTAS]
90  MCCODE_PREFIX=mc
91else
92  MCCODE_PARTICULE=Xray
93  MCCODE_PROJECT=2
94  MCCODE_LIBENV=[MCXTRACE]
95  MCCODE_PREFIX=mx
96fi
97
98if test x"$enable_mcstas" = "xyes" -o x"$enable_mcxtrace" = "xyes" ; then
99  echo "MCCODE_PARTICULE=$MCCODE_PARTICULE"
100  echo "MCCODE_PROJECT  =$MCCODE_PROJECT"
101  echo "MCCODE_LIBENV   =$MCCODE_LIBENV"
102  echo "MCCODE_PREFIX   =$MCCODE_PREFIX"
103fi
104
105# update corresponding DEFINE string in all makefiles
106AC_DEFINE_UNQUOTED([MCCODE_DATE], "${MCCODE_DATE}")
107AC_DEFINE_UNQUOTED([MCCODE_TARNAME], "${MCCODE_TARNAME}")
108AC_DEFINE_UNQUOTED([MCCODE_NAME], "${MCCODE_NAME}")
109AC_DEFINE_UNQUOTED([MCCODE_VERSION], "${MCCODE_VERSION}")
110AC_DEFINE_UNQUOTED([MCCODE_STRING], "${MCCODE_STRING}")
111AC_DEFINE_UNQUOTED([MCCODE_BUGREPORT], "${MCCODE_BUGREPORT}")
112AC_DEFINE_UNQUOTED([MCCODE_PARTICULE],[$MCCODE_PARTICULE])
113AC_DEFINE_UNQUOTED([MCCODE_LIBENV],[$MCCODE_LIBENV])
114AC_DEFINE_UNQUOTED([MCCODE_PROJECT],[$MCCODE_PROJECT])
115AC_DEFINE_UNQUOTED([MCCODE_PREFIX],[$MCCODE_PREFIX])
116
117# activate substitution in all .in files
118AC_SUBST([MCCODE_DATE])
119AC_SUBST([MCCODE_TARNAME])
120AC_SUBST([MCCODE_NAME])
121AC_SUBST([MCCODE_VERSION])
122AC_SUBST([MCCODE_STRING])
123AC_SUBST([MCCODE_BUGREPORT])
124AC_SUBST([MCCODE_PARTICULE])
125AC_SUBST([MCCODE_LIBENV])
126AC_SUBST([MCCODE_PROJECT])
127AC_SUBST([MCCODE_PREFIX])
128
129AC_PROG_INSTALL
130CF_ANSI_CC_CHECK
131MC_ANSI_MATH_PROTO
132AC_FUNC_MALLOC
133AC_FUNC_REALLOC
134AC_FUNC_STRTOD
135AC_CHECK_FUNCS(strcasecmp fdopen qsort strcasestr)
136
137AC_PATH_PROGS(PERL,   [perl perl5], no, /usr/bin:/usr/local/bin:$PATH)
138AC_PATH_PROGS(SCILAB, [scilab runscilab scilex], no, /usr/local/bin:/usr/lib/scilab/bin:/lib/scilab/bin:$PATH)
139AC_PATH_PROGS(MATLAB, [matlab], no, /usr/local/bin:$PATH)
140AC_PATH_PROGS(GNUPLOT,[gnuplot /usr/local/bin/gnuplot], no, /usr/local/bin:$PATH)
141AC_PATH_PROGS(PGPLOT, [pgxwin_server], no, /usr/local/bin:/usr/local/pgplot:$PATH)
142AC_PATH_PROGS(TCLTK,  [wish tclsh], no, /usr/local/bin:$PATH)
143AC_PATH_PROGS(SSH,    [ssh plink], no, /usr/local/bin:$PATH)
144AC_PATH_PROGS(SCP,    [scp pscp], no, /usr/local/bin:$PATH)
145AC_PATH_PROGS(DASH,   [dash], no, /bin:/usr/bin:/usr/local/bin:$PATH)
146AC_PATH_PROGS(MPIRUN, [mpirun], no, /usr/local/bin:$PATH)
147AC_PATH_PROGS(MPICC,  [mpicc hcc mpxlc_r mpxlc mpcc cmpicc], no, /usr/local/bin:$PATH)
148AC_PATH_PROGS(BROWSER,[gnome-open firefox mozilla-firefox mozilla konqueror epiphany galeon netscape open], no,  /Applications/Safari.app/Contents/MacOS:/Applications/Firefox.app/Contents/MacOS:/usr/local/bin:$PATH)
149AC_PATH_PROGS(EDITOR, [gedit nedit kate xemacs gnome-open xedit vim notepad wordpad open], no)
150AC_PATH_PROGS(VRMLVIEW, [octagaplayer freewrl gtklookat qtlookat xmlookat maclookat fltklookat lookat], no)
151AC_PATH_PROGS(PERLDL,   [perldl], no, /usr/bin:/usr/local/bin:$PATH)
152AC_PATH_PROGS(G77, [g77 f77 gfortran g95 f95], no)
153AC_PATH_PROGS(MINGW, [i586-mingw32msvc-gcc], no)
154AC_PATH_PROGS(MAKE,   [make gmake], no)
155AC_PATH_PROGS(AT,  [at], no)
156AC_PATH_PROGS(HDFVIEW,  [hdfview], no, /usr/local/bin:/usr/local/hdfview:$PATH)
157AC_PATH_PROGS(FLEX,   [flex], flex, /bin:/usr/bin:/usr/local/bin:$PATH)
158AC_PATH_PROGS(BISON,   [bison], bison, /bin:/usr/bin:/usr/local/bin:$PATH)
159# Important here: gnome-terminal is broken:
160#  Any commandline arguments after -e must contain escaped spaces.
161# BUT: If escaped in the perl code, use of xterm/konsole is broken....
162# Hence we allow only gnome-terminal.wrapper which is debian only
163# :(
164AC_PATH_PROGS(TERMINAL,   [xterm konsole gnome-terminal.wrapper], no)
165
166# handle PIC options
167AC_ARG_WITH([pic],
168  [AS_HELP_STRING([--with-pic],
169     [enable support for PIC libraries (required to compile PGPLOT on some systems)])],
170  [USE_PIC=$withval],
171  [USE_PIC=no])
172AC_SUBST(USE_PIC)
173
174
175# check for MPI
176if test "$MPICC" != "no" ; then
177  AC_CHECK_HEADER(mpi.h, , [ echo "WARNING: $MPICC may fail to compile without mpi.h" ] )
178fi
179
180# check for NeXus libraries
181AC_ARG_WITH([nexus],
182  [AS_HELP_STRING([--with-nexus],
183     [enable support for NeXus/HDF libraries])])
184if test "${with_nexus+set}" = "set" ; then
185  AC_SUBST([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus "])
186  AC_DEFINE([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus "])
187else
188  AC_SUBST([HAVE_NEXUS], [])
189  AC_DEFINE([HAVE_NEXUS], [])
190fi
191
192AC_OUTPUT(Makefile src/Makefile src/port.h src/cogen.c 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/mcconvert.1 doc/man/mcdisplay.1 doc/man/mcdoc.1 doc/man/mcformat.1 doc/man/mcgui.1 doc/man/mcplot.1 doc/man/mcrun.1 doc/man/mcstas.1 doc/man/mcxtrace.1 doc/man/mxconvert.1 doc/man/mxdisplay.1 doc/man/mxdoc.1 doc/man/mxformat.1 doc/man/mxgui.1 doc/man/mxplot.1 doc/man/mxrun.1 support/deb/debcreate support/deb/postinst support/deb/control support/Win32/install/mcstas.nsi support/Win32/install/mcxtrace.nsi build.bat)
193
194chmod a+x lib/tools/perl/mccode_reconfigure
195
196# warnings and errors
197if test "$USE_PIC" != "no" ; then
198echo "Activating PIC compilation for: make install-pgplot"
199fi
200if test "x$HAVE_NEXUS" != "x" ; then
201echo "Activating NeXus support in $MCCODE_STRING ($HAVE_NEXUS)"
202fi
203if test "$MAKE" = "no" ; then
204  echo "ERROR: $MCCODE_STRING installation requires 'make' or 'gmake'"
205  exit
206fi
207
208if test "$PERL" = "no" ; then
209  echo "WARNING: No Perl executable could be found !"
210  echo "The commands mcrun and mcgui won't be available. You will have to use:"
211  echo "   $MCCODE_TARNAME <file>.instr"
212  echo "   $CC -o <file>.out <file>.instr -lm"
213  echo "   <file>.out [simulation parameters]"
214fi
215if test "$TCLTK" = "no" ; then
216  echo "WARNING: No Tcl/Tk installation could be found !"
217  echo "You might not be able to use McGUI interface"
218fi
219if test "$BROWSER" = "no" ; then
220  echo "WARNING: No HTML browser could be found !"
221fi
222if test "$SCILAB" = "no" && test "$MATLAB" = "no" && test "$PGPLOT" = "no" && test "$VRMLVIEW" = "no" ; then
223  echo "WARNING: No Plotter (Matlab, Scilab, PGPLOT, VRML) could be found !"
224fi
225
226# final message at end of configure
227echo ""
228if test "$PGPLOT" = "no" ; then
229  echo "To install PGPLOT for $MCCODE_STRING, you need:"
230  echo "  = perl-PDL (perldl, pdl)"
231  echo "  = a fortran compiler (g77, gfortran)"
232  echo "  = X11-dev libraries/includes (libx11-dev, xserver-xorg-dev, libxt-dev)"
233  echo "On Debian/Ubuntu systems, use:"
234  echo "  # sudo apt-get install libx11-dev libxt-dev gfortran pdl"
235fi
236if test "$PGPLOT" = "no" && test "$PERLDL" != "no" && test "$G77" != "no" ; then
237  echo "PGPLOT install: you may try our automatic pgplot5 installation AFTER installing @MCCODE_STRING@"
238  echo "  # make install-pgplot"
239  echo "  # make reconfigure"
240else if test "$PGPLOT" = "no" ; then
241  echo "To use PGPLOT, install these packages and re-run $MCCODE_STRING installation ./configure"
242  fi
243fi
244echo ""
245if test "$SCILAB" = "no" && test "$WGET" != no ; then
246  echo "Scilab install: you may try our automatic Scilab installation with"
247  echo "  # make install-scilab; ./configure; make; make install"
248  echo "    (requires Linux/Intel, wget and root priviliges)"
249fi
250if test "$SCILAB" = "no" ; then
251  echo "On Debian/Ubuntu systems, use:"
252  echo "  # sudo apt-get install scilab"
253fi
254echo ""
255echo "To setup the plotting environment, execute either"
256echo "  # make plotter (automatically selects plotter, "
257echo "         prefers PGPLOT before Matlab before Scilab before VRML)"
258if test "$SCILAB" != "no" ; then
259echo "  # make scilab (selects scilab)"
260fi
261if test "$MATLAB" != "no" ; then
262echo "  # make matlab (selects matlab)"
263fi
264if test "$PGPLOT" != "no" ; then
265echo "  # make pgplot (selects pgplot and installs perl-PGPLOT)"
266fi
267if test "$VRMLVIEW" != "no" ; then
268echo "  # make vrml   (selects vrml)"
269fi
270echo ""
271if test "$DASH" != "no" ; then
272echo
273echo WARNING: Your system includes the $DASH shell which is known to cause problems.
274echo "On Debian/Ubuntu systems, please use:"
275echo "  # sudo dpkg-reconfigure dash"
276echo "and say 'no' to install dash as /bin/sh"
277fi
278echo ""
279echo "After (optional) plotter config, build and install $MCCODE_STRING by executing"
280echo "  # make; make install"
281echo "will install $MCCODE_STRING into $prefix"
282echo ""
283
284
Note: See TracBrowser for help on using the browser.