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, 2.5, mcstas-support@mcstas.org)
23AC_REVISION($Revision: 1.1$)
24AC_COPYRIGHT([Copyright (C) Copyright, 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_PREFIX_DEFAULT(/usr/local)
31test "x$prefix" = xNONE && prefix=$ac_default_prefix
32
33AC_ARG_WITH([cc], AC_HELP_STRING([--with-cc=c compiler], [Specify name of C compiler]),
34        [with_cc=$withval], [with_cc=yes])
35if test x"$with_cc" != x"no" ; then
36        if test x"$with_cc" != x"yes" ; then CC="$with_cc"; fi
37        AC_PROG_CC
38else
39        AC_MSG_ERROR([You need a C compiler to compile this package])
40fi
41CF_ANSI_CC_CHECK
42
43AC_PATH_PROGS(PERL,   [perl perl5], no, /usr/bin:/usr/local/bin:$PATH)
44AC_PATH_PROGS(MATLAB, [matlab], no, /usr/local/bin:$PATH)
45AC_PATH_PROGS(GNUPLOT,[gnuplot /usr/local/bin/gnuplot], no, /usr/local/bin:$PATH)
46AC_PATH_PROGS(PGPLOT, [pgxwin_server], no, /usr/local/bin:/usr/local/pgplot:$PATH)
47AC_PATH_PROGS(TCLTK,  [wish tclsh], no, /usr/local/bin:$PATH)
48AC_PATH_PROGS(SSH,    [ssh plink], no, /usr/local/bin:$PATH)
49AC_PATH_PROGS(SCP,    [scp pscp], no, /usr/local/bin:$PATH)
50AC_PATH_PROGS(MPIRUN, [mpirun], no, /usr/local/bin:$PATH)
51AC_PATH_PROGS(MPICC,  [mpicc hcc mpxlc_r mpxlc mpcc cmpicc], no, /usr/local/bin:$PATH)
52AC_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)
53AC_PATH_PROGS(EDITOR, [gedit nedit kate xemacs gnome-open xedit vim notepad wordpad], no)
54AC_PATH_PROGS(AT,  [at], no)
55AC_PATH_PROGS(HDFVIEW,  [hdfview], no, /usr/local/bin:/usr/local/hdfview:$PATH)
56# Important here: gnome-terminal is broken:
57#  Any commandline arguments after -e must contain escaped spaces.
58# BUT: If escaped in the perl code, use of xterm/konsole is broken....
59# Hence we allow only gnome-terminal.wrapper which is debian only
60# :(
61AC_PATH_PROGS(TERMINAL,   [xterm konsole gnome-terminal.wrapper], no)
62
63# handle PIC options
64AC_ARG_WITH([pic],
65  [AS_HELP_STRING([--with-pic],
66     [enable support for PIC libraries (required to compile PGPLOT on some systems)])],
67  [USE_PIC=$withval],
68  [USE_PIC=no])
69AC_SUBST(USE_PIC)
70
71# check for MPI
72if test "$MPICC" != "no"; then
73  AC_CHECK_HEADER(mpi.h, , [ echo "WARNING: $MPICC may fail to compile without mpi.h" ] )
74fi
75
76# check for NeXus libraries
77AC_ARG_WITH([nexus],
78  [AS_HELP_STRING([--with-nexus],
79     [enable support for NeXus/HDF libraries])])
80if test "${with_nexus+set}" = set; then
81  AC_SUBST([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus"])
82  AC_DEFINE([HAVE_NEXUS], ["-DUSE_NEXUS -lNeXus"])
83else
84  AC_SUBST([HAVE_NEXUS], [])
85  AC_DEFINE([HAVE_NEXUS], [])
86fi
87
88AC_OUTPUT($prefix/lib/mcstas/tools/perl/mccode_config.perl)
89
90chmod a+w $prefix/lib/mcstas/tools/perl/mccode_config.perl
91
92echo "McStas has been reconfigured in $prefix/lib/mcstas/tools/perl/mccode_config.perl"
93
94