File: configure.ac

package info (click to toggle)
apbs 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 38,840 kB
  • ctags: 7,893
  • sloc: ansic: 44,537; xml: 21,399; sh: 20,613; fortran: 17,796; yacc: 2,922; python: 2,804; makefile: 567; lex: 294; sed: 205; java: 134; awk: 26
file content (1233 lines) | stat: -rw-r--r-- 38,119 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
dnl ##########################################################################
dnl APBS -- Adaptive Poisson-Boltzmann Solver
dnl 
dnl Nathan A. Baker (baker@biochem.wustl.edu)
dnl Dept. of Biochemistry and Molecular Biophysics
dnl Center for Computational Biology
dnl Washington University in St. Louis
dnl 
dnl Additional contributing authors listed in the code documentation.
dnl 
dnl Copyright (c) 2002-2008.  Washington University in St. Louis.
dnl All Rights Reserved.
dnl Portions Copyright (c) 1999-2002.  The Regents of the University of
dnl California.  
dnl Portions Copyright (c) 1995.  Michael Holst.
dnl 
dnl This file is part of APBS.
dnl 
dnl APBS is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl 
dnl APBS is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl 
dnl You should have received a copy of the GNU General Public License
dnl along with APBS; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
dnl
dnl Linking APBS statically or dynamically with other modules is making a
dnl combined work based on APBS. Thus, the terms and conditions of the GNU
dnl General Public License cover the whole combination.
dnl 
dnl SPECIAL GPL EXCEPTION
dnl In addition, as a special exception, the copyright holders of APBS
dnl give you permission to combine the APBS program with free software
dnl programs and libraries that are released under the GNU LGPL or with
dnl code included in releases of ISIM, Ion Simulator Interface, PMV, 
dnl SMOL, VMD, and Vision. Such combined software may be linked with APBS and 
dnl redistributed together in original or modified form as mere aggregation
dnl without requirement that the entire work be under the scope of the GNU 
dnl General Public License. This special exception permission is also extended
dnl to any software listed in the SPECIAL GPL EXCEPTION clauses by the PMG,
dnl FEtk, MC, or MALOC libraries.
dnl 
dnl Note that people who make modified versions of APBS are not obligated
dnl to grant this special exception for their modified versions; it is
dnl their choice whether to do so. The GNU General Public License gives
dnl permission to release a modified version without this exception; this
dnl exception also makes it possible to release a modified version which
dnl carries forward this exception.
dnl
dnl ##########################################################################

dnl ##########################################################################
dnl File: configure.in
dnl Purpose: configure.in script for APBS
dnl Note:  For use with autoconf-2.56 and above
dnl Author:  Michael Holst and Nathan Baker
dnl ##########################################################################

dnl ##########################################################################
dnl 0. autoconf initialization
dnl ##########################################################################
dnl # AC_INIT(src/aaa_inc/apbs/apbs.h)
AC_INIT([APBS], [1.0.0], [baker@biochem.wustl.edu])
AC_PREREQ(2.56)
AM_CONFIG_HEADER(src/aaa_inc/apbscfg.h)
AC_CONFIG_AUX_DIR(config)
AC_PREFIX_DEFAULT(${HOME})
AC_CANONICAL_SYSTEM

