Hi Sanjay, many thanks for your suggestions. At the end I have been able to solve the problem.
First I got an executable without jpeg, and then with some more efforts I got the jpeg option working.
However my installation looks different from your:
1)
The command "gfortran - v" to me gives:
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/aarch64-apple-darwin21/12.1.0/lto-wrapper
Target: aarch64-apple-darwin21
Configured with: ../gcc-12-branch/configure --prefix=/usr/local/gfortran --with-gmp=/Users/fx/devel/gcc/build_package/deps --with-zstd=/Users/fx/devel/gcc/build_package/deps --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk --build=aarch64-apple-darwin21 --enable-languages=ada,c,c++,fortran,jit,lto,objc,obj-c++ --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC)
2)
My modifications to the makefile.in are the following:
...
## CINCLUDE = /opt/X11/include
CINCLUDE = /opt/X11/include -I/usr/local/Cellar/jpeg/9e/include/
...
...
FF = gfortran-12
CC = gcc-12
...
...
LDOPTIONS = -L/opt/X11/lib -L/usr/local/opt/jpeg/lib -ljpeg -lX11 -lm -lblas -llapack
...
3) The command "otool -L feap" to me gives:
feap86n-jpeg:
/usr/local/opt/jpeg/lib/libjpeg.9.dylib (compatibility version 15.0.0, current version 15.0.0)
/opt/X11/lib/libX11.6.dylib (compatibility version 11.0.0, current version 11.0.0)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/opt/gcc/lib/gcc/current/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/local/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0)
/usr/local/opt/gcc/lib/gcc/current/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
Again, many thanks for your help
Giorgio