| 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 | # |
|---|
| 20 | dnl Process this file with autoconf to produce a configure script. |
|---|
| 21 | AC_INIT(@MCCODE_NAME@, @MCCODE_VERSION@, @MCCODE_TARNAME@-support@@MCCODE_TARNAME@.org) |
|---|
| 22 | AC_REVISION($Revision: 1.1$) |
|---|
| 23 | AC_COPYRIGHT([Copyright (C) Copyright, All rights reserved |
|---|
| 24 | Risoe National Laborartory, Roskilde, Denmark |
|---|
| 25 | Institut Laue Langevin, Grenoble, France |
|---|
| 26 | This software is covered by the GNU LESSER GENERAL PUBLIC LICENSE |
|---|
| 27 | see file COPYING for further information]) |
|---|
| 28 | |
|---|
| 29 | # set default package defines |
|---|
| 30 | MCCODE_TARNAME=$PACKAGE_TARNAME |
|---|
| 31 | MCCODE_NAME=$PACKAGE_NAME |
|---|
| 32 | MCCODE_VERSION=$PACKAGE_VERSION |
|---|
| 33 | MCCODE_STRING=$PACKAGE_STRING |
|---|
| 34 | MCCODE_BUGREPORT=$PACKAGE_BUGREPORT |
|---|
| 35 | MCCODE_DATE="@MCCODE_DATE@" |
|---|
| 36 | |
|---|
| 37 | AC_PREFIX_DEFAULT(/usr/local) |
|---|
| 38 | test "x$prefix" = xNONE && prefix=$ac_default_prefix |
|---|
| 39 | |
|---|
| 40 | AC_ARG_WITH([cc], AC_HELP_STRING([--with-cc=c compiler], [Specify name of C compiler]), |
|---|
| 41 | [with_cc=$withval], [with_cc=yes]) |
|---|
| 42 | if test x"$with_cc" != x"no" ; then |
|---|
| 43 | if test x"$with_cc" != x"yes" ; then CC="$with_cc"; fi |
|---|
| 44 | AC_PROG_CC |
|---|
| 45 | else |
|---|
| 46 | AC_MSG_ERROR([You need a C compiler to compile this package]) |
|---|
| 47 | fi |
|---|
| 48 | |
|---|
| 49 | # Have the user select wich version they want to build. |
|---|
| 50 | AC_ARG_ENABLE([mcstas], AC_HELP_STRING([--enable-mcstas], [Enable building McStas binaries.])) |
|---|
| 51 | AC_ARG_ENABLE([mcxtrace], AC_HELP_STRING([--enable-mcxtrace], [Enable building McXtrace binaries.])) |
|---|
| 52 | |
|---|
| 53 | # optional target change (mcstas -> mcxtrace or vice versa) |
|---|
| 54 | if 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 |
|---|
| 57 | elif test x"$enable_mcstas" = "xyes" ; then |
|---|
| 58 | MCCODE_TARNAME=[mcstas] |
|---|
| 59 | MCCODE_NAME=McStas |
|---|
| 60 | elif test x"$enable_mcxtrace" = "xyes" ; then |
|---|
| 61 | MCCODE_TARNAME=[mcxtrace] |
|---|
| 62 | MCCODE_NAME=McXtrace |
|---|
| 63 | fi |
|---|
| 64 | |
|---|
| 65 | # check if VERSION is defined (in principle, done in mkdist) |
|---|
| 66 | if 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 | |
|---|
| 83 | fi |
|---|
| 84 | |
|---|
| 85 | # determine particule to use: n or X and name of the env variable for location of library |
|---|
| 86 | if test P"$MCCODE_TARNAME" = "Pmcstas" ; then |
|---|
| 87 | MCCODE_PARTICULE=neutron |
|---|
| 88 | MCCODE_PROJECT=1 |
|---|
| 89 | MCCODE_LIBENV=[MCSTAS] |
|---|
| 90 | MCCODE_PREFIX=mc |
|---|
| 91 | else |
|---|
| 92 | MCCODE_PARTICULE=Xray |
|---|
| 93 | MCCODE_PROJECT=2 |
|---|
| 94 | MCCODE_LIBENV=[MCXTRACE] |
|---|
| 95 | MCCODE_PREFIX=mx |
|---|
| 96 | fi |
|---|
| 97 | |
|---|
| 98 | if 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" |
|---|
| 103 | fi |
|---|
| 104 | |
|---|
| 105 | # update corresponding DEFINE string in all makefiles |
|---|
| 106 | AC_DEFINE_UNQUOTED([MCCODE_DATE], "${MCCODE_DATE}") |
|---|
| 107 | AC_DEFINE_UNQUOTED([MCCODE_TARNAME], "${MCCODE_TARNAME}") |
|---|
| 108 | AC_DEFINE_UNQUOTED([MCCODE_NAME], "${MCCODE_NAME}") |
|---|
| 109 | AC_DEFINE_UNQUOTED([MCCODE_VERSION], "${MCCODE_VERSION}") |
|---|
| 110 | AC_DEFINE_UNQUOTED([MCCODE_STRING], "${MCCODE_STRING}") |
|---|
| 111 | AC_DEFINE_UNQUOTED([MCCODE_BUGREPORT], "${MCCODE_BUGREPORT}") |
|---|
| 112 | AC_DEFINE_UNQUOTED([MCCODE_PARTICULE],[$MCCODE_PARTICULE]) |
|---|
| 113 | AC_DEFINE_UNQUOTED([MCCODE_LIBENV],[$MCCODE_LIBENV]) |
|---|
| 114 | AC_DEFINE_UNQUOTED([MCCODE_PROJECT],[$MCCODE_PROJECT]) |
|---|
| 115 | AC_DEFINE_UNQUOTED([MCCODE_PREFIX],[$MCCODE_PREFIX]) |
|---|
| 116 | |
|---|
| 117 | # activate substitution in all .in files |
|---|
| 118 | AC_SUBST([MCCODE_DATE]) |
|---|
| 119 | AC_SUBST([MCCODE_TARNAME]) |
|---|
| 120 | AC_SUBST([MCCODE_NAME]) |
|---|
| 121 | AC_SUBST([MCCODE_VERSION]) |
|---|
| 122 | AC_SUBST([MCCODE_STRING]) |
|---|
| 123 | AC_SUBST([MCCODE_BUGREPORT]) |
|---|
| 124 | AC_SUBST([MCCODE_PARTICULE]) |
|---|
| 125 | AC_SUBST([MCCODE_LIBENV]) |
|---|
| 126 | AC_SUBST([MCCODE_PROJECT]) |
|---|
| 127 | AC_SUBST([MCCODE_PREFIX]) |
|---|
| 128 | |
|---|
| 129 | AC_PROG_INSTALL |
|---|
| 130 | CF_ANSI_CC_CHECK |
|---|
| 131 | MC_ANSI_MATH_PROTO |
|---|
| 132 | AC_FUNC_MALLOC |
|---|
| 133 | AC_FUNC_REALLOC |
|---|
| 134 | AC_FUNC_STRTOD |
|---|
| 135 | AC_CHECK_FUNCS(strcasecmp fdopen qsort strcasestr) |
|---|
| 136 | |
|---|
| 137 | AC_PATH_PROGS(PERL, [perl perl5], no, /usr/bin:/usr/local/bin:$PATH) |
|---|
| 138 | AC_PATH_PROGS(SCILAB, [scilab runscilab scilex], no, /usr/local/bin:/usr/lib/scilab/bin:/lib/scilab/bin:$PATH) |
|---|
| 139 | AC_PATH_PROGS(MATLAB, [matlab], no, /usr/local/bin:$PATH) |
|---|
| 140 | AC_PATH_PROGS(GNUPLOT,[gnuplot /usr/local/bin/gnuplot], no, /usr/local/bin:$PATH) |
|---|
| 141 | AC_PATH_PROGS(PGPLOT, [pgxwin_server], no, /usr/local/bin:/usr/local/pgplot:$PATH) |
|---|
| 142 | AC_PATH_PROGS(TCLTK, [wish tclsh], no, /usr/local/bin:$PATH) |
|---|
| 143 | AC_PATH_PROGS(SSH, [ssh plink], no, /usr/local/bin:$PATH) |
|---|
| 144 | AC_PATH_PROGS(SCP, [scp pscp], no, /usr/local/bin:$PATH) |
|---|
| 145 | AC_PATH_PROGS(DASH, [dash], no, /bin:/usr/bin:/usr/local/bin:$PATH) |
|---|
| 146 | AC_PATH_PROGS(MPIRUN, [mpirun], no, /usr/local/bin:$PATH) |
|---|
| 147 | AC_PATH_PROGS(MPICC, [mpicc hcc mpxlc_r mpxlc mpcc cmpicc], no, /usr/local/bin:$PATH) |
|---|
| 148 | AC_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) |
|---|
| 149 | AC_PATH_PROGS(EDITOR, [gedit nedit kate xemacs gnome-open xedit vim notepad wordpad open], no) |
|---|
| 150 | AC_PATH_PROGS(VRMLVIEW, [octagaplayer freewrl gtklookat qtlookat xmlookat maclookat fltklookat lookat], no) |
|---|
| 151 | AC_PATH_PROGS(PERLDL, [perldl], no, /usr/bin:/usr/local/bin:$PATH) |
|---|
| 152 | AC_PATH_PROGS(G77, [g77 f77 gfortran g95 f95], no) |
|---|
| 153 | AC_PATH_PROGS(MINGW, [i586-mingw32msvc-gcc], no) |
|---|
| 154 | AC_PATH_PROGS(MAKE, [make gmake], no) |
|---|
| 155 | AC_PATH_PROGS(AT, [at], no) |
|---|
| 156 | AC_PATH_PROGS(HDFVIEW, [hdfview], no, /usr/local/bin:/usr/local/hdfview:$PATH) |
|---|
| 157 | AC_PATH_PROGS(FLEX, [flex], flex, /bin:/usr/bin:/usr/local/bin:$PATH) |
|---|
| 158 | AC_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 | # :( |
|---|
| 164 | AC_PATH_PROGS(TERMINAL, [xterm konsole gnome-terminal.wrapper], no) |
|---|
| 165 | |
|---|
| 166 | # handle PIC options |
|---|
| 167 | AC_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]) |
|---|
| 172 | AC_SUBST(USE_PIC) |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | # check for MPI |
|---|
| 176 | if test "$MPICC" != "no" ; then |
|---|
| 177 | AC_CHECK_HEADER(mpi.h, , [ echo "WARNING: $MPICC may fail to compile without mpi.h" ] ) |
|---|
| 178 | fi |
|---|
| 179 | |
|---|
| 180 | # check for NeXus libraries |
|---|
| 181 | AC_ARG_WITH([nexus], |
|---|
| 182 | [AS_HELP_STRING([--with-nexus], |
|---|
| 183 | [enable support for NeXus/HDF libraries])]) |
|---|
| 184 | if test "${with_nexus+set}" = "set" ; then |
|---|
| 185 | AC_SUBST([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus "]) |
|---|
| 186 | AC_DEFINE([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus "]) |
|---|
| 187 | else |
|---|
| 188 | AC_SUBST([HAVE_NEXUS], []) |
|---|
| 189 | AC_DEFINE([HAVE_NEXUS], []) |
|---|
| 190 | fi |
|---|
| 191 | |
|---|
| 192 | AC_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 | |
|---|
| 194 | chmod a+x lib/tools/perl/mccode_reconfigure |
|---|
| 195 | |
|---|
| 196 | # warnings and errors |
|---|
| 197 | if test "$USE_PIC" != "no" ; then |
|---|
| 198 | echo "Activating PIC compilation for: make install-pgplot" |
|---|
| 199 | fi |
|---|
| 200 | if test "x$HAVE_NEXUS" != "x" ; then |
|---|
| 201 | echo "Activating NeXus support in $MCCODE_STRING ($HAVE_NEXUS)" |
|---|
| 202 | fi |
|---|
| 203 | if test "$MAKE" = "no" ; then |
|---|
| 204 | echo "ERROR: $MCCODE_STRING installation requires 'make' or 'gmake'" |
|---|
| 205 | exit |
|---|
| 206 | fi |
|---|
| 207 | |
|---|
| 208 | if 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]" |
|---|
| 214 | fi |
|---|
| 215 | if 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" |
|---|
| 218 | fi |
|---|
| 219 | if test "$BROWSER" = "no" ; then |
|---|
| 220 | echo "WARNING: No HTML browser could be found !" |
|---|
| 221 | fi |
|---|
| 222 | if 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 !" |
|---|
| 224 | fi |
|---|
| 225 | |
|---|
| 226 | # final message at end of configure |
|---|
| 227 | echo "" |
|---|
| 228 | if 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" |
|---|
| 235 | fi |
|---|
| 236 | if 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" |
|---|
| 240 | else if test "$PGPLOT" = "no" ; then |
|---|
| 241 | echo "To use PGPLOT, install these packages and re-run $MCCODE_STRING installation ./configure" |
|---|
| 242 | fi |
|---|
| 243 | fi |
|---|
| 244 | echo "" |
|---|
| 245 | if 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)" |
|---|
| 249 | fi |
|---|
| 250 | if test "$SCILAB" = "no" ; then |
|---|
| 251 | echo "On Debian/Ubuntu systems, use:" |
|---|
| 252 | echo " # sudo apt-get install scilab" |
|---|
| 253 | fi |
|---|
| 254 | echo "" |
|---|
| 255 | echo "To setup the plotting environment, execute either" |
|---|
| 256 | echo " # make plotter (automatically selects plotter, " |
|---|
| 257 | echo " prefers PGPLOT before Matlab before Scilab before VRML)" |
|---|
| 258 | if test "$SCILAB" != "no" ; then |
|---|
| 259 | echo " # make scilab (selects scilab)" |
|---|
| 260 | fi |
|---|
| 261 | if test "$MATLAB" != "no" ; then |
|---|
| 262 | echo " # make matlab (selects matlab)" |
|---|
| 263 | fi |
|---|
| 264 | if test "$PGPLOT" != "no" ; then |
|---|
| 265 | echo " # make pgplot (selects pgplot and installs perl-PGPLOT)" |
|---|
| 266 | fi |
|---|
| 267 | if test "$VRMLVIEW" != "no" ; then |
|---|
| 268 | echo " # make vrml (selects vrml)" |
|---|
| 269 | fi |
|---|
| 270 | echo "" |
|---|
| 271 | if test "$DASH" != "no" ; then |
|---|
| 272 | echo |
|---|
| 273 | echo WARNING: Your system includes the $DASH shell which is known to cause problems. |
|---|
| 274 | echo "On Debian/Ubuntu systems, please use:" |
|---|
| 275 | echo " # sudo dpkg-reconfigure dash" |
|---|
| 276 | echo "and say 'no' to install dash as /bin/sh" |
|---|
| 277 | fi |
|---|
| 278 | echo "" |
|---|
| 279 | echo "After (optional) plotter config, build and install $MCCODE_STRING by executing" |
|---|
| 280 | echo " # make; make install" |
|---|
| 281 | echo "will install $MCCODE_STRING into $prefix" |
|---|
| 282 | echo "" |
|---|
| 283 | |
|---|
| 284 | |
|---|