dnl ##########################################################################
dnl 1. automake initialization (uncomment only if rebuilding Makefile.in's)
dnl ##########################################################################
dnl # THIS IS THE VERSION INFORMATION FOR THE APBS LIBRARY.  ACCORDING TO 
dnl # THE LIBTOOL MANUAL:
dnl #   This flag accepts an argument of the form `current[:revision[:age]]'.
dnl #   So, passing `-version-info 3:12:1' sets current to 3, revision to 12,
dnl #   and age to 1.  If either revision or age are omitted, they default to 
dnl #   0. Also note that age must be less than or equal to the current 
dnl #   interface number.  Here are a set of rules to help you update your
dnl #   library version information:
dnl #      1. Start with version information of `0:0:0' for each libtool 
dnl #         library.
dnl #      2. Update the version information only immediately before a public
dnl #         release of your software. More frequent updates are unnecessary,
dnl #         and only guarantee that the current interface number gets larger
dnl #         faster.  
dnl #      3. If the library source code has changed at all since the last
dnl #         update, then increment revision (`c:r:a' becomes `c:r+1:a').
dnl #      4. If any interfaces have been added, removed, or changed since the
dnl #         last update, increment current, and set revision to 0.
dnl #      5. If any interfaces have been added since the last public release,
dnl #         then increment age.
dnl #      6. If any interfaces have been removed since the last public
dnl #         release, then set age to 0.
dnl #
dnl #   Never try to set the interface numbers so that they correspond to the
dnl #   release number of your package. This is an abuse that only fosters
dnl #   misunderstanding of the purpose of library versions.
AM_INIT_AUTOMAKE(apbs, 1.0.0)
APBS_VERSION="1:0:0"
AC_SUBST(APBS_VERSION)
ACLOCAL=":";
AUTOCONF=":";
AUTOMAKE=":";
AUTOHEADER=":";
AC_SUBST(ACLOCAL)
AC_SUBST(AUTOCONF)
AC_SUBST(AUTOMAKE)
AC_SUBST(AUTOHEADER)

dnl # ---------------------------
dnl # SET CONVENIENCE PATHS
dnl # ---------------------------
top_apbsdir=`pwd`
contrib_path=`pwd`/contrib
AC_SUBST(top_apbsdir)
AC_SUBST(contrib_path)

dnl # ---------------------------
dnl # HANDLE THE FAST OPTION
dnl # ---------------------------

AC_MSG_CHECKING([for --enable-fast option])
AC_ARG_ENABLE(
	[fast],
	AS_HELP_STRING([--enable-fast], [enables fast computation]),,
	[enable_fast=no]
)

if test x"$enable_fast" != "xno"; then
	AC_DEFINE([APBS_FAST], [], [using the fast APBS parameters])
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
fi

dnl # -------------------------------------------------------------------------
dnl # Set the prefix value explicitly if it isn't set
dnl # -------------------------------------------------------------------------
if test [ "${prefix}" = "NONE" ] ; then
	prefix=$HOME
fi

dnl ##########################################################################
dnl 2. checks for programs
dnl ##########################################################################
AC_MSG_CHECKING([for --enable-python])
AC_ARG_ENABLE(
	[python],
	AS_HELP_STRING([--enable-python],[enables Python wrapper compilation]),,
	[enable_python=no]
)
if test x"$enable_python" != "xno"; then
	AC_MSG_RESULT([yes])
	AC_MSG_NOTICE([Python linkage requires GNU compilers])
	cclist="gcc"
	f77list="gfortran g95 g77"
	apbs_do_python="python"
else
	AC_MSG_RESULT([no])
	cclist="icc pgcc gcc"
	f77list="ifort pgf77 gfortran g95 g77"
	apbs_do_python=""
fi
AC_SUBST(apbs_do_python)

AC_LANG_C
AC_PROG_CC(${cclist})
AM_PROG_CC_STDC
AC_PROG_CXX
AC_PROG_F77(${f77list})

dnl # -------------------------------------------------------------------------
dnl # Test to see if the compiler combination is valid for gcc/g77 or
dnl # gcc/gfortran/g95. Since code compiled with gcc 4.0 is only link
dnl # compatible with gfortran/g95. If they are using g77 then they need to
dnl # use gcc < 4.0 - D. Gohara 8/30/2006
dnl # -------------------------------------------------------------------------
if test ["$CC" = "gcc"]; then
	gcc_version=`gcc --version`
	gcc_complete_version=`echo ${gcc_version} | awk '{printf("%s",$3)}'`
	gcc_major_version=`echo ${gcc_complete_version} | awk '{printf("%i",$1)}'`

	if test ["$F77" = "g77"]; then
		if test ["${gcc_major_version}" -ge 4]; then
			AC_MSG_ERROR([Error, your GCC version is: ${gcc_complete_version} which is not compatible])
			AC_MSG_ERROR([with g77. You need to either use gcc < 4.0 as your C/CC/CXX compiler])
			AC_MSG_ERROR([or gfortran/g95 as your Fortran compiler ... exiting.])
		fi
	fi
fi

dnl AC_F77_LIBRARY_LDFLAGS 
dnl # -----------------------
dnl # HANDLE OSF WEIRDNESS:
dnl #   This includes the inability to link FORTRAN and C code compiled with
dnl #   debugger flags and a g77 that breaks on some FORTRAN code with the
dnl #   -O2 flag set.
dnl # -----------------------
short_os=`echo ${host_os} | sed 's/osf.*/osf/g'`;
if test -z "`echo ${short_os} | sed 's/osf//g'`"; then
	AC_MSG_NOTICE([Disabling debugger compiler flags to avert OSF weirdness])
	if test -z ${FFLAGS-''}; then
		FFLAGS="";
	else
		FFLAGS=`echo ${FFLAGS} | sed 's/-g//g'`;
		if test -z "`echo ${F77-f77} | sed 's/g77//g'`"; then
			FFLAGS=`echo ${FFLAGS} | sed 's/-O2/-O/g'`;
		fi
	fi
	if test -z ${CFLAGS-''}; then
		CFLAGS="";
	else
		CFLAGS=`echo ${CFLAGS} | sed 's/-g//g'`;
	fi
	if test -z ${CPPFLAGS-''}; then
		CPPFLAGS="";
	else
		CPPFLAGS=`echo ${CPPFLAGS} | sed 's/-g//g'`;
	fi
	if test -z ${CXXFLAGS-''}; then
		CXXFLAGS="";
	else
		CXXFLAGS=`echo ${CXXFLAGS} | sed 's/-g//g'`;
	fi
fi
AC_F77_NOFORMAIN
FFLAGS="${FLIBS} ${FFLAGS}"
if test "${CC}" != "icl"; then
  AC_F77_FCN_MANGLE()
fi
AC_LANG_C
AC_PROG_CPP
AC_DISABLE_SHARED
AM_PROG_LIBTOOL

dnl ##########################################################################
dnl 3. checks for libraries
dnl ##########################################################################
dnl # Check for the math library.
AC_LANG_C
AC_CHECK_LIB(m,pow,[math_lib="-lm"],[math_lib=""])
AC_SUBST(math_lib)
dnl # Check for the liberty library
AC_LANG_C
AC_CHECK_LIB(iberty,strerrno,[liberty_lib="-liberty"],[liberty_lib=""])
AC_SUBST(liberty_lib)
dnl # Check for "gethostbyname" and nsl library
nsl_lib="";
AC_LANG_C
AC_CHECK_FUNC(gethostbyname,[try_nsl=""],[try_nsl="yes"])
if test -n "${try_nsl}"; then
	AC_CHECK_LIB(nsl,gethostbyname,[nsl_lib="-lnsl"],[nsl_lib=""])
fi
AC_SUBST(nsl_lib)
dnl # Check for "connect" and socket library
socket_lib="";
AC_LANG_C
AC_CHECK_FUNC(connect,[try_socket=""],[try_socket="yes"])
if test -n "${try_socket}"; then
	AC_CHECK_LIB(socket,connect,[socket_lib="-lsocket"],[socket_lib=""])
fi
AC_SUBST(socket_lib)
dnl # Check for "thr_create()" and thread library
thread_lib="";
AC_LANG_C
AC_CHECK_FUNC(thr_create,[try_thread=""],[try_thread="yes"])
if test -n "${try_thread}"; then
	AC_CHECK_LIB(thread,thr_create,[thread_lib="-lthread"],[thread_lib=""])
fi
AC_SUBST(thread_lib)
dnl # CHECK FOR TIME
try_time=""
AC_LANG_C
AC_CHECK_FUNC(time,[AC_DEFINE([HAVE_TIME_FUNC], [], [have the time() function])], [])
dnl # CHECK FOR RAND
try_rand=""
AC_LANG_C
AC_CHECK_FUNC(rand,[AC_DEFINE([HAVE_RAND_FUNC], [], [have the rand() function])], [])
dnl # CHECK FOR SRAND
try_srand=""
AC_LANG_C
AC_CHECK_FUNC(srand,[AC_DEFINE([HAVE_SRAND_FUNC], [], [have the srand() function])], [])

dnl ##########################################################################
dnl 4. checks for header files
dnl ##########################################################################

dnl ##########################################################################
dnl 5. checks for typedefs
dnl ##########################################################################

dnl ##########################################################################
dnl 6. checks for structures
dnl ##########################################################################

dnl ##########################################################################
dnl 7. checks for compiler characteristics
dnl ##########################################################################

dnl # ------------------------------------
dnl # HANDLE COMPILER FLOATING POINT ERROR
dnl # ------------------------------------

AC_FPERROR

dnl ##########################################################################
dnl 8. checks for library functions
dnl ##########################################################################

dnl ##########################################################################
dnl 9. checks for system services
dnl ##########################################################################

dnl ##########################################################################
dnl 10. checks for anything else
dnl ##########################################################################

fetk_cpu_vendor_os="";
AC_SUBST(fetk_cpu_vendor_os)

AC_MSG_NOTICE([-----------------------------------------------------------])
AC_MSG_NOTICE([---------- begin configuring for MALOC linkage ------------])
AC_MSG_NOTICE([-----------------------------------------------------------])

dnl # ----------------------
dnl # HANDLE THE MALOC AND FETK LIBRARIES
dnl # ----------------------

contrib_path=`pwd`/contrib

dnl First check to see if they are using FETK_INCLUDE or FETK_LIBRARY
dnl if they are abort. We no longer support this...
if test -n "${FETK_INCLUDE}"; then
	AC_MSG_WARN([Error... FETK_INCLUDE is no longer supported.])
	AC_MSG_WARN([Use --with-fetk-include=PATH instead.])
	AC_MSG_WARN([Ignoring these variables...])
fi

if test -n "${FETK_LIBRARY}"; then
	AC_MSG_WARN([Error... FETK_LIBRARY is no longer supported.])
	AC_MSG_WARN([Use --with-fetk-library=PATH instead.])
	AC_MSG_WARN([Ignoring these variables...])
fi

dnl Next see if the user specified fetk-include or fetk-lib if they did
dnl process those and use those values instead of our own MALOC
AC_MSG_CHECKING([for --with-fetk-include option])
AC_ARG_WITH(
	[fetk-include],
	AS_HELP_STRING([--with-fetk-include=PATH], [full path to the FETk INCLUDE directory]),
	[fetk_include_path="${with_fetk_include}"]
)
if test x"$fetk_include_path" != "xno" -a -n "$fetk_include_path"; then
	AC_MSG_RESULT([${fetk_include_path}])
	USE_FETK_INCLUDE="yes"
else
	AC_MSG_RESULT([no])
fi

AC_MSG_CHECKING([for --with-fetk-library option])
AC_ARG_WITH(fetk-library,
	AS_HELP_STRING([--with-fetk-library=PATH], [full path to the FETk LIBRARY directory]),
	[fetk_library_path="${with_fetk_library}"]
)
if test x"$fetk_library_path" != "xno" -a -n "$fetk_library_path"; then
	AC_MSG_RESULT([${fetk_library_path}])
	USE_FETK_LIBRARY="yes"
else
	AC_MSG_RESULT([no])
fi

USE_FETK=
if test -n "${USE_FETK_INCLUDE}"; then
	maloc_inc_path="${fetk_include_path}"
	AC_CHECK_FILE(${maloc_inc_path}/maloc/maloc.h,[maloc_inc="yes"],[maloc_inc=""])	
	if test -z "${maloc_inc}"; then
		AC_MSG_ERROR([[Error... Couldn't find FETK include files in the location you specified]])
	fi
else
	maloc_inc_path="${contrib_path}/include";
fi
AC_MSG_NOTICE([Using MALOC headers in ${maloc_inc_path}])

if test -n "${USE_FETK_LIBRARY}"; then
	maloc_lib_path="${fetk_library_path}"
	AC_CHECK_FILE(${maloc_lib_path}/libmaloc.a,[maloc_lib="yes"],[maloc_lib=""])
	if test -z "${maloc_lib}"; then
		AC_MSG_ERROR([Error... Couldn't find FETK library files in the location you specified])
	fi
	USE_FETK="yes"
else
	maloc_lib_path="${contrib_path}/lib";
fi
AC_MSG_NOTICE([Using MALOC libraries in ${maloc_lib_path}])

maloc_inc="-I${maloc_inc_path}"
maloc_lib="-L${maloc_lib_path} -lmaloc"

dnl # Return LDFLAGS and CPPFLAGS to normal
AC_SUBST(maloc_lib)
AC_SUBST(maloc_inc)

dnl # ---------------------------
dnl # HANDLE THE MPI LIBRARY
dnl # ---------------------------

dnl # MPI header location ARG specification (override environment)
AC_MSG_CHECKING([for --with-mpich option])
AC_ARG_WITH(
	[mpich],
	AS_HELP_STRING([--with-mpich=PATH], [toplevel MPICH directory]),
	[mpi_path="${with_mpich}"]
)

if test x"$mpi_path" != "xno" -a -n "$mpi_path"; then
	AC_MSG_RESULT([${mpi_path}])
	USE_MPICH="yes"
	mpi_path=
else
	AC_MSG_RESULT([no])
fi

if test -z "${mpi_path}"; then
	AC_MSG_CHECKING([for --with-mpich2 option])
	AC_ARG_WITH(
		[mpich2],
		AS_HELP_STRING([--with-mpich2=PATH], [toplevel MPICH2 directory]),
		[mpi_path="${with_mpich2}"]
	)
	if test x"$mpi_path" != "xno" -a -n "$mpi_path"; then
		AC_MSG_RESULT([${mpi_path}])
		USE_MPICH2="yes"
	else
		AC_MSG_RESULT([no])
		mpi_path=
	fi
fi

if test -z "${mpi_path}"; then
	AC_MSG_CHECKING([for --with-lam option])
	AC_ARG_WITH(
		[lam],
		AS_HELP_STRING([--with-lam=PATH], [toplevel LAM-MPI directory]),
		[mpi_path="${with_lam}"]
	)
	if test x"$mpi_path" != "xno" -a -n "$mpi_path"; then
		AC_MSG_RESULT([${mpi_path}])
		USE_LAM="yes"
	else
		AC_MSG_RESULT([no])
		mpi_path=
	fi
fi

if test -z "${mpi_path}"; then
	AC_MSG_CHECKING([for --with-openmpi option])
	AC_ARG_WITH(
		[openmpi],
		AS_HELP_STRING([--with-openmpi], [enable OpenMPI compilation]),
		[mpi_path="${with_openmpi}"],
	)
	if test x"$mpi_path" != "xno" -a -n "$mpi_path"; then
		AC_MSG_RESULT([${mpi_path}])
		USE_OPMI="yes"
	else
		AC_MSG_RESULT([no])
		mpi_path=
	fi
fi

dnl # MPI library location ARG specification (override environment)
USE_MPI=
if test -n "${mpi_path}"; then
	AC_CHECK_FILE(${mpi_path}/include/mpi.h,[HAS_MPI_INC="yes"], [])
	if test -n "${HAS_MPI_INC}"; then
		mpi_inc="-I${mpi_path}/include"
		AC_DEFINE([HAVE_MPI_H], [], [have the MPI library])
	else
		AC_MSG_ERROR([Error... mpi.h missing in ${mpi_path}/include], 0)
	fi
	
	if test -n "${USE_MPICH}"; then
		AC_CHECK_FILE(${mpi_path}/lib/libmpich.a, [HAS_MPI_LIB="yes"], [])
		AC_CHECK_FILE(${mpi_path}/lib/libmpich.so, [HAS_MPI_LIB="yes"], [])
		AC_CHECK_FILE(${mpi_path}/lib/libmpich.dylib, [HAS_MPI_LIB="yes"], [])
		
		if test -n "${HAS_MPI_LIB}"; then
			mpi_lib="-L${mpi_path}/lib -lmpich -lpmpich"
			mpi_bin="pnoshell"
		else
			AC_MSG_ERROR([Error...Could not find MPICH library in ${mpi_path}/lib], 0)
		fi
	fi
	
	if test -n "${USE_MPICH2}"; then
		AC_CHECK_FILE(${mpi_path}/lib/libmpich.a, [HAS_MPI_LIB="yes"], [])
		AC_CHECK_FILE(${mpi_path}/lib/libmpich.so, [HAS_MPI_LIB="yes"], [])
		AC_CHECK_FILE(${mpi_path}/lib/libmpich.dylib, [HAS_MPI_LIB="yes"], [])
		if test -n "${HAS_MPI_LIB}"; then
			mpi_lib="-L${mpi_path}/lib -lmpich"
		else
			AC_MSG_ERROR([Error...Could not find MPICH library in ${mpi_path}/lib], 0)
		fi
	fi
	
	if test -n "${USE_LAM}"; then
		AC_CHECK_FILE(${mpi_path}/lib/liblam.a, [HAS_MPI_LIB="yes"], [])
		AC_CHECK_FILE(${mpi_path}/lib/liblam.so, [HAS_MPI_LIB="yes"], [])
		AC_CHECK_FILE(${mpi_path}/lib/liblam.dylib, [HAS_MPI_LIB="yes"], [])
		if test -n "${HAS_MPI_LIB}"; then
			mpi_lib="-L${mpi_path}/lib -lmpi -llam"
		else
			AC_MSG_ERROR([Error...Could not find LAM-MPI libraries in ${mpi_path}/lib], 0)
		fi
	fi
	
#	if test -n "${USE_OPMI}"; then
#		AC_CHECK_FILE(${mpi_path}/lib/libmpi.a, [HAS_MPI_LIB="yes"], [])
#		AC_CHECK_FILE(${mpi_path}/lib/libmpi.so, [HAS_MPI_LIB="yes"], [])
#		AC_CHECK_FILE(${mpi_path}/lib/liblam.dylib, [HAS_MPI_LIB="yes"], [])
#		if test -n "${HAS_MPI_LIB}"; then
#			mpi_lib="-L${mpi_path}/lib -lmpi"
#		else
#			AC_MSG_ERROR([Error...Could not find LAM-MPI libraries in ${mpi_path}/lib], 0)
#		fi
#	fi

	USE_MPI="yes"
fi

if test -n "${USE_OPMI}"; then
  	HAS_MPI_LIB="yes"
	HAS_MPI_INC="yes"
	mpi_inc=""
	mpi_lib=""
	AC_DEFINE([HAVE_MPI_H], [], [have the MPI library])
	USE_MPI="yes"
fi	

AC_SUBST(mpi_lib)
AC_SUBST(mpi_inc)
dnl AC_SUBST(mpi_bin)

AC_MSG_NOTICE([---------------------------------------------------------------])
AC_MSG_NOTICE([---------- begin configuring for Python wrappers --------------])
AC_MSG_NOTICE([---------------------------------------------------------------])

PY_ENABLE=""
AC_MSG_CHECKING([for --enable-python])
if test x"$enable_python" != "xno"; then
	AC_MSG_RESULT([yes])
	AC_PATH_PROG(py_path, python)
	PY_ENABLE="yes"    

	if test -n "${py_path}"; then
		changequote(<<, >>)dnl
		PY_VERSION=`$py_path -c 'import sys; print sys.version[:3]'`   
		changequote([, ])dnl
		PY_PREFIX=`$py_path -c 'import sys; print sys.prefix'`
		PY_EXEC_PREFIX=`$py_path -c 'import sys; print sys.exec_prefix'`
		if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then
			PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION -I$PY_EXEC_PREFIX/include/python$PY_VERSION"
		fi
	fi

	PY_LINKFLAGS=${CFLAGS}
	PY_CC=${CC}

	dnl # Platform specific linking flags

	PY_LDFLAGS=""
	PY_SHARED=""
	case $host_os in
		linux*) 
			PY_SHARED="-shared"
			CC="${CC} -fPIC"
			F77="${F77} -fPIC"
			;;
		irix*) 
			PY_SHARED="-shared"
			PY_LDFLAGS="-lftn -lm"
			;;
		sun|solaris**) 
			PY_SHARED="-G"
			PY_LDFLAGS="-lF77 -lm -lM77 -lsunmath"
			;;
		darwin**)
			PY_CC=${F77}
			PY_LINKFLAGS="-Wl,-framework -Wl,Python -shared"
			PY_LDFLAGS="-Wl,-framework -Wl,Accelerate"
			;;
		mingw*)
			PY_PREFIX=`$py_path -c 'import sys, string; a=sys.prefix; b=string.replace(a,"c:\\\","/c/"); print b;'`
			PY_EXEC_PREFIX=`$py_path -c 'import sys, string; a=sys.exec_prefix; b=string.replace(a,"c:\\\","/c/"); print b;'`
			changequote(<<, >>)dnl
			PY_NOSPACE_VER=`$py_path -c 'import sys; a=sys.version[0]; b=sys.version[2]; print a+b;'`
			changequote([, ])dnl
			PY_CC=${F77}
			PY_LDFLAGS="-L$PY_PREFIX/libs -lpython$PY_NOSPACE_VER"
			PY_SHARED="-shared"
			if test -f $PY_PREFIX/include/Python.h; then
				PY_CFLAGS="-I$PY_PREFIX/include -I$PY_EXEC_PREFIX/include"
			fi
			;;
	esac

	dnl # The Python wrappers use different flags on different arches

	IS_STATIC=`echo ${LDFLAGS} | grep static`
	case $host_cpu in
		x86_64*)
			PY_CC="${F77}";;
		i*86)
			PY_CC="${F77}"
			if test "${CC}" = "icc"; then
				AC_CHECK_LIB(ifcore_pic,d_int_val,[ifcore_lib="-lifcore_pic"],[ifcore_lib=""])
				if test -n "${ifcore_lib}"; then
					PY_LDFLAGS=${ifcore_lib}
				else
					AC_MSG_WARN([Unable to find Intel's ifcore_pic library - Python wrappers may fail looking for d_int_val.])
				fi
				if test -n "${IS_STATIC}"; then
					PY_LINKFLAGS="$CFLAGS -static-libcxa -Wl,-static"
				fi
			fi;; 
		ia64*)
			if test "${CC}" = "icc"; then
				AC_CHECK_LIB(ifcore_pic,d_int_val,[ifcore_lib="-lifcore_pic"],[ifcore_lib=""])
				if test -n "${ifcore_lib}"; then
					PY_LDFLAGS=${ifcore_lib}
				else
					AC_MSG_WARN([Unable to find Intel's ifcore_pic library - Python wrappers may fail looking for d_int_val.])
				fi
				if test -n "${IS_STATIC}"; then
					if (test -f /usr/lib/libc.so) && (test -f /usr/lib/libm.so); then
						PY_LINKFLAGS="$CFLAGS -static-libcxa -Wl,-static,/usr/lib/libc.so,/usr/lib/libm.so"
					else
						AC_MSG_WARN([Could not find libc.so or libm.so in /usr/lib])
					fi 
				fi
			fi;; 
	esac

else
	AC_MSG_RESULT([no])
fi


if test -n "${PY_ENABLE}"; then
	AC_MSG_NOTICE(Python wrappers enabled)
else
	AC_MSG_NOTICE(Python wrappers disabled)
fi

AC_SUBST(PY_SHARED,[$PY_SHARED])
AC_SUBST(PY_LDFLAGS,[$PY_LDFLAGS])
AC_SUBST(PY_CFLAGS,[$PY_CFLAGS])
AC_SUBST(PY_LINKFLAGS,[$PY_LINKFLAGS])
AC_SUBST(PY_CC,[$PY_CC])
AM_CONDITIONAL(PY_PRESENT, [test -n "${PY_ENABLE}"])

dnl # ---------------------------
dnl # BUILD MALOC IF NECESSARY
dnl # ---------------------------
if test -z "${USE_FETK}";  then
	AC_MSG_CHECKING([for --disable-maloc-rebuild])
	AC_ARG_ENABLE(
		[maloc-rebuild],
		AS_HELP_STRING([--disable-maloc-rebuild], [disable rebuilding maloc]),,
		[enable_maloc_rebuild=yes]
	)
	
	if test x"$enable_maloc_rebuild" = "xno"; then
		AC_MSG_RESULT([yes])
		AC_MSG_NOTICE([Will not rebuild MALOC...skipping])
		apbs_do_maloc=""
	else
		AC_MSG_RESULT([no])
		AC_MSG_NOTICE([-----------------------------------------------------------])
		AC_MSG_NOTICE([-------------------- building MALOC -----------------------])
		AC_MSG_NOTICE([-----------------------------------------------------------])
		apbs_do_maloc="maloc"
		
		export CC=${CC}
		export CFLAGS=${CFLAGS}
		export LDFLAGS=${LDFLAGS}
		cd ${contrib_path}/maloc
	
		make clean
	
		if test -n "${USE_MPI}";then
			export APBS_MPI_INC=${mpi_inc}
			export APBS_MPI_LIB=${mpi_lib}
			
			./configure --prefix=${contrib_path} --with-mpi --enable-vdebug
		else
			./configure --prefix=${contrib_path} --enable-vdebug
		fi
		
		make; make install;
		cd ../../

		AC_MSG_NOTICE([-----------------------------------------------------------])
		AC_MSG_NOTICE([----- MALOC installation finished continuing with APBS ----])
		AC_MSG_NOTICE([-----------------------------------------------------------])
	fi
	
else
	AC_MSG_NOTICE([Skipping MALOC installation; will use MALOC provided with FEtk])
fi
AC_SUBST(apbs_do_maloc)

dnl # ---------------------------
dnl # HANDLE THE READLINE LIBRARY
dnl # ---------------------------

LDFLAGS_SAVE=${LDFLAGS};
CPPFLAGS_SAVE=${CPPFLAGS};
LDFLAGS=${maloc_lib_path};
CPPFLAGS=${maloc_inc_path};
rl_lib="";
AC_CHECK_LIB(maloc,maloc_needs_rl,
	[rl_use="yes"],
	[rl_use=""],
	[${maloc_lib_path} -lmaloc -lvf2c ${liberty_lib} ${socket_lib} ${nsl_lib} ${math_lib}])
if test -n "${rl_use}"; then

	dnl # READLINE library location ENV specification
	AC_MSG_CHECKING([whether your environment defines FETK_RL_LIBRARY])
	if test -n "${FETK_RL_LIBRARY}"; then
		AC_MSG_RESULT([${FETK_RL_LIBRARY}])
		rl_lib_path="-L${FETK_RL_LIBRARY} ";
	else
		AC_MSG_RESULT([no])
		rl_lib_path="";
	fi

	dnl # Setup temp LDFLAGS and look for READLINE library
  
	LDFLAGS=${rl_lib_path};
	AC_CHECK_LIB(ncurses,tgetnum,
		[ncurses_lib="-lncurses"],
		[ncurses_lib=""],
		[${math_lib}])
	AC_CHECK_LIB(readline,readline,
		[rl_use="yes";rl_lib="${rl_lib_path} -lreadline ${ncurses_lib}"],
		[rl_use="";rl_lib=""],
		[${rl_lib_path} ${ncurses_lib} ${math_lib}])
	if test -n "${rl_use}"; then
		AC_CHECK_LIB(readline,add_history,
			[rl_use="yes";rl_lib="${rl_lib_path} -lreadline ${ncurses_lib}"],
			[rl_use="";rl_lib=""],
			[${rl_lib_path} ${ncurses_lib} ${math_lib}])
	fi

	dnl # Return LDFLAGS to normal
	LDFLAGS=${LDFLAGS2_SAVE};

	dnl # Final decision
	if test -z "${rl_use}"; then
		AC_MSG_NOTICE([MALOC was compiled with READLINE enabled])
		AC_MSG_NOTICE([MALOC needs to link against the READLINE library])
		AC_MSG_ERROR([READLINE cannot be found!])
	fi
fi
LDFLAGS=${LDFLAGS_SAVE};
CPPFLAGS=${CPPFLAGS_SAVE};
AC_SUBST(rl_lib)

dnl # BEGIN FETK LIBRARY/HEADER TEST BLOCK
dnl # -----------------------
dnl # HANDLE THE FEtk LIBRARIES
dnl #
dnl # We require MC to be present.  If this library is not found, then 
dnl # we simply disable compilation of the portions of APBS
dnl # which depend on FEtk.  Compilation can also be disabled by the
dnl # '--disable-fetk' flag.
dnl # -----------------------
dnl # MC header location ENV specification

AC_MSG_NOTICE([------------------------------------------------------------])
AC_MSG_NOTICE([---------- begin configuring for FEtk linkage --------------])
AC_MSG_NOTICE([------------------------------------------------------------])

dnl # BEGIN FETK LIBRARY/HEADER TEST BLOCK
mc_lib=""
mc_inc=""
mc_do_src=""
mc_do_lib=""
mc_do_test=""

AC_MSG_CHECKING([for --disable-fetk])
AC_ARG_ENABLE(
	[fetk],
	AS_HELP_STRING([--disable-fetk],[disable FEtk features]),,
	[enable_fetk=yes]
)

if test x"$enable_fetk" != "xno"; then
	AC_MSG_RESULT([no])
	AC_MSG_CHECKING([for user-specified FEtk include path])
	if test -n "${fetk_include_path}"; then
		AC_MSG_RESULT([${fetk_include_path}])
		mc_inc_path="-I${fetk_include_path} ";
	else
		AC_MSG_RESULT([no])
	fi
	
	AC_MSG_CHECKING([for user-specified FEtk library path])
	if test -n "${fetk_library_path}"; then
		AC_MSG_RESULT([${fetk_library_path}])
		mc_lib_path="-L${fetk_library_path}";
	else
		AC_MSG_RESULT([no])
	fi
	
	dnl # Setup temp LDFLAGS and look for MC library/header
	LDFLAGS_SAVE=${LDFLAGS};
	CPPFLAGS_SAVE=${CPPFLAGS};
	LDFLAGS=${mc_lib_path};
	CPPFLAGS=${mc_inc_path};
	mc_found="";
	AC_CHECK_HEADER(mc/mc.h,
		[mc_found="yes";mc_inc="${mc_inc_path}"],
		[mc_found="";mc_inc=""])
	AC_CHECK_LIB(mc,mc_link,
		[mc_found="yes";mc_lib="${mc_lib_path} -lmc"],
		[mc_found="";mc_lib=""],
		[${mc_lib_path} -lmc ${maloc_lib} ${mpi_lib} ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${math_lib}])
	dnl # Setup temp LDFLAGS and look for MCX library/header
	LDFLAGS=${mc_lib_path};
	CPPFLAGS=${mc_inc_path};
	mcx_found="";
	AC_CHECK_HEADER(mcx/mcx.h,
		[mcx_found="yes";mcx_inc="${mc_inc_path}"],
		[mcx_found="";mc_inc=""])
	AC_CHECK_LIB(mcx,mcx_link,
		[mcx_found="yes";mcx_lib="${mc_lib_path} -lmcx"],
		[mcx_found="";mcx_lib=""],
		[${mc_lib_path} -lmc ${maloc_lib} ${mpi_lib} ${rl_lib} ${liberty_lib} ${socket_lib} ${nsl_lib} ${math_lib}])
    

	dnl # Return LDFLAGS and CPPFLAGS to normal
	LDFLAGS=${LDFLAGS_SAVE}
	CPPFLAGS=${CPPFLAGS_SAVE}
	
	if test -n "${mc_found}"; then
		AC_MSG_NOTICE([FEtk component MC found:  enabled.])
		AC_DEFINE([HAVE_MC_H], [], [have FEtk component MC])
	else
		AC_MSG_WARN([FEtk component MC not found:  finite element solver disabled.])
	fi
	if test -n "${mcx_found}"; then
		AC_MSG_NOTICE([FEtk component MCX found:  enabled.])
		AC_DEFINE([HAVE_MCX_H], [], [have FEtk component MCX])\
		AC_DEFINE([USE_HB], [], [use hierarchical basis method])
	else
		AC_MSG_WARN([FEtk component MCX not found:  hierarchical basis methods disabled.])
	fi
else
	AC_MSG_RESULT([yes])
	AC_MSG_NOTICE([FEtk disabled at user request.])
fi
AC_SUBST(mcx_lib)
AC_SUBST(mcx_inc)
AC_SUBST(mc_lib)
AC_SUBST(mc_inc)

AC_MSG_NOTICE([---------------------------------------------------------------])
AC_MSG_NOTICE([------------ begin processing APBS configure options ----------])
AC_MSG_NOTICE([---------------------------------------------------------------])

dnl # -----------------------
dnl # HANDLE SYMBOL EMBEDDING
dnl # -----------------------
AC_MSG_CHECKING([for EMBED macro can be used])
AC_TRY_COMPILE(,
	[#define EMBED(rctag) \
	static const char* rctag; \
	static void* use_rcsid=(0 ? &use_rcsid : (void**)&rcsid);
	EMBED(rcsid)],
	[embed_ok=yes; AC_DEFINE([HAVE_EMBED], [], [EMBED macro can be used])],
	[embed_ok=no])
AC_MSG_RESULT(${embed_ok})


dnl # --------------------------------
dnl # HANDLE ANSI/PEDANTIC COMPILATION
dnl # --------------------------------
AC_MSG_CHECKING([--enable-pansi])
AC_ARG_ENABLE(
	[pansi],
	AS_HELP_STRING([--enable-pansi], [enable pedantic ANSI compilation]),,
	[enable_pansi=no]
)
if test x"$enable_pansi" != "xno"; then
	AC_MSG_RESULT([yes])
	wall="-Wall"
	wall_pedantic="-Wall -pedantic"
	wall_pedantic_ansi="-Wall -pedantic -ansi"
	pedantic_ansi="-pedantic -ansi"
else
	AC_MSG_RESULT([no])
	wall=""
	wall_pedantic=""
	wall_pedantic_ansi=""
	pedantic_ansi=""
	dnl # --------------------------
	dnl # We only look for the non-ANSI strcasecmp if configure wasn't invoked
	dnl # with --enable-pansi
	dnl # --------------------------
	try_strcasecmp="";
	AC_CHECK_FUNC(strcasecmp, [try_strcasecmp=""], [try_strcasecmp="yes"])
	if test -n "${try_strcasecmp}"; then
		if test "${CC}" != "icl"; then
		  AC_DEFINE([HAVE_STRCASECMP], [], [have machine-supplied strcasecmp])
		fi
	fi
fi
AC_SUBST(wall)
AC_SUBST(wall_pedantic)
AC_SUBST(wall_pedantic_ansi)
AC_SUBST(pedantic_ansi)

dnl # -----------------------
dnl # HANDLE THE TOOLS DIRECTORY
dnl # Disable compilation of executables in the tools directory with the
dnl # '--disable-tools' flag (for Alpha).
dnl # -----------------------
AC_MSG_CHECKING([for --disable-tools])
AC_ARG_ENABLE(
	[tools],
	AS_HELP_STRING([--disable-tools],[disable tool compilation]),,
	[enable_tools=yes]
)
apbs_do_tools=""
if test x"$enable_tools" != "xno"; then
	AC_MSG_RESULT([no])
	AC_MSG_NOTICE([tools will be compiled])
	apbs_do_tools="tools"
else
	AC_MSG_RESULT([yes])
	AC_MSG_NOTICE([tools will not be compiled])
fi
AC_SUBST(apbs_do_tools)


dnl # -----------------------
dnl # HANDLE THE BLAS LIBRARIES
dnl # -----------------------
blas_lib=""
AC_ARG_WITH(
	    [blas], 
	    AS_HELP_STRING([--with-blas=LDFLAGS], [link to user-specified BLAS (specify flags to pass to ld)])
	    )
AC_MSG_CHECKING([for --with-blas])
if test x"$with_blas" != "xno" -a -n "$with_blas"; then
	blas_lib="${with_blas}"
	AC_MSG_RESULT([${blas_lib}])
 	AC_ARG_WITH(
		    [blas_name], 
		    AS_HELP_STRING([--with-blas-name=NAME], [name of BLAS library, defaults to blas]),, 
		    [with_blas_name="blas"]
		    )
	if test x"$with_blas_name" != "xno" -a -n "$with_blas_name"; then
		blas_name="${with_blas_name}"
	fi
 	AC_MSG_NOTICE([checking ${blas_name} using ${blas_lib}])
	AC_LANG_FORTRAN77
	LDFLAGS_SAVE=${LDFLAGS};
	CPPFLAGS_SAVE=${CPPFLAGS};
	LDFLAGS="-L${maloc_lib_path} ${blas_lib}";
	AC_CHECK_LIB(${blas_name},dscal,
		[blas_found="yes"],
		[blas_found=""],
		[${blas_lib} ${socket_lib} ${nsl_lib} ${math_lib}])
	LDFLAGS=${LDFLAGS_SAVE};
	CPPFLAGS=${CPPFLAGS_SAVE};
	if test -z "${blas_found}"; then
		AC_MSG_ERROR([BLAS libraries or headers missing:  exiting on error!])
	fi
	apbs_do_blas=""
	AC_LANG_C
else
	AC_MSG_RESULT([no])
	apbs_do_blas="blas"
	blas_lib=${contrib_path}/blas/.libs/libapbsblas.a
fi
AC_SUBST(apbs_do_blas)

dnl # -----------------------
dnl # If using Portland compilers, do not compile
dnl # tools/mesh/uhbd_asc2bin.f
dnl # -----------------------
case $F77 in
	pgf77*)
		UHBD_PORTLAND=""
		FFLAGS="${FFLAGS} -Mnomain";;
	*)
		UHBD_PORTLAND="Y";;
esac
AM_CONDITIONAL(UHBD_COMPILE, [test -n "${UHBD_PORTLAND}"])

dnl # -----------------------
dnl # If using Intel compilers add in -nofor_main
dnl # -----------------------
case $F77 in
	ifort)
		FFLAGS="${FFLAGS} -nofor_main";;
	*)
		;;
esac

dnl # -----------------------
dnl # CHECK WHETHER OR NOT TO LINK IN ARPACK FUNCTIONS
dnl # -----------------------
AC_MSG_CHECKING([for --with-arpack])
AC_ARG_WITH(
	[arpack],
	AS_HELP_STRING([--with-arpack=PATH], [enable ARPACK functions (specify path to lib)])
)

if test x"$with_arpack" != "xno" -a -n "$with_arpack"; then
	arpack_lib="-larpack -L${with_arpack}"
	arpack_do_tools="arpack"
	AC_MSG_RESULT([${arpack_lib}])
else
	arpack_do_tools=""
	AC_MSG_RESULT([no])
fi
AC_SUBST(arpack_lib)
AC_SUBST(arpack_do_tools)

dnl # -----------------------
dnl # CHECK WHETHER YOU WANT INLINE FUNCTIONS
dnl # -----------------------
AC_MSG_CHECKING([for --disable-inline])
AC_ARG_ENABLE(
	[inline],
	AS_HELP_STRING([--disable-inline],[disable inline functions (macros)]),,
	[enable_inline=yes]
)
if test x"$enable_inline" != "xno"; then
	AC_MSG_RESULT([no])
	AC_MSG_NOTICE([inline functions will be used])
else
	AC_MSG_RESULT([yes])
	AC_MSG_NOTICE([inline functions will not be used])
	AC_DEFINE([APBS_NOINLINE], [1], [do not inline functions])
fi

dnl # -----------------------
dnl # CHECK WHETHER YOU WANT TO INCLUDE TINKER
dnl # -----------------------
AC_MSG_CHECKING([for --enable-tinker])
AC_ARG_ENABLE(
	[tinker],
	AS_HELP_STRING([--enable-tinker],[include TINKER support]),,
	[enable_tinker=no]
)
if test x"$enable_tinker" != "xno"; then
    AC_MSG_RESULT([yes])
    AC_DEFINE([WITH_TINKER], [], [include TINKER support])
else
    AC_MSG_RESULT([no]) 
fi

dnl # -----------------------
dnl # CHECK FOR WINDOWS SPECIFIC LIBRARIES
dnl # -----------------------
case $host_os in
   mingw32*)
      AC_CHECK_LIB(wsock32,main,
        [wsock_found="yes"],
        [wsock_found=""])
      if test -n "${wsock_found}"; then
           socket_lib="-lwsock32"
      else
           AC_MSG_ERROR([Unable to find wsock32 libraries!])
      fi
      ;;
   cygwin*)
      AC_CHECK_LIB(rpclib,main,
        [rpc_found="yes"],
        [rpc_found=""])
      if test -n "${rpc_found}"; then
           socket_lib="-lrpclib"
      fi
      ;;
esac

dnl # -----------------------
dnl # ASSEMBLE A LIST OF LIBRARIES AND INCLUDE FILES THAT WILL BE USED IN ALL
dnl # COMPILATIONS
dnl # -----------------------
top_srcdir="`pwd`"
base_list="${FLIBS} ${tree_lib} ${vmetis_lib} ${vor_lib} ${mcx_lib} ${mc_lib} \ 
	   ${thread_lib} ${mpi_lib} ${math_lib} ${rl_lib} ${socket_lib} ${nsl_lib} ${blas_lib}"

case $host_os in

	darwin8*)
		extra_list1="-lSystemStubs"
		;;
	*)
		extra_list1=""
		;;

esac

dnl # -------------------------
dnl # Need to add in a case statement to put in lcc_dynamic for g77
dnl # This is for OS X only
dnl # -------------------------
extra_list2=""
case $host_os in

	darwin*)
		if test "$F77" == "g77"; then
			extra_list2="-lcc_dynamic"
		else
			extra_list2=""
		fi
		;;
		
esac

dnl # -----------------------
dnl # ADD ON THE LIBRARIES FOR VERSION 1.40 OF FETK
dnl # -----------------------
if test -n "${mc_found}"; then
	case $host_os in
	
	darwin*)
		extra_list3="-lsuperlu"
		;;
		
	*)
		extra_list3="-lsuperlu -lblas"
		;;
	esac
else

	extra_list3=""

fi

inc_list="-I. ${maloc_inc} ${mc_inc} ${mcx_inc} ${mpi_inc}"
lib_list="${base_list} ${extra_list1} ${extra_list2} ${extra_list3}"
AC_SUBST(lib_list)
AC_SUBST(inc_list)

apbs_build_libraries=""
if [[ "${host_os}" = "cygwin" ] && [ "${CC}" = "icl" ]]; then
  maloc_lib=""
  AC_SUBST(maloc_lib)
  apbs_build_libraries="../bin/libapbsmainroutines.la \
                        ../src/aaa_lib/libapbs.la \
                        ../contrib/blas/libapbsblas.la \
			../contrib/maloc/src/aaa_lib/libmaloc.la \
			../../Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/PlatformSDK/Lib/WSock32.Lib"
else
  apbs_build_libraries="${top_apbsdir}/bin/libapbsmainroutines.la \
			${top_apbsdir}/src/aaa_lib/libapbs.la \
			${maloc_lib} ${lib_list}"
fi
AC_SUBST(apbs_build_libraries)

dnl ##########################################################################
dnl 11. generate the makefiles
dnl ##########################################################################

AC_CONFIG_FILES([
    Makefile

    contrib/Makefile
    contrib/blas/Makefile
    contrib/pmgZ/Makefile
    contrib/aqua/Makefile

    tools/Makefile
    tools/mesh/Makefile
    tools/manip/Makefile
    tools/python/Makefile
    tools/arpack/Makefile
    tools/python/vgrid/Makefile

    src/Makefile
    src/generic/Makefile
    src/mg/Makefile
    src/fem/Makefile
    src/aaa_inc/Makefile
    src/aaa_inc/apbs/Makefile
    src/aaa_lib/Makefile

    examples/Makefile
    examples/actin-dimer/Makefile
    examples/alkanes/Makefile
    examples/born/Makefile
    examples/FKBP/Makefile
    examples/hca-bind/Makefile
    examples/ion-pmf/Makefile
    examples/ion-protein/Makefile
    examples/ionize/Makefile
    examples/pka-lig/Makefile
    examples/point-pmf/Makefile
    examples/protein-rna/Makefile
    examples/smpbe/Makefile
    examples/solv/Makefile
    
    bin/Makefile

])
AC_OUTPUT

AC_MSG_NOTICE([

APBS to be compiled with following settings:  ${CC} ${CFLAGS}
APBS to be compiled with following settings:  ${F77} ${FFLAGS}
APBS to be linked with following libraries :  ${lib_list}
APBS to be compiled with following includes:  ${inc_list}

Please type "make; make install"
])